Last updated on March 18, 2021 by Mark Fric
Reliable backtesting in JForex
JForex is the most recent backtesting engine addition to StrategyQuant, and there are some caveats when using it:
Backtesting precision usage
JForex backtester works almost as same as MetaTrader backtester, but with one very important difference – in JForex backtest SL/PT is filled at the price of the tick that triggered it, while in MetaTrader they are filled at the set SL/PT price level.
This is very important difference and it negatively affects the reliability of JForex backtests with lower precision.
You have long trade with SL(Stop Loss) set at 1.2000. Order is live and now a new tick 1.1000 arrives. It is below SL so it triggers Stop Loss.
In MetaTrader backtest the order will be closed at 1.2000, which was the Stop Loss price level.
In JForex it will be filled at 1.1000, which is the tick price.
To demonstrate the difference this makes look at the picture below:
It is a test of the same strategy (EMACross with SL/PT example) on both engines in different precisions.
The results of with tick precision the results are very similar – the only difference is made by SL/PT prices where for MT4 you have SL (for example 50) pips, and for JForex it is like 50.3 pips, depending on the actual tick.
The lower precision we use the bigger the difference is, because ticks are then simulated only per minute or per whole hour.
It is obvious that Selected timeframe and even M1 precisions are not really usable in JForex.
The conclusion – You have to use real tick precision to get reliable results for JForex backtester!
Generating strategies for JForex
Using real tick precision when generating strategies is not really a good approach, because it slows down the generation significantly.
There is a different option – use MetaTrader4 engine with Selected timeframe/M1 precision to generate the main batch of strategies and perform all the crosschecks etc.
Then retest the final set of strategies that passed all checks again with JForex with tick precision, to ensure they trade correctly also on JForex.
So the slow real tick backtest will happen only as the last step on the final strategies.
JForex indicators issues
There is another issue that could affect the reliability of JForex backtests. A big part of indicators in JForex are implemented little bit differently than in SQ / MetaTrader and this could cause some differences in trading.
How big the difference is really depends on the type of strategy. The only way to solve this would be to reimplement all the indicators from SQ into JForex variants, but this is a big task which is not planned for the near future.
On a positive note, there are users who successfully trade JForex strategies generated by SQ on real live acounts, so the engine is usable, you only have to be aware of its limitations and how to override them.