Open or Closed

 

How can an EA know if a market is open or closed ... January 9th 2025 President Biden made it a National Day of Mourning to Honor President James Earl Carter, Jr ... My EA did not get the memo and it does not repeat

Thing is although the NYSE closed trading continued around it ... least it did with my broker (01:00 open 16:30 closed 24:00)

Unfortunately I cannot look back to January in the MT5 calendar

Thank you for your time ... Appreciated :)

 
Robert Jenkins:

Your EA cannot inherently know if the market is closed due to a special holiday like a National Day of Mourning. If your broker continued sending price ticks, the EA would assume the market was open.

MT5 does not show past market closures in the symbol calendar, and not all brokers follow NYSE hours exactly. Some instruments may have kept trading.

In the future, it helps to check your broker’s news or trading schedule around holidays. You might also consider coding known holidays into your EA logic if needed.

 
Robert Jenkins:
although the NYSE closed trading continued around it

Be aware of what you're trading. I doubt that you were trading real stocks on the New York Stock Exchange (NYSE). It's theoretically possible to do so in MT5, but I've yet to see it.

You're most likely trading CFD's (contracts for difference) for which there are no underlying assets. In contrast with the centralized NYSE, a captive CFD broker-dealer can clear its received trades whenever it likes--provided that the liquidity continues to flow.