Download MetaTrader 5

IndicatorCounted and Limit

To add comments, please log in or register
fly7680
698
fly7680  
Hello, I do not know if the number of candles on the Limit variable is the number of candles on the chart or is there a different 
count. 

    {      int limit;      int counted_bars=IndicatorCounted();   //---- check for possible errors      if(counted_bars<0) return(-1);   //---- the last counted bar will be recounted      if(counted_bars>0) counted_bars--;      limit=Bars-counted_bars;   //---- main loop      for(int i=0; i<limit; i++)        {         //---- ma_shift set to 0 because SetIndexShift called abowe         ExtBlueBuffer[i]=iMA(NULL,0,JawsPeriod,0,MODE_SMMA,PRICE_MEDIAN,i);         ExtRedBuffer[i]=iMA(NULL,0,TeethPeriod,0,MODE_SMMA,PRICE_MEDIAN,i);         ExtLimeBuffer[i]=iMA(NULL,0,LipsPeriod,0,MODE_SMMA,PRICE_MEDIAN,i);        }   //---- done      return(0);     }
whroeder1
16574
whroeder1  
fly7680candles on the chart or is there a different count.
  1. Both. The first time it is (as you coded it) Bars. Subsequently it is just 1 (i.e. recalculate bar zero.)
  2. No need for the decrement. Contradictory information on IndicatorCounted() - MQL4 forum
  3. Start using the new routines.
  4. Do your lookbacks correctly.
To add comments, please log in or register