View Single Post
  #10 (permalink)  
Old 03-01-2008, 09:35 AM
fxbs fxbs is offline
Senior Member
 
Join Date: Jan 2007
Location: not so remote
Posts: 1,810
fxbs is on a distinguished road
Thank you, Michel!
well, i did as you sayed -
PHP Code:
//---- signal line counted in the 2-nd buffer
   
for(i=0i<limiti++)
   {
    if(
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>0counted_bars--;
   
limit=Bars-counted_bars;
//  limit = MathMin(limit, MaxBarsToCount);
//---- macd counted in the 1-st buffer
   
for(int i=0i<limiti++)
  {
if(
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=0i<limiti++)
   {
if(
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

Last edited by fxbs; 03-02-2008 at 01:33 AM.
Reply With Quote