Stop wasting your time with backtests! Do this instead…
Austin Starks · Originally published
Use controlled search with a separate later test instead of ad hoc backtest tuning
Beginners rely on backtests to tell them whether or not their strategy is a good idea.
While backtests provide valuable information, attempting to tweak your strategy solely to improve backtest results can lead to undesirable outcomes. Some of these include:
- Highly inefficient! Your approach isn’t systematic, so how do you know you tweaked it to the right parameters?
- Extremely dangerous! Trying to improve a backtest results over a specific time period is bound to lead to overfitting.
- Massively unscalable! Are you going to tweak the parameters every week? What if the best parameters for this week are different from the best parameters for next week?
There is a better, more efficient, highly scalable solution.
Automated Strategy Optimization with Genetic Algorithms
The initialization step
in genetic
optimization
There are a lot of big words within this heading, so I’m going to break it down.
- Automated: Operated by computers without human intervention
- Strategy: Planned approach to achieve long-term goals or objectives
- Optimization: Process of making something as effective as possible.
- Algorithms: A step-by-step procedure for completing a task. Think like a baking recipe
- Genetic Algorithms: An algorithm inspired by natural selection
Essentially, automated strategy optimization uses a biologically-inspired step-by-step procedure to make something as effective as possible. We can use these algorithms to automatically find the best parameters for our portfolio without having to manually run hundreds of backtests.
If you’re curious about how it works under the hood, check out the following articles:
How it works in general:
From Beaks to Bytes: Genetic Algorithms in Trading, Investing, and Finance
A Biologist's Guide to Financial Evolution Through Artificial Intelligence Pssst, You! The original story is on Medium…
nexustrade.ioHow to customize a genetic optimization:
Mathematically Improve Your Trading Strategy: An In-Depth Guide
The Most Important Guide for All Traders in 2024 Austin Starks ∙ 8 min read ∙ View on Medium An In-Depth Guide On…
nexustrade.ioUsing a Genetic Algorithm as a Replacement for Manual Backtests
Genetic search automates the selection of strategy parameters using historical backtests. It can make the search systematic, while still selecting strategies that fit the search data too closely. Keep a later evaluation separate from every choice made during the search.
For a later completed example, inspect the NVDA search and validation record dated October 2026. Its historical April-to-June 2024 test gained 22.06%, versus 36.00% for the stored NVDA buy-and-hold comparison. The strategy bought once and never sold, so it failed the intended daytrading behavior despite the positive return. The linked record shows the frozen rules, search settings, later orders and failed criteria together.
Notice this is similar to how you would find the best parameters for your strategy, but it does so automatically and systematically. It also has techniques for limiting overfitting, such as train/test split and separating the training set into segments. Here’s how you can apply it in practice.
Step 1) Create (or copy) a portfolio of trading strategies
The step-by-step guide on outperforming the market
Making money either involves doing research or taking risks Austin Starks in DataDrivenInvestor ∙ 5 min read ∙ View on…
nexustrade.ioI’ve written plenty of articles (like the linked one above) about how someone can create their own trading rules for their specific goals. So, this article will not talk about it in detail. If you want to follow along, pick a random strategy in the NexusTrade Strategy Library.
NexusTrade Strategy Library - Algorithmic Trading Strategies
Explore our collection of pre-configured algorithmic trading strategies. Analyze performance, initiate backtests, view…
nexustrade.ioStep 2) Launch a genetic optimization. Iterate, and improve.
A genetic optimization
with NexusTrade
The process will find a set of portfolios that achieve your specified goals. For example, if your goal is to minimize drawdown, it might create portfolios with the lowest possible drawdown — exactly 0, which means it won’t trade at all!
Learn the quirks of the optimization process. Look at different generated portfolios, and see if they match your goals. Try different fitness functions, and learn how the optimization process leads to different end results. Speak the language of the optimizer.
This portfolio has a
really low average
drawdown, so it worked
right? (wrong)
Step 3) Experiment with more advanced features
After you have a good feel on how the different configuration options (often called hyperparameters) affect the portfolio, you’re ready to start using some of the more advanced options!
By default, the optimization process is unbounded; a particular parameter can be anything at the end. But, if we had a specific strategy (like a stop loss), we often want the result to be similar to original portfolio. At the very least, we want our “stop loss strategy” to still be a stop loss strategy at the end.
We can do this by updating our strategy in the UI and clicking “Advanced Options”.
Advanced strategy
configuration
options
Step 4) Master the technique and re-run your optimizations
As time moves forward, the best set of parameters for your portfolio are going to change too! By relying on an automated approach, we can continue to evolve our portfolio with the turbulence and ever-changing nature of the stock market
The Drawbacks of Genetic Algorithms in Trading Strategy Optimization
While genetic algorithms offer powerful optimization capabilities for trading strategies, they come with several important drawbacks that traders should consider:
- Overfitting: Genetic algorithms can easily lead to strategies that are overly tailored to past data. These overfitted strategies may perform exceptionally well in backtests but often fail when applied to live markets with new, unseen data.
- Computationally expensive: Running genetic optimizations can be extremely resource-intensive, especially for complex strategies or large datasets. This can result in long processing times and high computational costs, potentially limiting the frequency of strategy updates.
- Over-reliance: There’s a risk of becoming too dependent on automated optimization, potentially neglecting human intuition and market understanding. This over-reliance can lead to a false sense of security and may result in strategies that work well in theory but lack real-world robustness.
In summary, while genetic algorithms can be a powerful tool for strategy optimization, they are not without significant drawbacks. Traders must be aware of the risks of overfitting, the computational demands, and the danger of over-relying on automated processes. Successful use of genetic algorithms in trading requires a balanced approach that combines algorithmic optimization with human insight and continuous critical evaluation.
Concluding Thoughts
Improving your existing trading strategy doesn’t have to be laborious, boring, and time-consuming. Just as deep learning practitioners use genetic algorithms to find the best hyperparameters for their AI models, we can use genetic optimization to improve our trading strategies.
The genetic optimization tools in NexusTrade can explore more parameter combinations than manual tweaking. Judge the locked result on data that did not guide those choices. If the later result leads you to revise the candidate or search settings, that period has become part of development; the revised candidate needs another untouched evaluation.
Before each search, write down the seed rule, the search period, the parameters allowed to change and the later period reserved for evaluation. After selection, freeze the complete rules and test them once on that later period. Record failed variants as well as the selected one, then monitor new decisions without rewriting that test history.
···Thank you for reading! If you’re interested in algorithmic trading and AI subscribe to Aurora’s Insights! Want to see how useful genetic algorithms are in practice? Create an account on NexusTrade today!
NexusTrade — AI-Powered Algorithmic Trading Platform
By far the best algorithmic trading experience. Learn to conquer the markets by deploying algorithmic trading…
nexustrade.io
No comments yet.