ChartSetSymbolPeriod during iCustom calls

 

Hello,

I'm having some issue while using in an EA indicators that use ChartSetSymbolPeriod(0,NULL,0) function.

I used this function in some of my indicator because it's the only way to trigger indicator recalculation without waiting a new tick but:

In case of I call multiple of these indicators of different pairs from my EA, I get (rightly) my chart jumping among all symbols and timeframe during initialization.

This occurs because the ChartSetSymbolPeriod(0,NULL,0) command get triggered for each one of my handles.

I think the only way is to avoiding this command to work when indicator is loaded through iCustom command.

Maybe is there a way to recognize that?

Or I need to create a variable like "EA Mode" in my indicator, setting it to TRUE when called with iCustom and then, in my indicator code, do ChartSetSymbolPeriod only if EA Mode=false?

What is best practice in this case?

Thanks