Strategy Optimizer
Find the best parameter settings for your strategy by testing all combinations automatically.
What is the Strategy Optimizer?
The optimizer runs your strategy across a grid of parameter combinations and ranks the results. Instead of manually testing "does RSI period 10 or 14 or 20 work better?", the optimizer tests all of them and tells you which performed best.
Overfitting Warning Optimized parameters are tuned to historical data. A strategy that scored well in optimization may not perform the same going forward. Always validate results on out-of-sample data.
Availability
| Plan | Status | Max Combinations |
|---|---|---|
| Free | Not available | — |
| Essential | Available | 100 |
| Pro | Available | 2,000 |
How It Works
1. Define a Strategy with Placeholders
Write your strategy query using parameter placeholders instead of fixed numbers. Placeholders use curly braces:
ASSET_STOCK_TECH_RSI_C_{rsi_period} < {oversold_threshold}
This tells the optimizer that rsi_period and oversold_threshold are variables to test.
2. Set Parameter Ranges
For each placeholder, define:
| Field | Description | Example |
|---|---|---|
| From | Minimum value (inclusive) | 10 |
| To | Maximum value (inclusive) | 20 |
| Step | Increment between values | 2 |
Example:
| Parameter | From | To | Step | Values Generated |
|---|---|---|---|---|
rsi_period | 10 | 20 | 2 | 10, 12, 14, 16, 18, 20 (6 values) |
oversold_threshold | 25 | 35 | 5 | 25, 30, 35 (3 values) |
3. Total Combinations
The optimizer generates the Cartesian product of all parameter values.
Total combinations = values_param_1 × values_param_2 × ...
In the example above: 6 × 3 = 18 combinations
Each combination runs as a separate backtest.
Plan limits are on total combinations, not individual parameters. A 10×10 grid = 100 combinations (Essential plan limit), not 20.
4. Choose a Ranking Metric
Select which metric to sort results by:
| Metric | Best for |
|---|---|
| Total profit | Maximizing absolute returns |
| Sharpe ratio | Best risk-adjusted performance |
| Max drawdown | Minimizing worst-case loss |
| Win rate | Maximizing trade consistency |
Reading Results
Results Table
Each row represents one parameter combination:
| rsi_period | oversold_threshold | Total Return | Sharpe | Max Drawdown | Win Rate | Trades |
|---|---|---|---|---|---|---|
| 14 | 30 | 45.2% | 1.8 | -12% | 62% | 87 |
| 12 | 25 | 38.1% | 1.5 | -15% | 58% | 112 |
| 20 | 35 | 22.4% | 1.1 | -8% | 71% | 34 |
Results are sorted by your selected ranking metric (descending for profit/Sharpe/win rate, ascending for drawdown).
Drill Into a Combination
Click any row to view the full backtest result for that parameter combination — equity curve, trade table, all metrics.
Best Practices
Avoid Overfitting
The biggest risk with optimization is finding parameters that happen to work on past data but fail going forward.
Signs of overfitting:
- The best combination has dramatically better results than nearby combinations
- Very few trades (< 20) — likely noise, not signal
- Results don't hold up when you change the date range slightly
How to mitigate:
- Use out-of-sample testing: Optimize on one date range, then manually test the winning parameters on a different date range
- Check robustness: If RSI period 14 scores well, do 13 and 15 also score well? If nearby values perform similarly, the result is more likely to be real
- Prefer more trades: A combination with 80 trades and 40% return is more reliable than one with 8 trades and 80% return
Keep Ranges Reasonable
- Don't test RSI periods from 1 to 200 — most meaningful RSI values are between 5 and 30
- Wider ranges waste combinations on implausible parameters
- Use your domain knowledge to set sensible bounds
Use Sharpe Ratio for Ranking
Total profit alone can be misleading — a strategy with 100% return and 60% max drawdown is worse than one with 50% return and 10% drawdown. Sharpe ratio balances return against risk.
Example: Optimizing an SMA Crossover
Strategy Template
Entry: ASSET_STOCK_TECH_SMA_C_{fast} > ASSET_STOCK_TECH_SMA_C_{slow}
Exit: ASSET_STOCK_TECH_SMA_C_{fast} < ASSET_STOCK_TECH_SMA_C_{slow}
Parameter Ranges
| Parameter | From | To | Step | Count |
|---|---|---|---|---|
fast | 5 | 20 | 5 | 4 |
slow | 30 | 100 | 10 | 8 |
Total combinations: 4 × 8 = 32 (within Essential plan limit of 100)
What You Learn
The results show which fast/slow MA pair historically produced the best risk-adjusted returns for your selected universe and date range.
Troubleshooting
"Too many combinations" Error
Your parameter ranges generate more combinations than your plan allows.
Solutions:
- Increase the step size (e.g., step 5 instead of 1)
- Narrow the from/to range
- Reduce the number of parameters
- Upgrade to Pro for up to 2,000 combinations
Optimization Takes a Long Time
Each combination runs a full backtest. A large universe (S&P 500) × many combinations × long date range = significant compute.
Solutions:
- Start with a smaller universe (e.g., a basket of 10 stocks)
- Use a shorter date range for initial exploration
- Reduce combinations, then refine with a narrower range around the best results
Next Steps
- Strategy Builder — Create the base strategy to optimize
- DSL Grammar — Query language reference
© 2026 Vaanam, Inc. All rights reserved.