Greets,
I'd like to check the margin level percentage before placing a trade, but AccountInfoDouble(ACCOUNT_MARGIN_LEVEL) always returns 0.0.
I've read the article here https://www.mql5.com/en/forum/228052 but it doesn't solve my problem.
As a test, whether I'm calling in OnInit() or OnTick(), AccountInfoDouble(ACCOUNT_MARGIN_LEVEL) always returns 0.0
This should be so straightforward, but does not work as expected. The online docs are of no help. I don't want to perform calculations, I simply want the AccountInfoDouble(ACCOUNT_MARGIN_LEVEL) to work as documented, so there must be some condition which is not being satisfied.
Any help would appreciated.
Edit: could this be because it's running in a demo account (and not linked to a real broker)?
Thanks
ok, can confirm - ACCOUNT_MARGIN_LEVEL is not active on a demo account, only live. So you need to check ENUM_ACCOUNT_TRADE_MODE first.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Greets,
I'd like to check the margin level percentage before placing a trade, but AccountInfoDouble(ACCOUNT_MARGIN_LEVEL) always returns 0.0.
I've read the article here https://www.mql5.com/en/forum/228052 but it doesn't solve my problem.
As a test, whether I'm calling in OnInit() or OnTick(), AccountInfoDouble(ACCOUNT_MARGIN_LEVEL) always returns 0.0
This should be so straightforward, but does not work as expected. The online docs are of no help. I don't want to perform calculations, I simply want the AccountInfoDouble(ACCOUNT_MARGIN_LEVEL) to work as documented, so there must be some condition which is not being satisfied.
Any help would appreciated.
Edit: could this be because it's running in a demo account (and not linked to a real broker)?
Thanks