When i run this code on MT4 to get whether or not trading will be possible on monday (tested on AUDUSD) it returns false :
When i run this code on MT5 to get the trade session for Monday it returns the session as a normal monday .
Same broker .
Is there a more accurate equivalent for IsTradeAllowed for MT5 or is the MT4 return wrong ?
Thank you
I checked the ducomentation for SymbolInfoSessionTrade
. It says: "Allows receiving time of beginning and end of the specified trading sessions for a specified symbol and day of week."
It means it saves the start and end time of a session referred to by "index", in datetime references passed to the function. And if the task is done successfully it returns true.
So the return value has nothing to do with IsTradeAllowed in MQL4. It is doing something totally different.
When i run this code on MT4 to get whether or not trading will be possible on monday (tested on AUDUSD) it returns false :
When i run this code on MT5 to get the trade session for Monday it returns the session as a normal monday .
Same broker .
Is there a more accurate equivalent for IsTradeAllowed for MT5 or is the MT4 return wrong ?
Thank you
Have you tried TerminalInfoInteger(TERMINAL_TRADE_ALLOWED ) for MQL5. I havent tried!
When i run this code on MT4 to get whether or not trading will be possible on monday (tested on AUDUSD) it returns false :
When i run this code on MT5 to get the trade session for Monday it returns the session as a normal monday .
Same broker .
Is there a more accurate equivalent for IsTradeAllowed for MT5 or is the MT4 return wrong ?
Thank you
Also This:
MarketInfo(_Symbol, MODE_TRADEALLOWED)Have you tried TerminalInfoInteger(TERMINAL_TRADE_ALLOWED ) for MQL5. I havent tried!
Thanks
Actually the first post is my error .
Both return the proper time as the trading on monday on audusd on my broker starts 5 minutes after midnight .
On mt4 i was stupidly checking exactly at midnight . So the function works.
If i point the IsTradeAllowed on 24th of December any time of the day it correctly reports that trading was not allowed back then .
The question is rephrased then to
Will SymbolInfoSessionTrade adapt to holidays ?
Should have tested this last week damit
EDIT: My post was too late and you have already clarified the time to 00:05.
Are you sure trading is allowed at 00:00? There is usually a break for swaps.
Not that I am aware of. It is somewhat static. It even fails for DST in the Strategy Tester as well.
It is only valid for current time, and the broker updates it when a the DST comes into effect (but sometimes they forget and only update it later).
Not that I am aware of. It is somewhat static. It even fails for DST in the Strategy Tester as well.
It is only valid for current time, and the broker updates it when a the DST comes into effect (but sometimes they forget and only update it later).
Thank you .
So this means IsTradeAllowed is potentially wrong too , sometimes .
Does it poll the broker's server with each request (because i can request dates from the past , paired with sessions not being updated for holidays , and the fact i got false for a trading holiday ) ?
You should know by now, that everything and anything by MetaQuotes, sometimes works, sometimes not.
In some ways, the MQL4 "IsTradeAllowed" function is more practical that the MQL5 "SymbolInfoSessionTrade" function, and in other ways it is worse. Neither method is 100% and are both very lacking for practical use.
You should know by now, that everything and anything by MetaQuotes, sometimes works, sometimes not.
In some ways, the MQL4 "IsTradeAllowed" function is more practical that the MQL5 "SymbolInfoSessionTrade" function, and in other ways it is worse. Neither method is 100% and are both very lacking for practical use.
Maybe this one depends on what the broker provides though . I mean there was a thread the other day about Exness not returning margins required , so yeah maybe not everything is their fault .I guess there are parts in the contracts that they had to be lenient with brokers to get the deals through .
< Dear mods , it would be very nice when you move threads to inform the OP by PM .I know how to look around and find it ,but someone not familiar with the forum may assume other things and leave. Unless you factored that in and did not PM me in which case i apologize . Happy new year :) >

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
EDIT : Ignore this , my mistake on the sessions times , the question is if SymbolInfoSessionTrade will adapt sessions to holidays of that week.
When i run this code on MT4 to get whether or not trading will be possible on monday (tested on AUDUSD) it returns false :
When i run this code on MT5 to get the trade session for Monday it returns the session as a normal monday .
Same broker .
Is there a more accurate equivalent for IsTradeAllowed for MT5 or is the MT4 return wrong ?
Thank you