Please, how I can check if market is open or closed in MT5, I cant find answer.
something similar to MT4 - MarketInfo(Symbol(),MODE_TRADEALLOWED) this command doesn't exist in MT5 anymore.
Thank you
MarketInfo(Symbol(),MODE_TRADEALLOWED) in MT4 isn't reliable.
If you want to check Opened/Closed market you should use these functions together (both in MT4 and MT5):
SymbolInfoSessionTrade() => to find the last session start/end time
SymbolInfoInteger(_Symbol,SYMBOL_TIME) => to find out the last known tick time for the symbol
TimeCurrent() and TerminalInfoInteger(TERMINAL_CONNECTED) => to find out if the server is "ON"
MarketInfo(Symbol(),MODE_TRADEALLOWED) in MT4 isn't reliable.
If you want to check Opened/Closed market you should use these functions together (both in MT4 and MT5):
SymbolInfoSessionTrade() => to find the last session start/end time
SymbolInfoInteger(_Symbol,SYMBOL_TIME) => to find out the last known tick time for the symbol
TimeCurrent() and TerminalInfoInteger(TERMINAL_CONNECTED) => to find out if the server is "ON"
Thank you for answer,
I dont know if mentioned command isn't reliable, but it was working
SymbolInfoSessionTrade() show nonsense times and counting back difference between last tick and current time seems to be not reliable to me, it doesn't meen that market is closed.
MarketInfo(Symbol(),MODE_TRADEALLOWED) in MT4 isn't reliable.
...Why not reliable ?
MarketInfo(Symbol(),MODE_TRADEALLOWED) in MT4 is not working,are you new to mt4 or just trying to do what you can't do..
Why not reliable ?
Below is a log from a script I created to show you the reliability of MarketInfo(Symbol(),MODE_TRADEALLOWED). Both was run (as you can see) at this weekend (Market is closed) but EURUSD looks like the market is opened (by MarketInfo(Symbol(),MODE_TRADEALLOWED)).
2018.03.11 15:15:41.555 Script DAX_ecn,M15: Symbol: DAX_ecn ; Trade allowed: false ; Session trade from: 09:00:00 ; Session trade to: 22:59:00 ; Current time: 23:57:59 ; Last tick time: 22:59:59 ; Local time: 15:15:41
2018.03.11 15:16:58.792 Script EURUSD_ecn,M15: Symbol: EURUSD_ecn ; Trade allowed: true ; Session trade from: 00:06:00 ; Session trade to: 23:58:00 ; Current time: 23:57:59 ; Last tick time: 23:57:59 ; Local time: 15:16:58
Thank you for answer,
I dont know if mentioned command isn't reliable, but it was working
SymbolInfoSessionTrade() show nonsense times and counting back difference between last tick and current time seems to be not reliable to me, it doesn't meen that market is closed.
SymbolInfoSessionTrade() show me correct data (what do you mean by nonsense times?) see the log above in my answer to Alain.
It's up to you. If you discover easier and reliable way, let me know.
@Petr Nosek who told you MT4
MarketInfo(Symbol(),MODE_TRADEALLOWED) in MT4 is not working,are you new to mt4 or just trying to do what you can't do..
SymbolInfoSessionTrade() show me correct data (what do you mean by nonsense times?) see the log above in my answer to Alain.
It's up to you. If you discover easier way, let me know.
Sorry, my fault, timezone offset confused me a bit
yes, SymbolInfoSessionTrade() should be fine if it shows all and correct data
Thank you for help
Below is a log from a script I created to show you the reliability of MarketInfo(Symbol(),MODE_TRADEALLOWED). Both was run (as you can see) at this weekend (Market is closed) but EURUSD looks like the market is opened (by MarketInfo(Symbol(),MODE_TRADEALLOWED)).
2018.03.11 15:15:41.555 Script DAX_ecn,M15: Symbol: DAX_ecn ; Trade allowed: false ; Session trade from: 09:00:00 ; Session trade to: 22:59:00 ; Current time: 23:57:59 ; Last tick time: 22:59:59 ; Local time: 15:15:41
2018.03.11 15:16:58.792 Script EURUSD_ecn,M15: Symbol: EURUSD_ecn ; Trade allowed: true ; Session trade from: 00:06:00 ; Session trade to: 23:58:00 ; Current time: 23:57:59 ; Last tick time: 23:57:59 ; Local time: 15:16:58
Yes it should return when the market is open/close but is the documentation reliable ?
I am using it in some EA with some brokers and CFDs symbols and it's reliable while SymbolInfoSession() is not available.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Please, how I can check if market is open or closed in MT5, I cant find answer.
something similar to MT4 - MarketInfo(Symbol(),MODE_TRADEALLOWED) this command doesn't exist in MT5 anymore.
Thank you