Download MetaTrader 5
To add comments, please log in or register
Are you a real pro? Share your knowledge with millions of traders!
imad
7
imad 2014.11.19 10:59 

Hello,

I try since Friday to creat an EA that can open orders of 5 mintues expiration cause I will link it later to a Binary options plateform. I almost used all solution on this forum
creat a datetime variable in order to use for closing the order:

Exemple 1: 

datetime et = Time[0]+(5*60);

int ticket = OrderSend(Symbol(), OP_BUY, 0.2, Ask, 3, 0, 0, "",0, et, clrGreen);

Exemple 2:

datetime et = TimeCurrent()+(5*60);

int ticket = OrderSend(Symbol(), OP_BUY, 0.2, Ask, 3, 0, 0, "",0, et, clrGreen); 

 

Second Option directly put the  expiration on the fonction:

 int ticket = OrderSend(Symbol(), OP_BUY, 0.2, Ask, 3, 0, 0, "",0, TimeCurrent()+300, clrGreen); 

 

NOOOOOOOthing work when I check with a backtest !!!!
I want that EA to open an order & to close it after 5 minutes, that's the only condition I wanna use !!!

 

Can you Help me please!!!

thnks 

JC
1395
JC 2014.11.19 11:26  
zerocold:

I try since Friday to creat an EA that can open orders of 5 mintues expiration cause I will link it later to a Binary options plateform. I almost used all solution on this forum 

creat a datetime variable in order to use for closing the order:

Most brokers (?all copies of MT4) have minimum expiry times longer than 5 minutes. The information in the old thread https://www.mql5.com/en/forum/101886 still seems to be correct.

Keith Watford
Moderator
7990
Keith Watford 2014.11.19 11:32  
Expiry times are for pending orders only. It should cancel a pending order if it has not been triggered. It will not close an open OP_BUY or OP_SELL
whroeder1
13641
whroeder1 2014.11.19 14:30  
  1. Use SRC to post code
  2. Expiration can only be used with pending orders. What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
  3. Some brokers do not allow expiration at all

    147

    ERR_TRADE_EXPIRATION_DENIED

    Expirations are denied by broker

/
To add comments, please log in or register