Thank you, Michel!
well, i did as you sayed -
PHP Code:
//---- signal line counted in the 2-nd buffer
for(i=0; i<limit; i++)
{
if(i > MaxBarsToCount) continue;
SignalBuffer[i]=iMAOnArray(NULL,0,FastEMA,0,MODE blabla ;
blahblahblah...;
}
//---- done
works good but when onArray - old story - steping on tail
(maybe should have use more braskets: )
macd maxbars limit.gif
well, 4 onArray buffer :
if(i > MaxBarsToCount - SignalSMA) continue;
and that's it! : ))))))))
PHP Code:
int start()
{
int limit;
int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
// limit = MathMin(limit, MaxBarsToCount);
//---- macd counted in the 1-st buffer
for(int i=0; i<limit; i++)
{
if(i > MaxBarsToCount) continue;
MacdBuffer[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i)-
iMA(NULL,0,SlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
}
//---- signal line counted in the 2-nd buffer
for(i=0; i<limit; i++)
{
if(i > MaxBarsToCount - SignalSMA) continue;
SignalBuffer[i]=iMAOnArray(MacdBuffer,Bars,SignalSMA,0,MODE_SMA,i);
}
//---- done
return(0);
}
thaks, Michel, - we still have our limit (no counted bars recount) -
clean solution too