sorry, was not on purpose
thank you
Are you using OnCalculate()?
You should try to avoid the old variables such as IndicatorCounted(). Use prev_calculated instead.
Your problem is possibly due to the chart being updated after you change timeframes.
When prev_calculated ==0, you should use ArrayInitialize() to set all index to EMPTY_VALUE.
Are you using OnCalculate()?
You should try to avoid the old variables such as IndicatorCounted(). Use prev_calculated instead.
Your problem is possibly due to the chart being updated after you change timeframes.
When prev_calculated ==0, you should use ArrayInitialize() to set all index to EMPTY_VALUE.
Yes I use the OnCalculate() function.
Thank you for the tip with the ArrayInitialize() , i think that was the main problem.
Now the code (in the OnCalculate) looks like this:
if(prev_calculated == 0) //changing TF f.e. { ArrayInitialize(RsiLevelBuffer,EMPTY_VALUE); ArrayInitialize(BBCon1UpBuffer,EMPTY_VALUE); ArrayInitialize(BBCon1DownBuffer,EMPTY_VALUE); } if(rates_total != prev_calculated) { int limit = rates_total - prev_calculated; // Do not check repeated bars //For drawing Indicators for(int i = limit; i >= 1; i--) // Iterate bars from past to present { if(i > Bars -2) continue; // If not enough data... if(BBCondition_1(i)) { continue; } if(BBCondition_2(i)) { continue; } if(BBCondition_3(i)) { continue; } RsiCondition(i); } }
Would oyu solve it differently? Or how do you do it?
Have a nice day, and thank you :)
- www.mql5.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello Community
I got a little problem with a Indicator I made.
Sometimes if i switch the timeframe, The Indicator is drawn randomly all over the chart.
Indicator normally:
Indicator Buggy:
Does someone know where the problem is?
Here are some parts of the code:
The arrows are drawn inside the condition functions