Search code examples
metatrader4

[metatrader4]Market open/close event


I am wondering is there is a market close/open event, or a way to catch the point at which markets close on Friday and start on Monday.

I am implementing a Web-socket server that serves market feed data, and need the events to stop/restart the server.


Solution

  • MT4 does not provide such event, however there is configuration method which allows you to get such information:

        var timeConfiguration = manager.CfgRequestTime();
    

    timeConfiguration will contain information about open hours in property Days which will contain 7 elements(one per day of week) and each element will have 24 childs(one per each hours). One means that market is open and 0 means that market is closed