AI Builder
Create and edit trading strategies using natural language with the AI-powered assistant.
The AI Builder lets you create and modify trading strategies using natural language. Simply describe what you want, and the AI assistant will build it for you.
Getting Started
Accessing the AI Builder
- Open any strategy in the Studio
- Click the Build tab in the right panel
- Select AI to open the chat interface
When you create a new strategy, prompt cards appear to help you get started quickly with common strategy types.
Your First AI-Built Strategy
Type a natural language description of your strategy:
Create a BTC strategy that buys when RSI drops below 30
and sells when RSI rises above 70The AI interprets your request and generates a complete, working strategy. It handles the details â adding data sources, creating indicators, setting up entry/exit conditions â so you can focus on the logic you want.
The AI may structure the strategy differently each time (e.g., combining signals into one block vs. separate blocks), but the end result will match your intent. Always review the generated strategy in the workflow editor.
What You Can Do
Create Strategies from Scratch
Describe your strategy idea in plain English:
Build a trend-following strategy that uses EMA crossover.
Buy when the 9-period EMA crosses above the 21-period EMA,
with a 2% stop loss and 4% take profit.Add Components
Ask the AI to add specific elements:
Add a MACD indicator to detect momentumAdd a stop loss at 3% below entry priceAdd ETH as a secondary data source on the 4-hour timeframeModify Existing Strategy
Make changes to your current strategy:
Change the RSI period from 14 to 21Update the position size to $1000Remove the take profit ruleRun Backtests
Test your strategy with historical data:
Run a backtest for the last 6 monthsBacktest from January 2024 to June 2024Ask Questions
Get information about your strategy:
What indicators does this strategy use?Explain how the entry conditions workExample Prompts
Trend Following
Create a trend-following strategy for BTC that:
- Uses EMA(9) and EMA(21) crossover for entries
- Only trades in the direction of the daily trend
- Has a trailing stop loss of 2%Mean Reversion
Build a mean reversion strategy that buys ETH when:
- RSI(14) is below 30 (oversold)
- Price is below the lower Bollinger Band
- Close position when RSI rises above 50DCA (Dollar Cost Averaging)
Create a simple DCA strategy that buys $500 of Bitcoin
every Monday regardless of priceMulti-Indicator
Create a strategy combining multiple signals:
- MACD histogram positive
- RSI between 40 and 60
- Price above 200 SMA
Enter long when all conditions alignCustom Code
Add a custom code block that calculates the average
volume over the last 20 bars and generates a signal
when current volume is 2x higher than averageExpression Syntax Reference
The AI generates strategies using AlgoHive's expression syntax. Understanding these patterns helps you review and refine what gets generated.
Common Expression Patterns
Here are typical expressions the AI might use for common trading concepts:
Crossovers:
cross_above(fast_ma, slow_ma) # Fast crosses above slow
cross_below(rsi, 70) # RSI crosses below 70Comparisons:
rsi < 30 # RSI below threshold
btc.close > bb_upper # Price above upper band
volume > SMA(volume, 20) * 1.5 # Volume spikeTrend Detection:
EMA(btc.close, 50) > EMA(btc.close, 200) # Golden cross state
rising(btc.close, 5) # Price rising over 5 barsMulti-Condition Logic:
trend_up AND momentum_ok AND high_volume # All conditions must be true
oversold OR at_support # Either conditionYou can view and edit any generated expressions in the workflow editor. Click on an analysis block to see its outputs and modify them if needed.
Key Expression Functions
These are the common functions the AI uses when building strategies:
| Function | What It Does | Example |
|---|---|---|
cross_above(a, b) | True when a crosses above b | cross_above(fast_ma, slow_ma) |
cross_below(a, b) | True when a crosses below b | cross_below(rsi, 70) |
rising(x, n) | True when x is higher than n bars ago | rising(btc.close, 5) |
falling(x, n) | True when x is lower than n bars ago | falling(rsi, 3) |
For the complete expression syntax reference, see Expression Syntax.
Best Practices
Be Specific
Good
"Add a stop loss at 2% below entry price with a trailing activation at 1% profit"
Less Clear
"Add some risk management"
Start Simple
Begin with basic strategies and add complexity incrementally:
- Start with a single indicator entry
- Add exit conditions
- Add risk management (stop loss, take profit)
- Add filters or additional confirmations
Review Changes
The AI shows you exactly what it's modifying. Review the changes in the workflow editor before running a backtest.
Always review the strategy logic before deploying to live trading. The AI is a tool to help you build faster, but you're responsible for the final strategy.
Use Backtesting
After making changes, ask the AI to run a backtest:
Run a backtest to see how this performsThis helps validate your strategy logic before deployment.
Understanding AI Actions
Activity Indicators
While the AI works, you'll see activity updates:
| Status | Meaning |
|---|---|
| Thinking | AI is analyzing your request |
| Exploring | Reading current strategy state |
| Modifying | Making changes to the strategy |
| Validating | Checking for errors |
| Testing | Running a backtest |
Tool Operations
The AI uses these operations internally:
- Add Data Source â Adds market data (BTC, ETH, etc.)
- Add Analysis â Creates indicator/signal blocks
- Add Code â Creates custom JavaScript logic
- Add Entry â Sets up entry conditions
- Add Manage Rule â Configures stop loss, take profit, etc.
- Update/Delete â Modifies or removes components
Conversation Management
Thread Persistence
Your conversations are saved automatically. You can:
- Continue where you left off
- Start a new conversation for a fresh context
- Reference previous changes in the same thread
Resuming Conversations
If you return to a strategy after a while, the AI will offer to resume or start fresh:
When resuming an old thread, the AI provides a summary of what was previously discussed.
Context Awareness
The AI always reads your current strategy state before making changes. This means:
- It knows what components already exist
- It won't duplicate existing elements
- It can reference existing blocks by name
Model Selection
You can choose different AI models from the dropdown:
| Model | Best For |
|---|---|
| Auto | General use (default) |
| Fast | Quick responses, simple tasks |
| Capable | Complex strategies, detailed explanations |
Different models have different context limits and capabilities. "Auto" selects the best model for your request.
Limitations
What the AI Won't Do
- Auto-iterate endlessly â It won't keep modifying without your input
- Silent error correction â It stops and asks if something is wrong
- Override safety settings â Leverage defaults to 1x for safety
Technical Limits
- Maximum 15 back-and-forth exchanges per request
- Context window limits vary by model
- Complex operations may take 10-30 seconds
When to Use Manual Editing
Some scenarios are better handled in the visual editor:
- Fine-tuning exact expression syntax
- Reorganizing block connections
- Copying components between strategies
Troubleshooting
"Strategy has validation errors"
The AI detected issues with your strategy. Ask:
What are the current validation errors?Changes not appearing
Make sure to check the workflow editor â changes apply in real-time but you may need to scroll or zoom to see new blocks.
AI seems confused
Start a new conversation to reset context:
Let's start fresh. I want to build a simple RSI strategy.Tips for Power Users
Batch Operations
You can request multiple changes at once:
Add RSI and MACD indicators, create entry conditions
when both are bullish, and add a 2% stop lossReferencing Blocks
Use descriptive names when you have multiple similar components:
Update the "trend_signals" analysis block to use EMA(50) instead of SMA(50)Complex Logic
For advanced strategies, describe the logic step by step:
I want to build a strategy that:
1. Tracks whale wallet activity using a custom data source
2. Enters long when whales are accumulating
3. Uses ATR-based position sizing
4. Has a trailing stop based on recent swing lows
Let's start with step 1 - add the data source first.Breaking complex strategies into steps helps the AI understand your intent and gives you checkpoints to verify each part works correctly.