Download MetaTrader 5

Meta Trader 4 Tester Bugs - page 2

To add comments, please log in or register
Trade like successful traders - subscribe to their signals!
graziani
1956
graziani 2014.07.21 11:39  

Well, it is a bug.

iHigh and iLow are not working in tester in described conditions, they are giving constant and wrong values.

it is interesting that this works in b509 tester, but also with a bug: in  b509 you are getting the future values of higher TFs, values that didn't happen yet in the basic TF.

 

to expect that these demonstrated bugs will be solved any time, is illusory, so use a workaround.

to use different TFs, you can work like i am in most cases: don't mix TFs within program/indicator, but call them from main program/indicator with iCustom(....desired TF....).
then you can adjust values with iTime() and iBarShift().

imanuel
31
imanuel 2014.07.21 13:33  

Hi Graziani,

I guess I found the root cause of the MT4 backtester bug. I try to run this simple bars counter on the MT4 backtester, one for the EA and one for the Indicator. Both are run under M1 testing period, so you could expect that M1 bars is continously updated (the numbers is always increase). And the result for EA M5 bars numbers is also well updated along with M1 update (with time div 5). But surprisingly the Indicator M5 bars is just static, didn't increase and it's seems just call the static historical value. So the conclusion is MT4 EA does support MTF strategy, but all the MTF indicators will have problem of displaying on backtester.

Of course with one exception on how you calculate the MTF Indicators value, from other time frame data or from current time frame data. If from other time frame data (like iHigh, iLow, iMA, iBands, etc.) will definitely produce false result. However good news is the MTF EA will still running well as expected (with minor bugs, as you mentioned earlier). However, there will be one big problem though if your MTF EA is using the MTF Indicators, then it's seems that your EA testing result will be just a crap. May be, need some serious attention from MT4 guy? 

void OnTick() 
  {
      int M1Bars = iBars(NULL,PERIOD_M1);
      int M5Bars = iBars(NULL,PERIOD_M5);
      Print
      ("M1Bars="+IntegerToString(M1Bars)+"; M5Bars="+IntegerToString(M5Bars)+"; ");
  }

 

void OnCalculate(...)
  {
      int M1Bars = iBars(NULL,PERIOD_M1);
      int M5Bars = iBars(NULL,PERIOD_M5);
      Print
      ("M1Bars="+IntegerToString(M1Bars)+"; M5Bars="+IntegerToString(M5Bars)+"; ");
  }
Ian Venner
2584
Ian Venner 2014.07.21 14:48  

Have you read this article Testing Features and Limits in MT4

Zero bar of another timeframe for the same symbol under test is modeled approximately

Open = correct Open, Close = correct Close, Low = min (Open,Close), High = max (Open,Close), Volume = final Volume (false)

I have no idea what the reason for that is, it makes no sense but that is what it says.

whroeder1
14532
whroeder1 2014.07.21 15:00  
SDC: Zero bar of another timeframe for the same symbol under test is modeled approximately
No longer
graziani
1956
graziani 2014.07.21 16:33  

Ah, so this behaviour i reported as bug is actually expected.

However, then this 'No longer' observation is not true? Because this test i've done yesterday confirms that it is still calculated in the same way?

I agree, one cannot call this normal behaviour, as it is absurd:
If price action were a defined function, OK, i could live with introducing some uncertainty in favour of speed, but this way you are introducing error in random function which you are trying to analyse mathematically????!!!!!

This absurd approximation leads to ridiculous relationships between high/low values in different TFs which can easily trigger unwanted action.
I am sure that there is no reason for this, as i am using this kind of open prices model internally in my EAs to speed up the testing, unfortunately based on every tick slow run :(

Anyway, in 'every' tick mode, everything is correct, and one can make a reliable back test. Painfully slow, but somewhat reliable.

Ian Venner
2584
Ian Venner 2014.07.21 16:55  

If you are using this test indicator...

for(int i=0; i<rates_total && !IsStopped(); i++)
{
    PrevM5H[i] = iHigh(NULL, PERIOD_M5, 1+iBarShift(NULL,PERIOD_M5,Time[i],false));
    PrevM5L[i] = iLow(NULL, PERIOD_M5, 1+iBarShift(NULL,PERIOD_M5,Time[i],false));  
}

It is painfully slow because it is badly written. It recalculates every bar on the chart at every tick. On a one minute chart that can be hundreds of thousands or even millions of bars.



imanuel
31
imanuel 2014.07.22 06:30  

Backtesting Result 

Above is the result of bars count testing on the MT4 backtester engine (Build 670), using the code I mentioned above. This is to confirm that MT4 backtester somehow has a serious bug. It will just create false testing result, especially for all kind of EA which uses multiple time frame Indicator in their calculation. It's not limitation or inaccuracies with somehow still can be tolerated at some point, but it is an error, which I hope that some MT4 guy will fix this on the next build.

Alain Verleyen
Moderator
30752
Alain Verleyen 2014.07.31 10:44  
Bugs have to be reported to ServiceDesk.
d4v3
35
d4v3 2014.07.31 11:04  
I fail to see how it is a bug if the count of M5 bars does not increase when the clock ticks over from 33 to 34 minutes - a new M5 bar has not been started, so the count should remain the same.
12
To add comments, please log in or register