I’ve received a handful of emails from readers with questions about the reliability of data used in backtesting and the actual process of backtesting in MT4.  I have a feeling that this will disappoint some readers, but I tend to keep it as simple as possible.  The data that I am using for backtesting is data that I have collected from my forex broker over the past 18 months of real money trading.  It’s about as clean as I could hope for;  I know that it represents real dealing prices, because I lived through every bar of it.  In general, I am the wrong person to ask about data issues!

If I have a set of entry and exit criteria that I would like to test, I first code these criteria as indicators before putting them into a Metatrader Expert Advisor (EA).  Then I put this code into an EA, making sure to draw arrows on the chart each time a trade is entered, a trade is exited, or a trailing stop is modified.  I then run the backtest, and visually inspect all the trades on the chart to ensure that the system is entering and exiting where I would expect it to…this is easy to see, given that I’ve already coded the entry and exit criteria as visual indicators. 

As for tick modeling in the current bar, I completely sidestep the issue by constructing entry and exit signals that look only at opening and closing prices of the previous bar;  there is no need for me to model the intrabar movement of the current bar.  Additionally, I exit all trades on Friday afternoon, so there is no possibility of a weekend gap that isn’t properly accounted for in the backtest.  It is very likely that I am sacrificing some profitability by making these choices, but what it allows me to do is build a system that has a high realism factor, that is, it behaves very much in a walk forward test like it has in the backtest.  Data “glitches” can and do occur, and I’d hate to be making decisions based off the high or low price of a bar that hasn’t yet closed;  it would be too easy to generate a false signal this way.

 What about the limitations of Metatrader?  There are certain systems that would be difficult to code using it…if I have a concept that I believe will work and I’m having a hard time converting it to MT code, I keep reducing it to a simpler heuristic that I CAN code in Metatrader…again, erring on the side of simplicity rather than complexity.  What I want to see is that the relatively simple system that relies on the previous bars’ opening and closing prices only will work…if that’s true, I can spend time wringing the optimal profitability from the system if I so choose by “bringing the action forward” to the current bar…so far, I’ve found that the risk and additional complexity of such a step not worth the potential reward.