Returns open time of the currently selected order. datetime OrderOpenTime();
datetime time_1=some_date_here; if(OrderOpenTime()>time_1) { // do something... }Make sure the order is selected by OrderSelect() first.
You must first select the order using OrderSelect()
Then you can compare OrderOpenTime() to whatever date/time you need.
![OrderSelect - Trade Functions - MQL4 Reference OrderSelect - Trade Functions - MQL4 Reference](https://c.mql5.com/36/12/orderselect-trade-functions-mql4__1.png)
OrderSelect - Trade Functions - MQL4 Reference
- docs.mql4.com
OrderSelect - Trade Functions - MQL4 Reference
Sorry Marco, we were typing at the same time.
No problem but your pic seems to be gone.
Marco vd Heijden:
Make sure the order is selected by OrderSelect() first.
Make sure the order is selected by OrderSelect() first.
Thank you very much!
and in some_date_here, how must be written the date correctly? like 20170101, or 2017.01.01 or how?
thank you very much!
![Documentation on MQL5: Language Basics / Data Types / Integer Types / Datetime Type Documentation on MQL5: Language Basics / Data Types / Integer Types / Datetime Type](/i/community/logo_mql5_small.png)
Documentation on MQL5: Language Basics / Data Types / Integer Types / Datetime Type
- www.mql5.com
Language Basics / Data Types / Integer Types / Datetime Type - Reference on algorithmic/automated trading language for MetaTrader 5
![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
I am stuck coding a time filter in MQL4...
What I want to code is:
if order open time is > a date...
So I understood I must use OrderOpenTime function, but how to write correctly the condition?
if(OrderOpenTime(TIME_DATE)>DATE){....... this is the format I am looking for...
Help is appreciated!
Thank you very much!