OrderOpenTime date condition

 
Hello guys,

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!
 
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
  • 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.

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
  • www.mql5.com
Language Basics / Data Types / Integer Types / Datetime Type - Reference on algorithmic/automated trading language for MetaTrader 5
Reason: