I'm drawing objects on my chart and using the UninitializeReason case REASON_REMOVE.
If I close the MetaTrader platform, the objects are deleted - even though the expert or indicator was left attached to the chart.
Is this a bug or is this normal behaviour? One would think this wouldn't happen.
Thank you.
Interesting. Wish it worked differently. Thanks for clearing this up for me. Much appreciated.
I'm drawing objects on my chart and using the UninitializeReason case REASON_REMOVE.
If I close the MetaTrader platform, the objects are deleted - even though the expert or indicator was left attached to the chart.
Is this a bug or is this normal behaviour? One would think this wouldn't happen.
Thank you.
Do you mean that you are placing the objects or that the code is creating them?
If you are manually placing objects and they are being deleted, it is probably because your code is deleting all objects in deinit.
If you don't want this to happen, modify the code to delete only objects created by the code.
Do you mean that you are placing the objects or that the code is creating them?
If you are manually placing objects and they are being deleted, it is probably because your code is deleting all objects in deinit.
If you don't want this to happen, modify the code to delete only objects created by the code.
I think the OP uses REASON_REMOVE in deinit() to decide to remove Objects or not, he incorrectly assumed that the Indicator stayed on the chart when MT4 was shut down and that the deinit reason would not be REASON_REMOVE in that case . . .
It is not actually clear from the OP whether the objects are being drawn by the indicator or added manually.
If drawn, by the indicator, then usually they will be re-drawn when MT4 is re-opened, so not a problem.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I'm drawing objects on my chart and using the UninitializeReason case REASON_REMOVE.
If I close the MetaTrader platform, the objects are deleted - even though the expert or indicator was left attached to the chart.
Is this a bug or is this normal behaviour? One would think this wouldn't happen.
Thank you.