Possible Bug in MT-4 Strategy Tester

 

It appears that the embedded OrdersTotal() function is not working in Indicator codes when using the Strategy Tester. OrdersTotal() calls in Expert Advisor codes return correct values, but in Indicator codes only returns 0 when there are open orders.

MT-4 build 226

To demonstrate this possible bug, I added this comment() call to the int Start() section in the Moving Averages Indicator code.

int start()
  {
   Comment("OrdersTotal ",OrdersTotal());  // ADDED FOR TEST PURPOSE
   if(Bars<=MA_Period) return(0);
   ExtCountedBars=IndicatorCounted();
//---- check for possible errors
   if (ExtCountedBars<0) return(-1);
//---- last counted bar will be recounted
   if (ExtCountedBars>0) ExtCountedBars--;
//----
   switch(MA_Method)
     {
      case 0 : sma();  break;
      case 1 : ema();  break;
      case 2 : smma(); break;
      case 3 : lwma();
     }
//---- done
   return(0);
  }

Attached is screen shot of visual mode run in Strategy Tester using a EA with no Comment() call and this indicator with Comment("OrdersTotal ",OrdersTotal()); call added to code.

 

So Phy and others....

What is the story with this bug,

Essentially this downs my ability to work on EA's during non market hours or debug enhancements in strategy tester.

No data is being placed into any of the Order*() functions.

I also believe that this bug has been introduced in 226 as I odn't recall having these issues prior to moving and I resisted staying on 225 for a year.

I am currently on build 229.

Checked build 225 and no Order*() functions contain any Strategy Tester data.

I can partially understand this since the assumption is that the STester is running during market hours. However since it is indexed by Unique magic numbers and ticket numbers starting with 1, there should not be any conflicts.

Reason: