How can filter trading sessions in EA.

 

There are three trading sessions by GMT
Asian session start from 21-23 GMT to 7-8GMT.
UK session start from 7-8GMT to 12GMT
US session start from 12GMT to 21GMT.

If want to trade only from UK session start to US session end time ,How code in mql4.

Please give me some examples.I found many samples but still not clear.
Thanks.

 
Hi, do you tryed time function to limit trading between specific hour? besides how do you want backtest this EA?. Regards Greg
 
You need to match the current server time against the session times of your interest. See TimeHour() and TimeCurrent() functions.
TimeHour - Date and Time - MQL4 Reference
TimeHour - Date and Time - MQL4 Reference
  • docs.mql4.com
TimeHour - Date and Time - MQL4 Reference