Trouble with EA finding ZigZag value on bar [1]...

 

Hey gang, I'm running into a puzzling issue with this EA. Any help would be very appreciated!

I'm not sure exactly what information will be most helpful, so I'll try to give enough info without giving too much. Let me know if you want to see any other bits of the code, or have it explained further.

At its essence the issue I'm having is that, when a ZigZag point is created on bar [1], my EA seems to not see that the value has been created.

The For loop is set to break when Low/High[i] == ZigZag[i].

My indicator data window shows that the data point IS present on my chart, but my journal says not so in the EA??? Both of these screenshots are taken at the same exact moment, paused in my Strategy Tester just after the problematic bar has closed.

I'm pretty confounded, so any pointers for what else I might test, or what might be the problem would be much appreciated.

Thanks in advance!

Here's the function that's generating the issue:

bool CheckEMA(int type)
{
   double emaFast = iMA(Symbol(), Period(), entryEMAPer, 0, 1, 0, 1);
   double zigLowVal = 0;
   double zigHighVal = 0;
   
   if(type == OP_BUY)
   {
      for(int i = 0; i < Bars; i++) 
      {
         zigLowVal = iCustom(Symbol(), Period(), "ZigZag_R_", entryExtDepth, entryExtDeviation, entryExtBackstep, 0, i);
         Print("i:" + i + " zigLowVal: " + zigLowVal + " Low: " + Low[i]);
         
         if(zigLowVal == Low[i])
         {
            break;
         }
      }
   }
   
   if(type == OP_SELL)
   {
      for(int i = 0; i < Bars; i++) 
      {
         zigHighVal = iCustom(Symbol(), Period(), "ZigZag_R_", entryExtDepth, entryExtDeviation, entryExtBackstep, 0, i);
         Print("i:" + i + " zigHighVal: " + zigHighVal + " High: " + High[i]);
         
         if(zigHighVal == High[i])
         {
            break;
         }
      }
   }
   
   if(type == OP_BUY) 
      return zigLowVal >= emaFast;
   if(type == OP_SELL) 
      return zigHighVal <= emaFast;
   
   return(false);
}


Data Window

EA Journal