MT5 Strategy Tester the non-visual mode, custom indicator different results

 

Hi everyone,

I have a basic EA which I am using for backtesting indicators (or systems of indicators) for their effectiveness. I have run into an issue where the same indicator with exactly the same settings (input parameters) is giving me different results.

A) When I backtest the EA with the "visual mode" ticked, the indicator calculated values are correct and they are equal to what I can see on a regular chart.

B) When I backtest it in the "non-visual" mode, the indicator values are different (significantly).

For comparison reasons, I have done a similar test with the built-in iMA indicator - it worked fine, as expected. So can it be an issue with the custom indicator code? Indicator code: https://www.mql5.com/en/code/21429

For debugging purposes I have printed out values for several dates/bars (visual vs non-visual mode), please see the screenshot below (1, attached).

The way I access the custom indicator in the EA:

1) init the indicator handle; 2) on every tick, check for a new bar; 3) copy the indicator buffer into a variable array, use the array as time series in the further code.

I have read that the Strategy Tester calculates indicator values before OnTick() is called, but I don't know what & where else I could check & how to debug it. Any ideas are much appreciated.

"In the real-time  mode, the indicator values are calculated at every tick. The Strategy Tester adopted a cost-effective model for calculating indicators - indicators are recalculated only immediately before the running of the EA. It means that the recalculation of the indicators is done before the call of the OnTick(), OnTrade() and OnTimer() functions."

 

Additional screenshot just to show that by switching the testing mode it produces totally different results (and the root cause is the different indicator values) - (2, attached).

ASH
ASH
  • www.mql5.com
Absolute Strength Histogram trend-following indicator. There are five inputs: Period - ASO calculation period Smoothing - ASO smoothing period Mode - ASO calculation mode...
Files:
1.png  49 kb
2.png  106 kb
 

Hi Andrius,


did you find any solution for this? I am facing exactly the same issue as you are describing...


Thnx!

 
lucaskoster:

Hi Andrius,


did you find any solution for this? I am facing exactly the same issue as you are describing...


Thnx!

Hi,

Where you able to find any solution for this problem? 

 

hummm...

the question is: optimization, does it work as a non-visual backtest?

if yes...

if the visual mode reflects reality more and non-visual one reflects less...

how reliable is an optimization?

 

I face the same problem that Andrius mentioned.

Any update from someone?

 
Same here, Any upadte ?
 
@Sergey Golubev any idea?
 
Facing the same issue - custom EA built with FxDreema for MT5, based on triangular correlation / arbitrage, testing based on real ticks from TickStory (Dukascopy) - the results in Visual mode match the non-visual mode with "No delay, ideal execution", showing significant profits. But if I change the latency to any value, I get the same lossing result in non-visual, and with big latency (200 ms) in visual mode I get again the profitable results.

In conclusion looks like non-visual mode with any latency is distorting drastically the test result.

Besides this major glitch, same question of how accurate is the optimisation arises.. 

Did anyone figure this issue out?
Reason: