The Amibroker I am using (6.30.0) seems to have a big problem with SparseCompress function.
My Aim: I am plotting intraday data (say, 5 min candles). I want to plot MA (20 periods) of Volume of only first bar of the day. So, basically, I want to grab Vol of only first bar of the day of last 20 days, then create Average of these volumes and plot.
I used this quote:
DayStarts = (DateNum() != Ref(DateNum(), -1));
V_Compressed = SparseCompress(DayStarts, V);
MA_V_Compressed = MA(V_Compressed, 20);
MA_V_Expanded = SparseExpand(DayStarts, Ref(MA_V_Compressed,-1));
Plot( MA_V_Expanded, "Avg. First bar Volume", colorLightOrange, styleHistogram|styleThick);
When I run this code, it all seems fine. But when I start zooming in and zooming out my chart (using + and - signs), the plot disappears. Basically, the plot appears only at a very 'zoomed out' view.
The BIG PROBLEM:
Ok. so, to get to the crux of the problem, I thought of plotting the compressed version only (without expanding). My expectation was that it should give me a continuous plot because the array is yet compressed. I am not even calculating MA of the compressed array. Just plotting the compressed array of Volume directly.
So, I used this code:
DayStarts = (DateNum() != Ref(DateNum(), -1));
V_Compressed = SparseCompress(DayStarts, V);
Plot( V_Compressed, "Compressed Vol", colorLightOrange, styleHistogram|styleThick);
As I run the code, I get the continuous array of Vol as per the expectation.
BUT, the moment I click anywhere in the chart, the entire plot is messed up. Plot changes completely and I get only few entries at the right end of the chart.
My Conclusion:
It seems the SparseCompress function works ONLY at a very ZOOMED OUT level.