← All Articles
NEVER use a backtest to improve your strategy idea
Austin Starks
Austin Starks
  ∙  
6 min read
  ∙  
View on Medium

Stop wasting your time with backtests! Do this instead…

NEVER use a backtest to improve your strategy idea

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 optimizationThe 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.io
Preview image

How 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.io
Preview image

Using a Genetic Algorithm as a Replacement for Manual Backtests

Genetic algorithms are the better way of improving your strategy’s parameters.

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.io
Preview image

I’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.io
Preview image

Step 2) Launch a genetic optimization. Iterate, and improve.

A genetic optimization with NexusTradeA 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)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 optionsAdvanced 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.

With genetic optimization tools like those offered by NexusTrade, traders can systematically improve their strategies without falling into the traps of manual backtesting. This approach not only saves time but also leads to more robust and adaptable trading strategies. By leveraging genetic algorithms, you can explore a vast parameter space efficiently, uncovering optimal configurations that you might never have considered through manual tweaking.

As you become more comfortable with genetic optimization, you can start to incorporate it into your regular trading routine. Consider running optimizations periodically to ensure your strategies remain effective in changing market conditions. Remember, the goal isn’t to find a “perfect” strategy that works forever, but rather to develop a systematic process for continually adapting and improving your trading approach. By embracing this powerful tool, you can stay ahead of the curve and potentially achieve better long-term trading results.

···

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
Preview image

Discussion

Sign in or create a free account to join the discussion.

No comments yet.