Steps on trading on a session

 
Hi guys is im coding an EA that will only trade on a given session but broker time local time and GMT is confusing me. Im making a function that will trigger my ordersend if the time hits a given session example new york session. Is this the correct steps i need to do?

1. Get broker timezone
2. Get the time when a session starts on broker timezone
3. If time now is equals to session time on broker timezone do ordersend. 

Is that the right sequence? Thank you

 
There are multiple ways to do it.

I personally prefer to have my computer TimeZone on GMT(UTC) and then use TimeLocal().
TimeLocal - Date and Time - MQL4 Reference
TimeLocal - Date and Time - MQL4 Reference
  • docs.mql4.com
TimeLocal - Date and Time - MQL4 Reference
 
Jeremie Courchesne #:
There are multiple ways to do it.

I personally prefer to have my computer TimeZone on GMT(UTC) and then use TimeLocal().

thank you sir on your reply i will try that