Skip to main content

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​

PlanStatusMax Combinations
FreeNot available—
EssentialAvailable100
ProAvailable2,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:

FieldDescriptionExample
FromMinimum value (inclusive)10
ToMaximum value (inclusive)20
StepIncrement between values2

Example:

ParameterFromToStepValues Generated
rsi_period1020210, 12, 14, 16, 18, 20 (6 values)
oversold_threshold2535525, 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:

MetricBest for
Total profitMaximizing absolute returns
Sharpe ratioBest risk-adjusted performance
Max drawdownMinimizing worst-case loss
Win rateMaximizing trade consistency

Reading Results​

Results Table​

Each row represents one parameter combination:

rsi_periodoversold_thresholdTotal ReturnSharpeMax DrawdownWin RateTrades
143045.2%1.8-12%62%87
122538.1%1.5-15%58%112
203522.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​

ParameterFromToStepCount
fast52054
slow30100108

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​


© 2026 Vaanam, Inc. All rights reserved.