Skip to main content
Listen aloud is not supported in this browser.

AI Strategy Assistant

Complete guide to the AI chat in Strategy Builder: prompts, panel controls, review workflow, follow-ups, and troubleshooting.

How to get here

Navigation: Strategy Builder › New Strategy › AI Assistant

About the AI Strategy Assistant

The AI Strategy Assistant is a chat panel built into Strategy Builder. Instead of clicking through every leg, condition, and risk field yourself, you describe what you want in plain English — and the assistant drafts a full strategy configuration you can review, tweak, and save.

The assistant can configure:

  • Basic details — instrument, timeframe, intraday vs multiday
  • Trading legs — direction, quantity, options/futures/cash, entry and exit rules
  • Risk management — intraday cut-off, square-off, max loss/profit (when you ask for them)
  • Variables — deploy-time inputs when a concept does not map to a built-in indicator

You always remain in control: the AI fills the form; you verify every field before saving or deploying.


How to open the assistant

PathWhat happens
Strategy Builder → New Strategy → Build with AI AssistantSkips the instrument/timeframe wizard steps. Opens Strategy Builder with the chat panel automatically and defaults to Options as the instrument type.
Floating robot buttonOn any Strategy Builder session, tap the purple robot button (bottom-right) to open or return to chat.
Close and reopenUse the X in the chat header to hide the panel. The builder form keeps whatever the assistant last populated.

On desktop, the chat opens as a resizable panel on the right while the builder stays on the left.

On mobile, chat is full screen. Use View UI Builder inside the chat to switch back to the form, or close the panel with X.


Before you start — availability

When the panel opens, ATPAlgo checks whether an AI model is configured for your environment (/api/ai/chat/check) and loads the list of active models available for selection.

StateWhat you see
CheckingA loading spinner: “Checking AI availability…”
AvailableWelcome message with example prompts, chat input, and a model picker (admin default pre-selected)
Not availableA warning: “AI Assistant Currently Not Available” — contact your administrator to configure an AI model

If the assistant is unavailable, you can still build strategies manually using Create Strategy or Templates.

Your selected model is remembered in this browser. If an admin removes or deactivates that model, the picker falls back to the admin default.


Chat panel layout

ControlPurpose
Strategy Builder AI Assistant titleIdentifies the panel
Close (X)Hides the chat panel. On mobile, returns you to the builder view.

Message area

ElementPurpose
Welcome messageIntroduces the assistant; 2–3 random example prompt cards appear below (options, futures, equity intraday/swing, time-based, indicator-based, and more)
Your messagesShown right-aligned in a blue-tinted bubble
AI repliesShown left-aligned with markdown formatting (bold, lists, headings)
“Thinking…”Temporary placeholder while the AI processes your request
Example prompt cardsClickable cards under the welcome message — tap to copy a full strategy prompt into the input box
Backtest tipAfter your first strategy is created, the assistant shows a tip about running a backtest and asking for optimization help

Action buttons (below messages)

ButtonWhen shownPurpose
View UI BuilderMobile onlySwitches from chat to the Strategy Builder form so you can review populated fields
New SessionAfter at least one exchangeStarts a fresh chat (see Start a new session)

Input area

ControlPurpose
Text areaType your strategy request. Placeholder: “Ask me about strategy building…”
Model pickerChoose which AI model to use. Lists every model your administrator marked Active. Defaults to the admin Default model.
Send (up-arrow icon)Sends the message. Disabled when input is empty or AI is unavailable.

Keyboard shortcuts:

  • Enter — send the message
  • Shift+Enter — new line without sending

Step-by-step: build a strategy with AI

1. Describe your strategy

Write one clear message covering as much as you can. Strong prompts mention:

IncludeExamples
InstrumentNIFTY, BANKNIFTY, RELIANCE
Strategy styleIntraday, swing, multiday
Instrument typeOptions CE/PE, futures, cash equity
Entry logicRSI > 50, EMA crossover, enter at 9:30 AM, first 5-minute candle high
Timeframe5 minute, 15 minute, 1 hour
Exit / risk (optional)15% stop loss, 30% target, square off at 3:15 PM

Example prompts (a random subset appears as cards when you open a new session):

  • Intraday NIFTY RSI options with VWAP confirmation and square-off time
  • BANKNIFTY futures EMA momentum with trend filters
  • NIFTY weekly iron condor or short strangle premium-selling setups
  • Multiday NIFTY/SENSEX swing strategies using SMA crosses or breakouts
  • Time-based straddles, opening-range breakouts, and MACD/Supertrend momentum entries

Tap any example card in the welcome message to paste the full prompt into the input.

2. Send and wait

After you send:

  1. Your message appears in the chat.
  2. The assistant shows “Thinking…” while it calls the AI service.
  3. A text reply explains what was built (JSON blocks are stripped from the chat — you see a readable summary only).
  4. If a valid strategy was produced, the Strategy Editor updates automatically (desktop) or when you switch to View UI Builder (mobile).

3. Review the populated form

Open the builder tabs and verify each section. See Create Strategy for field-by-field explanations.

TabWhat to check
Trading LegsTrade type, quantity (lots), option strike/expiry, entry and exit conditions
Risk ManagementIntraday times, max loss/profit — only present if you asked for them or the strategy needs them
VariablesAny deploy-time inputs the AI created for concepts without a matching indicator
Desktop layout

On desktop, the builder and chat appear side by side. Drag the left edge of the chat panel to resize (25%–50% of screen width). The page breadcrumb shifts to make room.

4. Refine with follow-up messages

You can keep chatting in the same session. Each new message can:

  • Change the instrument or timeframe
  • Add or remove legs
  • Adjust entry/exit conditions or risk rules
  • Ask for clarification on what was built

The assistant sends the last 10 messages of conversation history for context, so follow-ups like “change stop loss to 20%” or “use weekly expiry instead” work naturally.

If your request is ambiguous (e.g. “buy an option” with no index or CE/PE), the assistant may ask a short clarification question instead of filling the form. Answer in the chat, then it will generate the strategy.

5. Save your strategy

When you are satisfied:

  1. Desktop — click Save in the breadcrumb toolbar.
  2. Mobile — switch to the builder view, then tap Save Strategy at the bottom.

For a new strategy, enter name, description, and optional tags in the save modal. See Create Strategy — Save your strategy.

Then backtest before live deployment.


Analyze backtest results and get improvement suggestions

After you run a backtest from Strategy Builder, the AI assistant can read your latest backtest metrics and the current strategy configuration, then suggest concrete tweaks to improve net P&L, reduce drawdown, or improve win rate.

How to start an analysis

MethodSteps
Analyze & Improve buttonRun a backtest → open the Backtest Results drawer → click Analyze & Improve in the results header. The AI panel opens and starts an optimization analysis automatically.
Chat follow-upAfter a backtest completes, open the AI assistant and ask e.g. “How can I improve this?” or “Reduce my drawdown” — the assistant uses your latest backtest context when your message relates to performance.
Panel behavior

The backtest drawer and AI chat panel are not shown side by side. Clicking Analyze & Improve closes the results drawer and opens the AI panel. Your backtest data stays in memory for the analysis.

What the AI analyzes

The assistant receives a compact summary including:

DataUsed for
Net P&L, win rate, profit factor, Sharpe ratioOverall performance diagnosis
Max drawdown and drawdown durationRisk recommendations (MaxLoss, wider SL, profit trailing)
Exit-reason breakdownWhether too many trades hit stop loss vs target vs square-off
Current strategy JSONExact field names and current values to change

What you get back

  1. A performance diagnosis (2–3 sentences)
  2. 3–5 prioritized recommendations, each with:
    • The exact field (e.g. Leg 1 Stoploss, MaxProfit, TargetProfit)
    • Current value → recommended value
    • Expected impact on P&L or drawdown
  3. An Apply suggested changes button when the AI returns an updated strategy

Apply and validate

  1. Read the recommendations in chat.
  2. Click Apply suggested changes to update the Strategy Builder form (nothing is applied automatically).
  3. Review the updated Trading Legs and Risk Management tabs.
  4. Re-run the backtest to compare results before saving or deploying.
Iterative tuning

Run backtest → Analyze & Improve → apply suggestions → backtest again. Repeat until metrics meet your goals.

Not guaranteed improvement

Suggestions are based on historical backtest data and AI reasoning. Past performance does not guarantee future results. Always validate changes with a fresh backtest.

Optimizing an existing strategy (edit mode)

When you open a saved strategy in edit mode (Strategy Builder with an existing strategy loaded):

ScenarioWhat gets analyzed
No unsaved changesBacktest runs the saved strategy from your library. AI receives that exact JSON plus results.
Unsaved form editsBacktest runs your current draft from the form. AI optimizes the draft, not the last saved version.

After you click Apply suggested changes, review the builder and click Save to persist updates to your strategy.


Run Backtest page — single strategy optimization

The same Analyze & Improve flow is available on Single Strategy Backtest (/backtest/single), not only from Strategy Builder.

How to start

MethodSteps
Analyze & ImproveSelect a strategy → run backtest → click Analyze & Improve in the results header
Floating robot buttonTap the purple robot button (bottom-right) to open the Backtest AI Assistant and ask follow-up questions

What you get back

  1. Performance diagnosis and prioritized recommendations (stop loss, targets, MaxProfit, etc.)
  2. Open in Strategy Builder with changes — navigates to Strategy Builder with the suggested strategy loaded so you can review, save, and re-run
Workflow

Run Backtest → Analyze & ImproveOpen in Strategy Builder with changes → review → save → backtest again.


Run Backtest page — portfolio quantity optimization

On Portfolio Backtest (/backtest/portfolio), the AI assistant focuses on quantity allocation across the strategies you selected.

How to start

MethodSteps
Analyze & ImproveSelect two or more strategies → configure quantity per strategy → run portfolio backtest → click Analyze & Improve
Floating robot buttonOpen the Portfolio Backtest AI Assistant and ask e.g. “Which strategies should I size up or down?”

What the AI analyzes

DataUsed for
Combined portfolio metricsOverall P&L, drawdown, Sharpe
Per-strategy breakdownEach strategy’s contribution, win rate, and exit reasons
Current quantity settingsBaseline allocation before recommendations
Excluded strategiesStrategies you removed from the combined view

What you get back

  1. Diagnosis of which strategies help or hurt the portfolio
  2. Recommended quantity per strategy (including suggesting to exclude weak performers)
  3. Apply quantity suggestions — updates the per-strategy quantity fields on the portfolio form (nothing is applied automatically)

After applying, re-run the portfolio backtest to validate the new allocation before deploying.


What the AI configures automatically

When your message is clear enough, the backend generates a complete strategy JSON and the builder maps it into form fields.

SectionTypical AI behavior
Basic detailsInfers instrument, timeframe, intraday vs multiday from your text
LegsSets trade direction, quantity in lots (default 1 lot), options/futures/cash, entry conditions from indicators or time rules
ExitAdds stop loss / profit target only if you mention them (or if required for safety, e.g. naked option selling)
Risk managementFor intraday strategies, may set entry cut-off and square-off times; other limits only when requested
VariablesCreated when you mention a value that has no built-in indicator (e.g. custom threshold, premium level)

The assistant uses ATPAlgo's supported indicators (RSI, EMA, SMA, MACD, Supertrend, Candle, Bollinger Bands, ATR, and others). If your idea does not map to an indicator, it may create a Variable you override at deploy time.


Writing better prompts

Do

  • Name the index or stock explicitly
  • State CE or PE for option strategies
  • Mention intraday vs swing if it matters
  • Include stop loss / target if you want leg-level exits
  • Specify time-based rules with clock times (e.g. 9:30 AM entry)
  • Use follow-up messages to tweak one thing at a time

Avoid relying on the AI for

  • Guaranteed returns or “sure profit” setups — the platform may append a disclaimer when profit expectations are mentioned
  • Exact strike prices unless you describe them (ATM, 2 strikes OTM, etc.)
  • Values the form will reject — review quantity limits and enabled risk fields after population

Quantity note

The AI always uses lots (1, 2, 3…), not raw share counts. For options and futures, 1 lot equals the exchange lot size for that instrument.


Start a new session

Tap New Session when you want to discard the current chat and start a different strategy idea.

If the builder already has data or you have sent messages, a confirmation modal appears:

OptionEffect
Save & Start NewValidates the form, opens the save flow, then clears the builder and chat
Discard & Start NewClears all leg/risk/basic fields and resets chat to the welcome message
CancelKeeps your current strategy and chat history

A new session also generates a fresh session ID on the server for chat history tracking.


Daily message limits

Registered users: Your organization may enforce a daily limit on AI chat messages per user. If you exceed the limit, the next send returns an error such as “Daily chat limit reached… Please try again tomorrow.”

Guest users (no sign-in): A separate daily chat limit for guest users applies while you try the Strategy Builder without an account. When you reach the limit, a prompt explains that you can sign in or register for free to keep using the Strategy Builder, along with benefits such as saving strategies, longer backtests, and paper trading.

If sends start failing, wait until the next calendar day or sign in / register to continue with a free account.


Mobile vs desktop

FeatureDesktopMobile
Panel layoutFixed right panel beside builderFull-screen chat over builder
Open assistantRobot button (bottom-right)Same floating button (above save bar)
Review formVisible side by sideTap View UI Builder or close chat
Resize chatDrag left edge of panel (25%–50% width)Not available
Send buttonCircular arrow button inside the input box (bottom-right)Same, slightly larger touch target
Input heightStarts at one line, expands up to 3 lines with scrollSame layout, larger font for touch
SidebarAuto-collapses when chat opensN/A

Troubleshooting

IssueWhat to try
“AI Assistant Currently Not Available”Administrator must configure at least one active AI model (and a default). Use manual builder or templates meanwhile.
Form not updated after replyCheck for an error toast. Switch to builder tabs and confirm instrument is set. Try a more specific follow-up message.
“Could not parse strategy JSON”Rare AI formatting error. Rephrase the request or build the problematic section manually.
Validation errors on SaveAI may have left a required field empty. Open each tab and fix highlighted fields — see Create Strategy.
Unexpected stop loss / riskAI adds risk only when you ask or when strategy type requires it. Disable or edit under Exit criteria or Risk Management.
Daily limit errorWait until the next calendar day or contact support.

Suggested workflow

  1. Open New Strategy → Build with AI Assistant (or tap the robot button on an existing builder session).
  2. Send a detailed first message (instrument, type, entry, optional exits).
  3. Read the AI’s summary in chat; scan Trading Legs and Risk Management in the builder.
  4. Send follow-up tweaks until the configuration matches your intent.
  5. Backtest from the toolbar, then use Analyze & Improve (or ask in chat) to tune performance.
  6. Click Apply suggested changes, re-run the backtest, then Save when satisfied.
  7. Deploy when backtest results look acceptable.
AI + manual editing

The assistant is a starting point, not a black box. Combine chat with manual edits in the builder — change indicators, add condition groups, or tighten risk limits after the first draft.

Not investment advice

Algo Trading Platform provides tools to implement your rules. AI-generated strategies are not financial advice. Always review, backtest, and understand risk before live trading. See the regulatory disclaimer.

Workflow

Step-by-Step

  1. Open Strategy Builder → New Strategy → Build with AI Assistant, or tap the robot button on an existing builder session.
  2. Describe your strategy in one message: instrument, option type, entry logic, timeframe, and optional stop loss / target.
  3. Read the AI reply in chat, then review Legs, Risk, and Variables in the builder.
  4. Send follow-up messages to refine (e.g. change strike, add a leg, adjust risk).
  5. Use Backtest in the toolbar to test the draft without saving first.
  6. After backtest completes, use Analyze & Improve in the results drawer (or ask the AI in chat) to get tuning suggestions.
  7. Click Apply suggested changes, re-run the backtest, then click Save when satisfied.
Pro tip

Use the ? help icon in the app toolbar on any page to jump directly to its documentation section.

Screenshots

Add PNG files under atp-docs/static/img/ and map them in scripts/generate-docs.js (PAGE_SCREENSHOTS).

Example: ![Screenshot](/img/ai-assistant.png)