lets say i want to add the BB indicator to my chart using my indicator code
everytime i change timeframe , another instance of the indicator BB is added again and again
what am i doing wrong ?
here is part of the code
I had same issue but simply adding a condition to check the number of indicators on the chart and limiting the indicator to only add a new indicator OnInit if there is less than one indicator on the chart.
This way, you don’t have duplicate indicators added and also... If you adjust indicator settings, it will remain so unlike when you use indicatordelete on DeInit
Every time you switch to another timeframe the system executes OnInit again. To avoid reattaching the indicator simply check if bbhandle is holding a valid number.
Another solution is removing the attached indicator before attaching another.
i am already removing it as u see in Deinit but it seems its not deleting it
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
lets say i want to add the BB indicator to my chart using my indicator code
everytime i change timeframe , another instance of the indicator BB is added again and again
what am i doing wrong ?
here is part of the code