Deleting indicator from all windows

 

Hi, 

I've tried to delete an indicator from an EA, but it's taking me too long. 

How can I find all the chart IDs that have this indicator?

I began with

WindowFind("Indicator name")

but it returns -1

...

Documentation on MQL5: Chart Operations / ChartID
Documentation on MQL5: Chart Operations / ChartID
  • www.mql5.com
ChartID - Chart Operations - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
  1. The indicator(s) the EA is using is not on the chart. It's on a hidden chart.
  2. You can't remove them, unless you change the EA's code.
 

William Roeder #

You can't remove them, unless you change the EA's code.

So how do I change the EA's code? 

 
dc3463456 #:

So how do I change the EA's code? 

You need to loop all chart windows and subwindows, for that matter. On each window you loop all loaded indicators and retrieve their name, compare it to what you are searching for.

Then you know where the indicator is running, now you remove it from the chart. - Since this is MT4, I am not precisely familiar with the functions involved. But that would be the process to do what you want.

EDIT:

Find what you need here:

 
Dominik Christian Egert #:
On each window you loop all loaded indicators and retrieve their name, compare it to what you are searching for.

That's what I've been trying to do but I couldn't find the function. I'm not even sure it's possible.

 

My issue is terminal freezing when the EA is periodically doing its thing and I change the timeframe/reinitialize the indicator at the same time.

I just modified my indicator code so maybe the issue will be fixed. Hopefully.

 
dc3463456 #:

My issue is terminal freezing when the EA is periodically doing its thing and I change the timeframe/reinitialize the indicator at the same time.

I just modified my indicator code so maybe the issue will be fixed. Hopefully.

Could you clarify, are you using an EA or an indicator?

And if both, what is doing what?

 
Dominik Christian Egert #:

Could you clarify, are you using an EA or an indicator?

And if both, what is doing what?

Both. EA writes to file. Indicator reads it. 

 
dc3463456 #:

Both. EA writes to file. Indicator reads it. 

ANd which is removing the indicator?
 
Dominik Christian Egert #:
ANd which is removing the indicator?
dc3463456:

I've tried to delete an indicator from an EA

They are not on the same chart. 

I think it would also solve my refreshing issue if I added it back after the file was written.

https://www.mql5.com/en/forum/451098
I can't refresh my custom indicator automatically
I can't refresh my custom indicator automatically
  • 2023.07.21
  • www.mql5.com
Hello again, I hope your are doing well...
 
dc3463456 #:

They are not on the same chart. 

I think it would also solve my refreshing issue if I added it back after the file was written.

https://www.mql5.com/en/forum/451098
what are you trying to achieve?

If you want the EA or indicator to load the file after it has been altered, use CustomEvents to notify your program of reloading. And send back an acknowledgement after you are done reloading...

Build a causal sync relationship between both programs. Don't brute force your code to do that, use proper coding.