Download MetaTrader 5

Trading hours

To add comments, please log in or register
Patrick00069
82
Patrick00069  

Hello everyone,

Could anybody help me to find info about how to set trading hours. For example no trade before 7AM and no trade after 8PM.

Thank you very much in advance!

Best regards

Patrick

Pix
45
Pix  
Patrick00069:

Hello everyone,

Could anybody help me to find info about how to set trading hours. For example no trade before 7AM and no trade after 8PM.

Thank you very much in advance!

Best regards

Patrick

Try something like this (MQL5):

MqlDateTime dateTimeNowUtc;
TimeGMT(dateTimeNowUtc);
if (dateTimeNowUtc.hour>=7 && dateTimeNowUtc.hour<=20) {
    // do trade operations
}
else {
    // close any open positions but no other trade operations
}

 - Patrick

Patrick00069
82
Patrick00069  
Pix:

Try something like this (MQL5):

 - Patrick

Thanks a lot man!
whiteking
209
whiteking  
Pix:

Try something like this (MQL5):

 - Patrick

Thankyou for sharing maybe useful not for only ts but all people

I am still not use mt5 now whether this codebase also can used on mt4 platform and how to use it
To add comments, please log in or register