I have an Indicator that I created, it's main purpose is to show the output from a function that I have created to form part of my EA. In effect the Indicator bit is just a tool for testing the function . . .
It all works as expected when I open a chart and add the indicator to it, switching between time frames works seamlessly now, thanks to looking out for error 4066 (thanks WHRoeder ), my problem comes when I add the Indicator to a default template and then open a new chart that I don't already have history for. The weird thing is that it's almost like the Indicator buffers are no longer running as a series array . . . the visual output of the Indicator (Histogram in this case) is shift all the way to the left, if I scroll left to find it and then try to scroll past it there is a pause as additional data is downloaded from my broker then the histograms shift left again . . . if I change time frame from H1 to any other and then back to H1 all is well.
It seems something screwy is going on when a chart is first opened and this is doing something it shouldn't to my Indicator buffers . . . if anyone has any ideas I'd be happy to hear them. :-)
thats probably where your problem lies, it is something in your code for limiting to 1000 bars maybe if you add
if(Bars <= Limit) return (0);
I have an extern int for the number of bars I want to paint . . . .
extern int Max_Bars_Indicator = 1000; //The max number of bars back in time that we want the Indicator to go.
. . I use an int local to start() and set it relative to Bars if it is more than Bars . . . . set at 1000 by default on a H1 chart on currencies it isn't . . .
if (lMax_Bars_Indicator > Bars) lMax_Bars_Indicator = Bars-1;
Glad it's not just me then ;-)
Internet access down for last 4 hours . . .
I do use a couple of Globally defined variables and a few statics . . mainly added to try and resolve my issue . . . I'm going to try and rework a large part of this Indicator, I've hacked it about a bit in the last few days and need to go back a few steps and be clear about what I am doing . . .