View Single Post
  #2 (permalink)  
Old 02-28-2008, 02:59 AM
fxbs fxbs is offline
Senior Member
 
Join Date: Jan 2007
Location: not so remote
Posts: 1,957
fxbs is on a distinguished road
thank you everybody who helped!
here it is:

when we have no arrays - works basic formula:

limit = MathMin(limit, MaxBarsToCount);

but when we have 4ex. MAonArray - we need more bars (MA period) to count first MaonArray bar:
MaxBarsToCount + MA period

macd limit test3.gif

so, two ways possible- count more or draw less:

- draw MaxBarsToCount but count more
limit = MathMin(limit, MaxBarsToCount)+ MA period

- or count the same but draw less
SetIndexDrawBegin(i,Bars-MaxBarsToCount+MA period);

_____


in all cases SetIndexDrawBegin in "int start()" not at "init()" section

for (i=0;i<indicator_buffers;i++) SetIndexDrawBegin(i,Bars-MaxBarsToCount + MA period);
return(0);
}
Attached Files
File Type: mq4 MACD_limit_test1.mq4 (3.0 KB, 2 views)
File Type: mq4 MACD_limit_test2a.mq4 (2.6 KB, 2 views)
File Type: mq4 MACD_limit_test2b.mq4 (2.6 KB, 2 views)
Reply With Quote