ChartSetSymbolPeriod maybe problem?

 

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

 

By not changing symbol.

 
Marco vd Heijden:

By not changing symbol.

Thank you for your answer! Do you want to tell me that this function works so and I can not do anything?
 

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.
Reason: