How to get available margin percentage

 

Hi,

How to get an available margin percentage as shown in the MT4?
I would like to stop opening new order when margin percentage below 150%
If there is no code to get it directly, what value do I need to know in order to calculate?

Thank you in advance

 
Naruephon Klongngoen:

Hi,

How to get an available margin percentage as shown in the MT4?
I would like to stop opening new order when margin percentage below 150%
If there is no code to get it directly, what value do I need to know in order to calculate?

Thank you in advance

double MarginLevelPct   = AccountInfoDouble(ACCOUNT_MARGIN_LEVEL);
 
rrocchi:

Thanks a lot, works fine ^ ^

Reason: