Build 670 - Indicator does not draw candles?!

 

Indicator draws histograms in chart window but it draws only about 2000 candles and then stops.

I checked code, history contains more that 20.000 bars, number of bars in chart is 50.000, 500.000 bars in history.

When I open data window I see that code correctly calculated all bars I requested, but only about 2.000 is drawn.

Any ideas?

Here is the picture. Circled is the first candle that is not drawn, but as is visible in data window, data is calculated.

There is 10.000 more candles to the left that are calculated but not drawn. In total, program got around 15000 candles (rates_total, prev_calculated was zero when indicator started)

This is MT4 build 670.

 

  

 

After playing a little I found out that magic number is 13.400

When I set limit to 13.400 then all calculated candles are drawn correctly. When I enter bigger number it starts to count backwards. For example if I request 13.500 candles, it draws 13.370

Indicator uses 19 buffers, 8 for drawing, rest for calculations. 

 

I found it.

This was my bug. Sort of.

In my code I wrote SetIndexDrawBegin(); and give him wrong index (documentation says between 0 and 7, I set 8). Also some of them were shifted to far.