Optimize without overfitting
Find settings that work, not settings that happened to work once.
Trading on margin can lose you more than you put in. Past results, including backtests, do not predict future results. Cloud9Trader provides tools and education, not financial advice. Read the full risk warning.
1. Keep back some history
Section titled “1. Keep back some history”Do this: Decide on two periods before you start: one to optimize on, and a later one you will not look at until the end. For example, optimize on 2023 and test on the first half of 2024.
2. Optimize on the first period
Section titled “2. Optimize on the first period”Do this: Open the algorithm’s Optimize tab and select New Optimization. Give each external a range, such as 3 to 10 for fast and 15 to 50 for slow. Choose Exhaustive for a few combinations, or Genetic Algorithm for many.
You should see: A list of backtests, one per combination, that you can sort by profit or drawdown.
3. Pick a stable winner, not the top row
Section titled “3. Pick a stable winner, not the top row”Look for a region of settings that all do reasonably well, and pick from the middle of it. A single setting that does far better than its neighbours is usually luck.
4. Test it on the period you kept back
Section titled “4. Test it on the period you kept back”Do this: Run one backtest with your chosen settings on the second period.
If it does much worse there, the settings fit the past rather than the market. Go back to fewer externals or wider ranges, not to more tuning on the same data.
Common questions
Section titled “Common questions”How many externals should I optimize? As few as possible. Each one multiplies the combinations and the chance of a lucky fit.
What does it cost? An exhaustive optimization costs one backtest’s compute units for every combination. See Plans and credits.