How to write date and time with mql4 for order expiration?

Back to topics list To post a new topic, please log in or register
SYXTO 2015.01.04 17:45

How to write date and time with mql4  order expiration?



 here is my code,I want to add a date and an expiration time but I do not know how to write the date and time

 If i want to insert a date and a time  for orderexpiration How i write this?


    Achat = OrderSend(Symbol(),OP_BUYSTOP,0.1,iOpen(Symbol(),PERIOD_M1,0)+90*Point,3,0,0,"EA Shinobi 1.0",0,0,clrNONE);

    Vente = OrderSend(Symbol(),OP_SELLSTOP,0.1,iOpen(Symbol(),PERIOD_M1,0)-90*Point,3,0,0,"EA Shinobi 1.0",0,0,clrNONE);

    for (i;i<orderstotal;i++)

    Selection = OrderSelect(i,SELECT_BY_POS,MODE_TRADES);

    Modifier =OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()- 100 * Point, OrderOpenPrice()+ 2000 * Point,OrderExpiration(),clrNONE);

    Modifier = OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+ 100 * Point, OrderOpenPrice() - 2000 * Point,OrderExpiration(),clrNONE);


 Thanks for your help,

honest_knave 2015.01.04 18:10 #

Take a look here - datetime type

If you need more help, you will need to be more specific about when you want the expiration i.e. a certain time after opening the order, or a certain time after bar open/close etc.

SYXTO 2015.01.04 19:20 #


 I just need the syntax for put datetime in : OrderExpiration(),clrNONE);  for pending order.


How write 2015.01.10 12:34:54 (example) on mql4 language ?








honest_knave 2015.01.04 19:27 #

Did you look at the link I gave you?

Multiple examples of how to write time 

Back to topics list  

To add comments, please log in or register