- If your broker allowed an expiration time, then set it 4 hours after current and it will delete itself.
- Otherwise remember when you placed it and delete it (if not open)
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi everyone!
I am very new to this forum and writing EAs. I want to know how to close an order after a certain period of time. For example, I have placed an order at 12PM, I want it to close after 4 hours at 4PM. Even if it is a pending order that I placed at 12, I want to close/expire after 4 hours at 4 PM regardless of whether or not it was activated. Does a code like this exist? Can somebody attach it or explain how to do it? Any help would be much appreciated!
Thank you!!