I'm working on a custom indicator...
Double Arrays set as IndexBuffers automatically shift right each time a new bar is created. As do Constants such as Open[], Close[], etc. The reason for this is fairly obvious... the same code can be use when chart is loaded as when the graph updates, without having to recalculate existing bars.
int start()
{
int Counted_bars;
Counted_bars=IndicatorCounted();
i=Bars-Counted_bars-1;
while(i>=0)
{
IndicatorBuffer[i] = [Some-calculations];
i--;
}
return (1);
}
Is there a way to declare an array that will also shift automatically along with everything else whenever a new bar is created? Preferably using the Existing API. So like:
enum Range{Low, Mid, high};
Range[] BarRange; //A Range value corresponding to each bar, calculates in the start loop.
How to keep it in Sync with the other arrays?