Strategy Optimization
Use genetic algorithms to fine-tune strategy parameters.
# Strategy Optimization
NexusTrade's **optimizer** uses genetic algorithms to automatically find better values for your strategy's parameters (indicator lookback periods, thresholds, allocation amounts, etc.).
## What Is a Genetic Algorithm?
A genetic algorithm mimics natural selection:
1. **Population:** Create a population of strategy variants with randomized parameters.
2. **Evaluation:** Backtest each variant and measure its fitness (return, Sharpe ratio, etc.).
3. **Selection:** The best-performing variants survive to the next generation.
4. **Crossover & Mutation:** Survivors are combined and slightly mutated to create new variants.
5. **Repeat:** This process repeats for multiple generations, progressively improving performance.
## Running an Optimization
1. Navigate to your portfolio dashboard.
2. Click the **"Optimizer"** tab.
3. Configure the optimization parameters:
- **Population size:** How many variants per generation (more = slower but more thorough).
- **Number of generations:** How many rounds of evolution to run.
- **Date range:** The historical period to optimize against.
4. Click **"Start Optimization"** and monitor progress.
## Reading Optimization Results
Each result is an **optimization vector** — a portfolio variant with its strategies and backtest performance. You can:
- Compare vectors side-by-side
- View the exact parameter changes from your original strategy
- Click **"Edit"** to replace your portfolio with an optimized variant
## Avoiding Overfitting During Optimization
The optimizer can find strategies with incredible backtested returns, but this doesn't mean they'll work in live markets. To avoid overfitting:
1. **Use a train/validation split:** Optimize on 2018-2022, then validate on 2023-2024. If performance drops significantly, the strategy is overfit.
2. **Keep it simple:** Don't optimize strategies with too many parameters. Simpler strategies generalize better.
3. **Look at multiple metrics:** Don't just maximize return. Also check Sharpe ratio and max drawdown.
## Optimization Limits
| Plan | Optimizations/Day | Max Population | Max Generations | Speed |
|------|-------------------|----------------|-----------------|-------|
| Observer (Free) | 0 | — | — | — |
| Data-Driven Investor | 12 | 12 | 20 | Regular |
| Algorithmic Trader | 48 | 30 | 30 | Lightning |
| Unstoppable Quant | 100 | 50 | 100 | Lightning |