Download MetaTrader 5

Request expiration of a request in a exact time during the day. How to do it?

To add comments, please log in or register
Millions of traders download codes from MQL5 library. Share your app with them!
humbertobrandao Brandao
130
humbertobrandao Brandao 2015.01.08 19:31 

Hi guys!

I wish that the market cancels my request in a limit hour. Obviously, only in case that it wasn't filled.

For example, I'm sending a request to the market now (12:02:10). But There is a limit time for execution (12:03:10) - 1 minute...

I wouldn't like to send a delete message. I want that the market delete my order if it wasn't filled.

 Is it possible? Can we inform a parameter in a request to set it?

Regards! 

Alain Verleyen
Moderator
30727
Alain Verleyen 2015.01.08 20:22  
humbertobrandao:

Hi guys!

I wish that the market cancels my request in a limit hour. Obviously, only in case that it wasn't filled.

For example, I'm sending a request to the market now (12:02:10). But There is a limit time for execution (12:03:10) - 1 minute...

I wouldn't like to send a delete message. I want that the market delete my order if it wasn't filled.

 Is it possible? Can we inform a parameter in a request to set it?

Regards! 

Yes, the expiration parameter, but only if it's allowed for the symbol.
humbertobrandao Brandao
130
humbertobrandao Brandao 2015.01.09 04:19  

Thanks for your answer.

In fact, I tried to use this parameter (request.expiration), before to use the function OrderSend

request.expiration = TimeCurrent()+60;

 But, unfortunately, it doesn't work. One minute later, my pending order wasn't canceled automatically.

In this context, I don't know if I am using the parameter in the wrong way, or if it really can't work like describe in the documentation.

Do you have some tip for me?

Regards 

Alain Verleyen
Moderator
30727
Alain Verleyen 2015.01.09 08:22  
humbertobrandao:

Thanks for your answer.

In fact, I tried to use this parameter (request.expiration), before to use the function OrderSend

 But, unfortunately, it doesn't work. One minute later, my pending order wasn't canceled automatically.

In this context, I don't know if I am using the parameter in the wrong way, or if it really can't work like describe in the documentation.

Do you have some tip for me?

Regards 

Did you check that the Time Specified expiration mode is allowed for your symbol ?
To add comments, please log in or register