Download MetaTrader 5

Send order at specific time when market is not open

To add comments, please log in or register
FX-Krilon
14
FX-Krilon  
Hi,

Need help to code with time. I want to place orders before market opens. Since there are no ticks I don not get the EA to trigger on time.
The specific case is to make the EA  send stop entry order at server time 06:30:00.000

I tried to search the forum but maybe I am not using the right keywords to find it.
Thank you in advance.
Mladen Rakic
71752
Mladen Rakic  
FX-Krilon:
Hi,

Need help to code with time. I want to place orders before market opens. Since there are no ticks I don not get the EA to trigger on time.
The specific case is to make the EA  send stop entry order at server time 06:30:00.000

I tried to search the forum but maybe I am not using the right keywords to find it.
Thank you in advance.
You can not do that
FX-Krilon
14
FX-Krilon  
Mladen Rakic:
You can not do that
Aha,

So I have to wait for the first tick when the markets open to send the order.

What will be the implications for example if the order is a buy-stop and the first tick is opened higher, will it still be executed?
Marco vd Heijden
Moderator
6147
Marco vd Heijden  

A buy-stop order is an order to buy a security which is entered at a price above the current offering price, and it is triggered when the market price touches or goes through the buy-stop price.

What do you think ?

Also you can send orders but you will simple get an error (Market Closed)

For example MQL5

10018

TRADE_RETCODE_MARKET_CLOSED

Market is closed


And MQL4

132

ERR_MARKET_CLOSED

Market is closed

whroeder1
17063
whroeder1  
FX-Krilon: What will be the implications for example if the order is a buy-stop and the first tick is opened higher, will it still be executed?
Only if the price is above the Ask by at least MODE_STOPLEVEL points. Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial
Mladen Rakic
71752
Mladen Rakic  
FX-Krilon:
Aha,

So I have to wait for the first tick when the markets open to send the order.

...
Or you can place a pending order(s) before the market closes. But somehow I am guessing that it is not what you had in mind ...
FX-Krilon
14
FX-Krilon  
No not the pending order before market close, but thank you for the suggestion.

I will try to figure a way around it.

Thx
To add comments, please log in or register