![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Having experimented with all this in MT5, I have several questions. First though, I want to do this to ensure that no matter where on the globe my EA is used, I can always give an accurate answer to the question "Is the market for this symbol with this broker still active/open or not?" That applies to any symbol, any broker, any exchange, any global timezone in which a trader is trading. This includes Forex. I recognise that different brokers may have different times for the same symbol. That's fine, and all the more reason for this to be able to provide a reliably accurate determination of open/closed.
So, my questions:
Assume that the questions above are able to be answered fully and accurately, and for any symbol with any broker, and that the relevant session times and dates are correctly determined and specified in a known timezone.
I appreciate answers to the questions. Any code that is comprehensive for any symbol, any broker, any timezone used by a trader, would be most welcome.
Thanks.
Simple code I use
Simple code I use
Thanks, Chioma Obunadike.
Unfortunately, I don't think that is sufficient to meet the requirements I've specified. It's possible for the market to close at a time of day that is earlier than the end of the day and so there may be several hours before the day of the week changes during which the market is closed, but the test you make would say it is open because the day of the week has not yet changed. It also might fail when an exchange-based session crosses midnight in the trader's local timezone but the session is still open in the exchange timezone in the same (previous) day.
Further contributions would be most welcome.
Thanks.
Have a look on CloseOnWeekend_ea.mq5
Many thanks, amrali. That looks like it might be a good solution. You've obviously put in a lot of thought and effort! I will look at it in detail and respond there if need.
Thanks!