Delete Indicator when EA is running


I have a custom indicator that I want to delete it when some actions happen and add new one with different inputs. Also if its possible just change the input of my indicator.

// for example delete the first one and add another one or just modify the first one



I found this two functions ChartIndicatorDelete and IndicatorRealease. but I have problem with them.

In IndicatorRealease documentation says " When working in the strategy tester, the IndicatorRelease() function is not executed. ". so I cant backtest properly because its important to remove and add or modify my indicator. My indicator just makes a EventChartCustom event, so I don't want my indicator send  EventChartCustom to my EA after some actions happened (if()).

// for example


and my problem with ChartIndicatorDelete is that in documentation says "

Deletion of an indicator from a chart doesn't mean that its calculation part will be deleted from the terminal memory. To release the indicator handle use the IndicatorRelease() function.


so I think it will send EventChartCustom even after I use  ChartIndicatorDelete. so how can I remove or modify my indicator inputs and its works in backtesting and live ?(symbol,timeframe,...)

So it is your own indicator?

Use terminal global variables to control the indicator.

Use union {} to convert global variables from double to long and vice versa, if needed.

Another way would be to use named pipes or text files to establish a communication channel between your two code instances.