Views:

Margin call (MC) is a low margin notification. When it is a critical margin level MC event occurs.

The standard MC level is 100% of Margin Level. At this point the account state information field on Toolbox window of the client terminal is highlighted with red. It is not allowed to open trades which cause increasing of margin utilization but it is allowed to open trades which decrease margin utilization. 

Stop out (SO) or Liquidation occurs when Margin Level of account reaches SO Level (normally 30%). At this point, open positions are closed forcedly, and limit orders are deleted. 

 

The MQL5 code below can be used to know MC and SO level of the account. To compile the script: 1) run MetaEditor by pressing F4 with active MT5 terminal window or clicking "IDE" in Toolbar and wait when MetaEditor starts; 2) go to menu "File - New" in MetaEditor, select Script, click "Next", type any name you wish and click "Finish"; 3) paste to the editor the code below and click "Compile" button; 4) once compiled go back to MT5 Terminal, locate the script in "Navigator" window and double click on it to launch; 4) the Alert window will show you Margin Call and Stop Out levels.

 

 

#property copyright "Copyright 2021, MetaQuotes Ltd." 

#property link      "https://www.mql5.com" 

#property version   "1.00" 

//+------------------------------------------------------------------+ 

//| Script program start function                                    | 

//+------------------------------------------------------------------+ 

void OnStart() 

  { 

//--- 

   double mc_level=AccountInfoDouble(ACCOUNT_MARGIN_SO_CALL); 

   double so_level=AccountInfoDouble(ACCOUNT_MARGIN_SO_SO); 

   Alert("MC Level: "+DoubleToString(mc_level,2)+"; SO Level: "+DoubleToString(so_level,2)); 

  }