Getting Started with AI Builder

Describe your trading strategy in plain English and let AI generate TradeStaq strategy code for you.

Prerequisites

Before using the AI Builder, ensure you have:

  • A subscription tier with AI Builder access (check your plan's AI prompt quota)
  • Basic understanding of trading concepts (entries, exits, indicators)
  • At least one connected exchange account (paper trading recommended for testing)

Note: Each subscription tier includes a monthly AI prompt quota. Your remaining prompts are displayed in the top-right corner of the builder. Quotas reset on the 1st of each month.

Accessing the Builder

  1. Log into your TradeStaq dashboard
  2. Click Strategies in the sidebar
  3. Click the AI Builder button

You will see a chat interface with prompt suggestions to help you get started.

Your First Strategy

Step 1: Choose a Starting Point

When you open AI Builder, you will see four prompt suggestions:

SuggestionDescription
RSI Mean-ReversionBuys when RSI is oversold and sells when overbought, with ATR-based stops
EMA CrossoverTrend-following strategy using fast/slow EMA crossover with a 200 EMA trend filter
Breakout StrategyEnters on Donchian channel breakouts with volume confirmation and trailing stops
Convert StrategyConverts an existing strategy from TradingView, MQL5, Gunbot, or another platform

Click any suggestion to pre-fill the chat input, or type your own strategy description from scratch.

Step 2: Review the AI Response

After sending your message, the AI will respond with:

  • An explanation of the strategy logic
  • A complete TradeStaq strategy code block
  • Notes on parameters, risk management, and suggested improvements

Code blocks in the AI response are automatically extracted to the code editor panel on the right side of the screen. The editor opens as soon as the AI generates valid strategy code.

Step 3: Refine with Follow-Up Messages

Your first result is a starting point. Use follow-up messages to iterate:

  • "Add a 200 EMA trend filter so it only takes long trades above the 200 EMA"
  • "Change the stop loss to use ATR instead of a fixed percentage"
  • "Add a cooldown period so it waits 5 candles after a losing trade"
  • "Make the RSI period configurable using td.config"

Each follow-up updates the code in the editor panel. The AI has full context of your conversation history, so you can build complexity incrementally.

Step 4: Test Your Strategy

Once you have code in the editor, click the Test button to validate it. The editor provides two testing modes:

Quick Test

  • Runs against 7 days of historical data
  • Fast execution for rapid iteration
  • Shows return, win rate, trade count, drawdown, and profit factor

Full Backtest

  • Requires saving the strategy first (click Save in the editor toolbar)
  • Configurable time period (7 to 365 days depending on your tier)
  • More comprehensive results with detailed trade records

Both modes require selecting an exchange and trading symbol. The test configuration panel lets you choose:

  1. Exchange - Select from your connected exchanges
  2. Symbol - Search and select a trading pair (USDT pairs shown by default)
  3. Timeframe - Choose the candle timeframe for analysis

Tip: Start with Quick Test during the iterative phase. Switch to Full Backtest once you are satisfied with the strategy logic.

Tips for Effective Prompts

Be Specific About Entry and Exit Conditions

Bad:  "Make a strategy that buys low and sells high"
Good: "Buy when RSI(14) drops below 30 and the price is above the 200 EMA.
       Sell when RSI crosses above 70 or when price drops 2% below entry."

Mention Risk Management

Include stop loss and take profit requirements in your initial prompt:

  • "Use a 2% stop loss and 4% take profit"
  • "Set stop loss at 1.5x ATR below entry"
  • "Use a trailing stop that follows price by 3%"

Specify Indicators and Parameters

Name the exact indicators and their settings:

  • "Use RSI with a 14-period lookback"
  • "Use EMA 9 and EMA 21 for crossover signals"
  • "Use Bollinger Bands with 20-period SMA and 2 standard deviations"

Mention Timeframe Preferences

Different strategies work better on different timeframes:

  • "This is a scalping strategy for the 5-minute chart"
  • "Design this for swing trading on the 4-hour timeframe"
  • "Optimize for the 1-hour chart"

Describe Position Management

Tell the AI how you want to manage open positions:

  • "Only hold one position at a time"
  • "Close the position if it has been open for more than 20 candles"
  • "Add to the position if price drops another 2% (DCA)"

Understanding AI Responses

Code Extraction

When the AI includes a JavaScript or TypeScript code block in its response, the code is automatically extracted to the editor panel. The extraction logic looks for blocks that contain TradeStaq API calls (td.trade, td.indicators, td.position, etc.) or are substantial enough to be a complete strategy.

You can edit the code directly in the Monaco editor after extraction. Changes you make in the editor are preserved even as you continue the conversation.

Conversation History

All conversations are automatically saved. You can:

  • Resume later - Click the history icon (sidebar toggle) to see past conversations
  • Start fresh - Click the + button to begin a new conversation
  • Delete - Remove old conversations from the history panel

Each conversation remembers its messages, the current code in the editor, and any linked saved strategy.

Multiple Iterations

The best strategies come from multiple rounds of refinement. A typical workflow:

  1. Start with a basic concept
  2. Test it with Quick Test
  3. Ask the AI to improve weak areas (high drawdown, low win rate, etc.)
  4. Test again
  5. Repeat until satisfied

Attachments

Depending on your subscription tier, you may have access to additional input methods:

  • Image attachments - Upload screenshots of charts or strategy diagrams for the AI to analyze
  • Candle data - Attach real market data from your connected exchanges to give the AI concrete price context

Saving Your Strategy

When your strategy is ready, click Save in the editor toolbar. You will be prompted for:

FieldDescription
Strategy NameA descriptive name (e.g., "RSI Mean Reversion 4H")
DescriptionWhat the strategy does and how it works
Market TypeSpot only, Futures only, or both

Saved strategies appear in your Strategies list and can be used to create trading bots.

Next Steps