DayOfWeek() For GMT

 

Hi,

I know this seems odd to request but is it possible to get the days of the week based on GMT time and NOT brokers server time if that makes sense to anyone?!

Basically, I want to stop my EA trading certain times on Friday and Sunday which I can do partly based on TimeGMT() BUT with brokers who are a few hours ahead of GMT, they can go into the next day which causes the EA to trade when it should not.

E.g. If I set my EA to trade from 21pm GMT on Monday night, a broker 3 hours ahead of GMT can start trading when the market opens on Sunday night GMT because that broker is already on Monday!

I am not sure I have worded this good at all but if anyone can help me solve this issue perhaps with a work around or built int mql function it would be much appreciated!

 
  1. TimeDayOfWeek(TimeGMT())
  2. But GMT is irrelevant. You need to convert it to ET.
    • FX opens 5pm ET Sunday and ends 5pm ET Friday. Some brokers start after (6pm is common/end before (up to 15 minutes) due to low volatility.

      Swap is computed 5pm ET. No swap if no open orders at that time.


    • Brokers use a variety of timezones. Their local time (with or without DST,) GMT/UTC, GMT+2, NY+7.

      Only with NY+7 does the broker's 00:00 equals 5pm ET and the start of a daily bar is the start of a new FX day.

      GMT brokers, means there is a 1 or 2 hour D1/H4 bar on Sunday (depending on NY DST,) and a short Friday bar.

      GMT+2 is close but doesn't adjust for NY DST.

      EET is closer except when their DST doesn't match NY's. Last Sunday of March and 1:00 on the last Sunday of October vs second Sunday in March and return at 2:00 a.m. EDT to 1:00 a.m. EST on the first Sunday in November.

    • Non-NY+7, means the chart daily bar overlaps the start, and converting broker time to NY time requires broker to GMT to NY timezone conversions.


    • If you search the web you will find differing answers. Those are all wrong (half the year) because they do not take NY DST into account (or that it changed in 2007 [important when testing history.])
 
So does simply changing to TimeDayOfWeek(TimeGMT()) get the day based on GMT? Thank you so much for your response. I cannot believe it would be that simple?!
Reason: