跳至内容

IndicatorCounted

IndicatorCounted

该函数返回上次启动指标后未发生变化的条形图数量。

int  IndicatorCounted();

返回值

上次启动指标后未发生变化的条形图数量。

注意

大多数计算过的条形图不需要重新计算。在大多数情况下,相同数量的指标值不需要重新计算。该函数用于优化计算过程。

示例:

int start()
    {
     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);
    }

另请参阅

自定义指标属性, 对时间序列和指标的访问

最后更新于