View Single Post
  #8 (permalink)  
Old 03-01-2008, 06:53 AM
fxbs fxbs is offline
Senior Member
 
Join Date: Jan 2007
Location: not so remote
Posts: 1,802
fxbs is on a distinguished road
Hey, Michel!
how to use this line:
if(i > MaxBars) continue;
i tryed - no go...

but if put like this:
if(i < MaxBarsToCount)
- works (MACD):

PHP Code:
int start()
  {
   
int limit;
   
int counted_bars=IndicatorCounted();
//---- last counted bar will be recounted
   
if(counted_bars>0counted_bars--;
   
limit=Bars-counted_bars;

//---- macd counted in the 1-st buffer
   
for(int i=0i<limiti++)
   if(
MaxBarsToCount)
   
      
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=0i<limiti++)
      if(
MaxBarsToCount-SignalSMA

      
SignalBuffer[i]=iMAOnArray(MacdBuffer,Bars,SignalSMA,0,MODE_SMA,i);
//---- done
   
return(0); 
Reply With Quote