mql4algorithmic-tradingmetatrader4forex

MT4 - Place buy and sell limits at certain time


I would like to use Meta Trader 4 Expert Advisor to code a trading strategy.

However, I could not find such function in MT4.

A similar function in Python would be datetime.datetime(year, month, day, hour, minute, second).

Essentially I want to do the following:

Place sell and buy limit when market opens, say UTC +8.

It would be good if someone can help me in this.


Solution

  • In addition to Daniel's answer, the way I use time is simply using Hour(), Minute(), and Seconds().

    Note that these return broker server times.

    So use case:

    if(Hour()==14 && Minute()==30 && Seconds()==0){
        int buy = OrderSend(...);
    }