if ErrorDescription(GetLastError()) returns "no error"....how on EARTH can you test to solve for the error? - page 2

 

Buffer shift? - the new candle "pushes" all the previous candles up one. - I'm just geussing!

 
Ickyrus:

Buffer shift? - the new candle "pushes" all the previous candles up one. - I'm just geussing!

Well, the way I'm checking for the signal cases is as follows....

 //---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit = Bars - counted_bars;  
      
   if(limit > barsToProcess)
      limit = barsToProcess;
I am using this limit to do the following...
//--- Define Vars
   int i;
   int i1;
   int i2;  

   for(i=0; i<=limit; i++)
   {
      i1 = i+1;
      i2 = i+2;  

      EMA_200_ = iMA(symbol,0,EMA_200_Period,0,EMA_200_Type,EMA_200_Price,i);
      EMA_200_1 = iMA(symbol,0,EMA_200_Period,0,EMA_200_Type,EMA_200_Price,i1);
      EMA_200_2 = iMA(symbol,0,EMA_200_Period,0,EMA_200_Type,EMA_200_Price,i2);

      .
      .
      .

      ---- Rest of Code ----
Perhaps there is a problem getting i1 and i2 on the first trading day of the new week?
There are two days in between the first day of the week and the last day of the previous week....I don't think the arrays work that way though...they should be based on every tick...so i1 should be the most immediate tick previous to i.....right?

so how can I evaluate the case if I can't get the values of the MA at the previous two ticks?
 

Not sure I follow so commeting on first thought(s) that comes with looking at the code
-
counting up is going backward through time most recient to past.
New bar is updated from?? (MT4 buffers ticks and updates internal data chart graphics etc by time sharing between itself and EA or by using interupts - again gussing)
EA's candle or bar remains fixed for each tick processed but EA wont necessarily catch every tick as the MT4 platform should do make bar as accurate as possible.
-
Indicator is based on last three bars (gessing a bar is accumulated ticks over period)
-
avoid using the bar that is being changed with each processed tick when calculating an indicator.

Reason: