ADVFN Logo
Registration Strip Icon for discussion Register to chat with like-minded investors on our interactive forums.

Metatrader 4, Differences Between Backtesting And Papertrading or Real Trading

Share On Facebook
share on Linkedin
Print

When building an automated trading strategy (Expert Advisor) in Metatrader 4, the first step in testing to know if it stands a chance in real life will be to backtest it using the Strategy Tester. Putting aside all the difficulties in properly setting up the Strategy Tester in terms of data quality, the investor will still have to contend with several other problems.

This article will cover several differences that the investor can expect to observe when moving from his backtesting phase to papertrading his systems (using a demo account) or trading them in real life (with a real account).

 

Spreads

The spreads that Metatrader 4 considers when running a backtest are always constant. These spreads are the exact spread that’s present in the market at the time when the backtest is started. This has several consequences:

  • The spreads do not change during the backtest. In papertrading and real life the spreads do change. Indeed, the spreads can blow out during times of volatility or when economic data is released. This can have an impact which can’t be simulated in the backtest;
  • The spreads which exist when the backtest is started can vary, thus the backtest can produce different results even with the exact same parameters in the exact same historical period. It might thus be useful to backtest using a Metatrader 4 that’s been disconnected from price updates, and where the spread has been set using an appropriate utility;
  • If the backtest is started when the spread is very wide, it might appear that a profitable system is not profitable at all. This can happen if the backtest is run during late, low-liquidity hours or during the weekend. This again reinforces the need to have a “disconnected” Metatrader 4 instance available just for backtesting, where the spread was set manually.
  • Likewise, if the backtest is run when the spread is very tight, it might produce unrealistically optimistic results which won’t be produced with a more realistic spread.
  • It will be impossible to simulate during a backtest the existence of abusive, too-wide, spreads. It will also be impossible to simulate the impact of systems designed to not trade during those abusive spreads.

 

Gaps

Strategy Tester handles the weekend forex gaps erroneously. Metatrader 4 assumes that stop and limit orders will be executed at their defined prices. It also assumes that take profits and stop losses will do the same. Neither is true, if a gap happens, the prices considered will be those formed by the gap and not those in the original orders. This also has as a consequence that the maximum loss a position can produce can exceed its stop loss.

This behavior introduces a positive bias from Friday to the Sunday session, because the erroneous treatment is favorable for the Expert Advisor: it means better entries for the EA than what will take place in reality. It also means more favorable stop losses than those which will take place in reality.

The other instance which produces the same effect is the gap due to bad historical data (historical data with gaps). Since this introduces a positive bias each time there’s a gap, it’s very important to get the best historical data possible. The historical data which can be downloaded from Metaquotes is usually of poor quality in this regard.

This last problem regarding gaps will be greater when the asset in question has more gaps intrinsically. This means the problem is less present in forex, where usually the only gap occurs from Friday to Sunday. The problem will be greater in stocks and indexes, where gaps between sessions are very common.

 

Stop levels

Like with spreads, the stop level (the minimum distance at which the Expert Advisor can place take profit and stop loss orders) sometimes varies during the trading day. This cannot be simulated in backtesting, which means the impact of this on the Expert Advisor’s profitability and risk is impossible to simulate.

 

Simulated ticks

Metatrader 4 saves historical data down to 1 minute bars, with Open, High, Low, Close data. Below the 1 minute timeframe, Metatrader simulates the ticks using the volume data. The ticks are entirely simulated and might be completely different from what took place in the real market. This means the backtests will be very unreliable for Expert Advisors which are too reliant on what happens below the minute timeframe on a tick to tick basis.

Click Here to register for free on Investors Hub

This area of the investorshub.advfn.com site is for independent financial commentary. These blogs are provided by independent authors via a common carrier platform and do not represent the opinions of Investors Hub. Investors Hub does not monitor, approve, endorse or exert editorial control over these articles and does not therefore accept responsibility for or make any warranties in connection with or recommend that you or any third party rely on such information. The information available at Investors Hub is for your general information and use and is not intended to address your particular requirements. In particular, the information does not constitute any form of advice or recommendation by investorshub.advfn.com and is not intended to be relied upon by users in making (or refraining from making) any investment decisions.

Comments are closed