In the previous article, we discussed the fundamentals of algorithmic trading, highlighting the importance of the backtesting of any trading strategy.
The wonky term “backtesting” refers to actually checking trading systems effectiveness based on historical data to see how they would have worked over the prior time period. In other words, when you get the virtual result of a trading strategy in the past is, in fact, the process of trading strategy backtesting.
Backtesting can be applied to any trading strategy or model. You should have enough historical data (e.g. closing prices for a certain period of time) and mathematically described set of rules for trading strategy. When an analyst creates an investment model and tests it on historical data, we can also consider it as a backtesting example.
Most modern trading platforms support backtesting option, so that you can quickly analyse some ideas without risking your money. The only challenge is to find the right backtesting software platform as there’s lot of scam over the internet linked to trading software.
Did you know that Fintatech trading platform solution goes with a backtesting module as well? If you’re considering starting a brokerage, our scalable highly functional platform skeleton will become your competitive edge. Our team will eagerly provide you with the details, just contact us at firstname.lastname@example.org
To run testing on historical data you’d need to have your trading system in the form of program code. If you are not familiar with programming logic and syntaxes, you can find a programmer who could integrate the source data into the trading platform.
Still, it makes you wonder why don’t traders who aware of trading strategy backtesting strike it rich? Does backtesting work at all?
Some Pitfalls in Trading Strategy Backtesting
Yes, backtesting works. However, it happens quite a lot that a model yields amazingly good results during backtesting but it fails to repeat them in real trading sessions. This may be the case when info a trading strategy was tested on is not actual anymore e.g. market volatility has changed.
You can right the ship though by optimizing the system, i.e. fitting its parameters to the current market conditions.
Another possible reason for the strategy failure in real trading is slippage associated with high competition as well as drop in liquidy which is difficult or impossible to address.
In addition, technical issues can lead to a drop in the speed of market orders execution, quality deterioration, and other failures. Therefore, while analyzing backtesting results one should adjust such unpredictable events.
It’s also believed and mathematically justified, that the longer time period for strategy testing, the greater the likelihood strategy results are valid in future trading. This is because the strategy that’s being tested over a small time range can be adapted to random conditions that are not typical for this market. Long testing time periods, in turn, let trading strategy to adapt to general conditions that may occur in the future as well.
Factors Leading to Successful System Backtesting
It would be a truly utopian world if you reached a flawless system that would work out in any market and with any tool. Yet, you should focus on 3 main criteria in order to achieve a more prudent approach in the trading system (TS) backtesting.
- Optimization criterion;
- TS “survival” criterion;
- Psychological criterion.
Now let’s go over the list.
This is probably the most trickish aspect that can be divided into:
- yield curve fitting
- yield curve estimate
The yield curve may contain some weak spots along with positive performance. To improve the system’s effectiveness as well as to reduce the time and level of drawdown, traders use various additional tools and parameters that, in theory, could make the curve fitted.
Experience has proven that it’s not the most optimal solution since parameter increment can only make your trading system overcomplicated with the performance remained the same if not become worse.
Yield curve estimation has also some misconceptions.
Most starters hunt for those investment ideas and strategies that could bring them the highest level of yield. Wrong. “Smoothness” of the curve in the past and maximum drawdown indicators is what really matters
TS “Survival” Criterion
By far not every successful strategy is gonna show positive dynamics for years.
To fully explore TS, you should give it a “run” through all market phases along with all possible periods.
If the system shows a smooth curve without large drawdowns even under crisis and high volatility periods, then such a system can be applied with greater confidence.
One should keep in mind that there is no perfect TS. It may have some drawdowns but once it passed all phases, it’s trusted to be used during real trading. Therefore, first test the following phases:
- High volatility phases
- Low volatility phases with a long consolidation period
- Periods with “Black Swan” events ( Brexit, Swiss franc untying, etc.)
This is a kind of a trading strategy crush-test. It helps to learn deeper the behavior of TS under different circumstances and to find out its good’s & bad’s.
Even though psychology is often needed for discretional methods, it also means a lot in the algorithmic environment.
Let’s imagine you have at hand the performance of TS of over 6 years. You see where maximum drawdown happened, how long it lasted as well as the periods that brought the best results.
But when you face the problems with the trading system in real time and with real money the pattern is completely different. It’s necessary to create a particular set of rules for you to know which step to take if the TS has exceeded the backtested drawdown in real time. Thus, you’d have a tip-off for any unforeseen situation with psychological criterion minimized.
How to Backtest Your Trading Strategy
So, what can make trading strategy backtesting really effective? What are the key points to remember when backtesting? Let’s check out this short guide.
- Use a large sample of historical data for proper backtesting
The longer period of historical time is, the more valid strategy results are, remember?
Use at least one year of historical data and don’t forget to test it on several markets as well.
- Test your strategy in various market conditions
You’re already aware of the ever-changing market and how it can affect the curve. Test your strategy in all phases including trending and corrective ones.
- Record your results, both bad and good ones
It’s not a great discovery that trading is full of sudden turns that can lead both to winning or losing outcomes. Still, there’s a cheer-up tip for you: successful traders don’t lose, they either win or learn.
Keeping records on strategy results while back-testing gives chance to analyze its weaknesses and strengths, therefore, to improve your skills.
- Keep an eye at your strategy performance metrics
To tell whether you made a profit or loss your strategy must be back-tested on a large amount of historical price action, however, there are other important metrics you should pay attention to:
- What’s your win\loss mid-coefficient?
- What’s your risk VS reward mid-coefficient?
- What’s the highest number of winning trades in a row?
- Did you note a drawdown? How long did it last?
- Review your strategy thoroughly. Maybe it needs to be modified or wiped out
Accept all your strategy results. It wouldn’t do any harm to tweak it a bit or give it up and start with a clean slate. But remember! To avoid noisy results tweak your strategy BEFORE back-testing again.
- Keep to the rules of your strategy
Quite a common misstep that traders make is changing their strategy rules or overcomplicating them during backtesting thinking it can boost their performance.
- Always test your strategy on a simulated account first
Once you gave your strategy the green light, the next move will be to test it in the real-rime. But before trading with real money, try first with the simulated account. Take your time to prove the profitability of trading strategy without any risk.
Sometimes to achieve consistency traders develop, backtest and trade strategy in a simulated account for months or even years before real sessions with real capital.
So, to recap, the whole process of backtesting is a significant step for those traders who aim to develop their own strategy.
Every little detail requires increased attention on the backtesting stage as most mistakes could occur just because of the details neglecting. This, in turn, can lead to losses.
Summarizing all the above, there are several bullet points to bear in mind:
- Test your trading system in all market phases. The longer the time period the better for the results;
- Choose smooth growth curves;
- Do not overcomplicate your TS. Remember, a smaller set of parameters is a key to success;
- Create a check-list that will be your life-saver under unexpected circumstances.
Remember that backtesting results and real trading results can be chalk and cheese. But without backtesting, you won’t be able to analyze the profitability of your ideas before real play.
Although the whole backtesting idea is quite disputable among traders, if handled properly it can help in evaluating thoroughly trading system. Sure thing, one cannot fully rely on backtesting results since it’s only a part of the evaluation process.
Much talks about backtesting and forward testing (aka paper testing) comparison, but we will get back to this topic in the next article.
We hope that this overview on how to backtest a trading strategy has shed some light on the subject and you came up with the decision whether it is for you or not.