By not changing symbol.
This function works so.
You would have to find another solution.
Your indicator will de-init and re-init every time either the symbol or timeframe changes, manually or through code. You can capture the event by checking the reason in OnDeinit (looking for REASON_CHARTCHANGE).
I'm assuming it is causing you trouble as certain indicator values are resetting when it re-inits? If that's the case, save values to globals and read them back in in OnInit. I have to do this in quite a lot of my indicators/EAs
Thanks to everyone for the answers, now it's all clear and I can study a possible solution! My
problem is that I can not recompile each time the code if I change Time
Frame or period, I have alarms that would play again without reason.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi everyone, I do not understand why using this feature,
ChartSetSymbolPeriod();
my indicator is deinitialized and initialized each time I change symbol. How can I overcome this problem?
thank you