How can I find out (at init() e.g.) that Trade is Allowed (opt are set) even if market is closed or Server is busy?
This is not an atomic check (subject to race conditions) but how about...
begin function repeat a few times or forever if (!IsTradeContextBusy() ) return IsTradeAllowed(); // possible race condition wait a bit end repeat return false; end function
or a bit neater but might get stuck...
while IsTradeContextBusy() wait a bit end while return IsTradeAllowed() // still possible race condition if IsTradeContextBusy becomes true at this exact moment
gooly:
Well I would have expected a function or a flag which is set by the terminal option!
Well I would have expected a function or a flag which is set by the terminal option!
I suspected as much, but couldn't tell for sure from your post. Isnt there a lot more threads avialable these days, so trade context less likely to be busy anyway? Unless doing high performance stuff, in which case MT4 platform might not be the best option?
![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
HI,
How can I find out (at init() e.g.) that trade is allowed (terminal-options are set) even if the server is busy (or market closed?)?
IsTradeAllowed();