I have several indicators, that I have to keep compiling, to keep the items displayed on the chart current. Below is some code to show what I mean. When the platform is launched or when the indicator is added to the chart, there is no problems. When period "0" becomes period "1", the lines stop drawing, until I recompile the code. Is there a command or routine that I need to use to get the lines to keep drawing, even when the period changes?
Thanks, again!
This line uses "EndTime", which is only updated when "TimeHour(Time[i]) == Hour_Num && TimeMinute(Time[i]) == Minute_Num":
ObjectSet("5mg_Line"+h,OBJ_TREND,EndTime);
So you'll have to modify your time checks to get EndTime modified.
Also, consider changing your i to:
int i = MathMin(Bars-1,Bars-Counted_bars); // i will range from 0 to Bars-1.
Otherwise your "if (i>0)" condition will not execute beyond the first run.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have several indicators, that I have to keep compiling, to keep the items displayed on the chart current. Below is some code to show what I mean. When the platform is launched or when the indicator is added to the chart, there is no problems. When period "0" becomes period "1", the lines stop drawing, until I recompile the code. Is there a command or routine that I need to use to get the lines to keep drawing, even when the period changes?
Thanks, again!