How do you know that your trading strategy really works?
If it took you more than 2 seconds to answer this question, read on.
When you start trading a new strategy, this question can be challenging to answer. You might have trading rules but because you’re not sure about your edge, your confidence in the strategy will last until you get your first couple of losers.
All of a sudden, you question everything.
Did this really work to begin with? What if I was just lucky?
Let’s fix this.
The Game Plan
In this article, I’ll give you a 3-step game plan that will get you from a trading hypothesis to an actual trading strategy with a verifiable edge. From idea to execution.
One of the core concepts will be backtesting, as this is the process that will help you verify your trading strategy. But let’s start at the beginning. The first step is just an idea of what you think might work: the hypothesis.
Step 1: the Trading Hypothesis
Every trading system should start with a basic hypothesis of what can give you an edge in the market. Usually, you come up with this after observing the market for a longer time and seeing that if certain conditions align, there’s a bigger likelihood of something happening.
In this step, it’s not too important yet to fill in all the details. However, it is very important to think about the “why” of your hypothesis. Why does this work in the first place? Think about the market participants, their sentiments and why it makes sense that there is a bigger chance for something specific to happen. After all, if you can’t explain to yourself why something works, why do you think it has an edge at all?
In their rough form, these hypotheses can be very basic. Some examples might be:
- If the price suddenly moves away strongly from the mean value, fading 50% of the move seems to work well
- If we have an established trend and a retracement happens on that trend, that is a good spot to enter in the direction of a trend.
- When a head and shoulders pattern occurs after a long trend, we can trade the measured move once the neckline of the H&S breaks
- If a Monday morning gap is bigger than 30 pips, trading in the direction of the Friday close (thus covering the gap) seems to work well.
- When a trend reverses and we combine this with strong momentum, it’s a good time to trade the reversal
Step 2: The Rules
The next step is one of the most important in this whole process. It’s where you take the hypothesis and dissect everything into objective rules. What you want to accomplish is to create a set of rules that, if given to someone else, could be traded by that person without any additional knowledge and it would result in the same decision making as if you traded it.
Let’s explain with an example.
Example: Rules For Trend Retracement
First, let’s make something clear: this is just a hypothetical example and in no way an actual working strategy. However, it does contain concepts that have been proven to work and it might provide you with some inspiration on how to create a set of rules for your own strategy.
It also shows how you need to think about every aspect of your initial hypothesis to come up with objective rules. Let’s take the following hypothesis as an example:
If we have an established trend and a retracement happens on that trend, that is a good spot to enter in the direction of a trend.
While this is a good (and potentially valid) hypothesis, there are a number of unknowns. First, we need to define the big 3 topics in that hypothesis:
- How do you define an established trend
- How does this retracement look like
- When exactly would you enter
Let’s have a look.
An established trend could be defined by a number of things. Maybe you have 3 moving averages and after they all line up, you are in a trend? Maybe you prefer to work with channels only and define an established trend as a channel with at least two touches on both sides of the channel? Or maybe you prefer to use classical charting techniques and look for higher highs and higher lows?
Whatever you choose, pick something that is easy to explain and should give you more or less the same results every time.
Retracement is the second unknown. How do you spot a retracement? Are you looking for multi-candlestick patterns? Does the price need to go to at least the 50% Fibonacci retracement of the last leg of that trend? How steep should the retracement be? How many candles do you expect a retracement to be? Do you want to see specific chart patterns that result in retracements that work out better? Do you want the retracement to reach the 50 moving average or the outer Bollinger band?
In this example, we have an established trend, followed by a bull flag retracement. There’s a channel where we had at least two touches on both sides and then a break-out. The low of the retracement is between the 38.2% and 50% Fibonacci retracement levels, which might be another requirement for your retracement.
Again, make sure that you pick a definition that is as objective as possible. Once you start backtesting your strategy, you don’t want to constantly ask yourself whether this is a valid retracement or not. The ways to define a retracement that I listed here are just an example. You can define a retracement in a number of ways and none are good or bad, just pick what makes sense to you.
When To Enter
Finally, you need to decide when to enter. If you plan to enter on retracements, do you look for bear and bull flags and only enter on a flag breakout? How does this breakout look like, do you want at least a breakout that is half of the size of the flag? Do you take momentum into account and require the current ATR value to be twice the last ATR value? Do you need a pin bar or engulfing bar to confirm that the trend continues in the right direction?
Aside from the above items, you’ll need to think about at least the following topics as well:
- Where do you put your stop loss? Below the low of the retracement? Under the breakout candle?
- How do you define your profit target(s)? Do you look for supply and demand areas? Fibonacci extension levels?
- What does your trade management look like? Set and forget? Trail stops? Move stop to break even after 1R profits?
- What does your risk management look like? How much risk per trade? Do you reduce position size in some cases?
- Which pairs do you trade? Do you just trade EURUSD and USDJPY? Do you look at 30 different currency pairs?
- Which timeframes do you trade? Do you only trade 4H setups?
- Which trading sessions do you trade? Do you live in London and trade the London and part of the NY session? Do you focus on the Asian session?
Essentially, you are creating a lot of what should be part of a trading plan. In this sense, it’s very useful to think about these things for a while, since they will form the core of your trading. Once you have this, you can start building on this to create a full trading plan but for the purposes of backtesting, this will do.
Intermezzo: Backtesting Software
In theory, you can backtest using any kind of charting platform. You just scroll back until the moment you want to backtest and start stepping forward, candle by candle. After every candle, you apply your trading strategy rules and write down the potential entry, stop loss and profit target for every trade you intend to trade. Then, you continue stepping forward and write down your performance.
Even though this can be a very good exercise in charting and manually testing your strategy, it can become a cumbersome and very long process. There are easier solutions and I want to highlight two of them:
ForexTester is a dedicated backtesting application with an interface that is very close to what MetaTrader 4 offers. It’s easy to use, comes with years of history across many pairs and makes backtesting about as easy as it gets.
You can set an initial deposit and the software keeps track of all the trades you make. It’s easy to change your lot size, implement a trailing stop or partially close a position. As far as manual backtesting goes, ForexTester 3 is pretty much the best you can find. I’ve been using it for backtesting all of the strategies I trade.
TradingView’s Replay Mode
A free alternative to ForexTester is TradingView’s replay mode. Recently, TradingView has added a bar replay mode, which allows you to go back to an arbitrary point in time and replay the candles as if they were real-time.
Together with the position tool, you can simulate taking trades on historical data and even though you need to manually keep track of the trades you take, it’s still a relatively easy and solid solution to backtesting. Best of all, TradingView is free to use!
Whatever you choose, just pick one and stick with it for a while and get used to the interface and the way it works. There’s not one best solution and your focus should be on executing your trading strategy as good as you can in the backtest software of your choice.
Step 3: The Actual Backtesting
Now that we have thought about and written down all of the rules and have our backtesting software, we can start the backtesting. You know which pairs and timeframes you want to trade, you know your entry criteria and how you manage your trades. Now you need to test the assumptions and see if they provide you with an edge.
However, before you get started, there are a number of things you should keep in mind.
1. Sample Size
Whatever strategy you test, you need to make sure that your sample size is big enough. If you only have 10 trades, the results you have might just as well be down to luck instead of an actual edge. Try to backtest for at least 50 to 100 trades in order to get a representative sample that can give you an indication whether you have an edge or not.
Additionally, you should test different market conditions. If you trade the 5-minute charts and manage to have 70 trades in one month, do the same in a different year and see if you can still get similar results. Depending on the market climate, your strategy might keep working well or break down under certain conditions. Similarly, if you trade a daily strategy, try to cover many years, potentially going back as far as 2000 or 2008 to see how your strategy would’ve performed during some of the most extreme market conditions.
2. Curve Fitting
It’s tempting to backtest a specific time period (let’s say from January 2016 to January 2017), see that something isn’t working, change a few parameters and then test that same time period again. Doing this over and over again will result in a curve-fitted or overfitted strategy: a strategy that performs extremely well given very specific market conditions, but potentially breaks down in other situations.
If you then backtest that strategy during a different time period, you might often find that it completely fails and your supposed edge is gone. Your strategy has been tailored to one specific market environment. Instead, you should observe and test in one period, potentially make adjustments to your strategy rules and then test on a different period (the so-called out-of-sample period). This will reduce curve fitting to a minimum and make your trading strategy more robust.
3. Important Metrics
You might think that the P/L is the most important metric but it’s absolutely not. How about the win rate? What’s your average reward to risk ratio? Sharpe ratio? How often does your system give you a signal? Does it perform better during specific time periods? What is the average drawdown like? How about the maximum drawdown during the period you tested?
This is what you need to focus on to get a well-rounded system with a low drawdown and a high Sharpe ratio and expectancy.
Backtesting Your Strategy
Basically, this is the easiest but potentially also the most time-consuming step. You start by choosing a time period and then move candle by candle while executing your trading strategy rules. Above everything else: don’t change the rules mid-test! If you start changing rules, there’s no use in backtesting since we don’t get a consistent result that you would be able to replicate.
It’s better to finish one test and see that it wasn’t profitable than to constantly change the rules. At least then you know it isn’t working and you can update the rules to have a potentially better working system.
During this step, your backtesting software will potentially take care of the trade data. However, it’s also useful to manually keep track of the following things:
1. Comments and emotions per trade
These remarks will show you if you doubt when entering a trade. What makes you doubt? Are you afraid to keep a position open? Why is that? Writing down your comments per trade will allow you to start seeing patterns in your trading and this will very likely result in insights that you wouldn’t have gotten if you just traded without these notes.
If you trade multiple types of setups (e.g. double tops and head and shoulders), the comments are also a place to keep track of which setup it is. This way, you can discover that one setup might work much better than the others and you should focus on that setup only.
2. Screenshot before and after entering
Keeping chart screenshots is an invaluable way to develop pattern recognition skills. It’s a fast way for you to collect your best trades and worst trades and see what they have in common. What works and what doesn’t? A visual way of keeping track of this will make it much easier to improve as a trader.
3. MAE and MFE
The MAE (maximum adverse excursion) and MFE (maximum favorable excursion) are two metrics that help you fine-tune stop loss and take profit targets. MAE keeps track of how far your trade went into a loss before turning around as a winner and MFE keeps track of how far your trade went into profit before turning around as a loss.
If for 90% of your trades, the MAE is about half of your actual stop loss, that is a sign that you could potentially tighten your stop loss, which would result in an improved R:R ratio on your trades. And if your MFE is two thirds of your take profit target, it might indicate that your profit target is consistently a bit too wide and you should go for more realistic targets.
After the backtesting, it’s time to study the results. If multiple backtests are profitable, it should give you a lot of confidence to start trading this strategy live. If they’re not, you need to find out what worked well and what didn’t. The metrics you collected during the backtest sessions can help with that. Often, the core idea of a strategy is valid, but the detail need some fine-tuning in order to make it work well.
To summarize, you need to do three things in order to find a valid trading strategy:
1. Find a hypothesis
2. Convert it to a rules-based strategy
3. Backtest it
Is something missing from this article? Do you still have questions? Let me know in the comments or get in touch!