Timeseries functions don't work properly with "Every tick based on real ticks"

 

Hi,

The functions CExpertBase::Low(), CExpertBase::High() and others are returning their corresponding values from wrong bars when using "Every tick based on real ticks". When I use "Every tick" it works PERFECTLY. Can anyone help me on this issue? 

My EA is based on MQL5 Wizard and uses:

// Is enabled to detect the breaking of max/min of the previous bar
bool Expert_EveryTick = true;

My CSignal class uses:

m_used_series=USE_SERIES_OPEN+USE_SERIES_HIGH+USE_SERIES_LOW+USE_SERIES_CLOSE;

One of the conditions to go long is:

int CSignalMySignal::LongCondition() {
  // When the current price is above the maximum of the previous bar
  if(Close(0) > (High(1))) {
    return 100; // Buy!
  }
  return 0;
}

In this case, my EA should only buy when the current price goes above the maximum price from the previous bar.


As you can see in the picture above, the chart on the left side shows the correct long operation because the red bar is breaking the maximum value from the previous bar (bar 1). However, the chart on the right side doesn't go long in the red bar because High(1) returns the value from bar number 2, and Close(0) from bar 1, which is completely wrong! Only when a new bar is created then High(1) returns a value from bar 1, the Close(0) from bar 0, and it configures a long operation.

Please note this happens only when the Strategy Tester is configured to "Every tick based on real ticks" or when it runs on a real account.