SymbolInfoMarginRate

Returns the margin rates depending on the order type and direction.

bool  SymbolInfoMarginRate(
   string             name,                     // symbol name
   ENUM_ORDER_TYPE    order_type,               // order type
   double&            initial_margin_rate,      // initial margin rate
   double&            maintenance_margin_rate   // maintenance margin rate
   );

Parameters

name

[in] Symbol name.

order_type

[in] Order type.

initial_margin_rate

[in] A double type variable for receiving an initial margin rate. Initial margin is a security deposit for 1 lot deal in the appropriate direction. Multiplying the rate by the initial margin, we receive the amount of funds to be reserved on the account when placing an order of the specified type.

maintenance_margin_rate

[out] A double type variable for receiving a maintenance margin rate. Maintenance margin is a minimum amount for maintaining an open position of 1 lot in the appropriate direction. Multiplying the rate by the maintenance margin, we receive the amount of funds to be reserved on the account after an order of the specified type is activated.

Return Value

Returns true if request for properties is successful, otherwise false.

Ejemplo:

#define SYMBOL_NAME Symbol()
 
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//--- declaramos las variables en las que se anotarán los coeficentes
   double initial_margin_rate = 0;     // coeficiente del cobro de margen inicial
   double maintenance_margin_rate = 0// coeficiente del cobro de margen de mantenimiento
   
//--- obtenemos y mostramos en el diario de registro los coeficientes del símbolo SYMBOL_NAME para la orden de mercado Buy
   SymbolInfoMarginRatePrint(SYMBOL_NAMEORDER_TYPE_BUYinitial_margin_ratemaintenance_margin_rate);
   
//--- obtenemos y mostramos en el diario de registro los coeficientes del símbolo SYMBOL_NAME para la orden de mercado Sell
   SymbolInfoMarginRatePrint(SYMBOL_NAMEORDER_TYPE_SELLinitial_margin_ratemaintenance_margin_rate);
 
   /*
   resultado:
   Initial margin rate for symbol AFKS for the Buy market order0.225600
   Maintenance margin rate for symbol AFKS for the Buy market order0.112800
   Initial margin rate for symbol AFKS for the Sell market order0.254400
   Maintenance margin rate for symbol AFKS for the Sell market order0.127200   
   */
  }
//+------------------------------------------------------------------+
//| Mostramos en el registro los coeficientes de cobro de margen     |
//+------------------------------------------------------------------+
void SymbolInfoMarginRatePrint(const string symbolconst ENUM_ORDER_TYPE order_typedouble &initial_margin_ratedouble &maintenance_margin_rate)
  {
//--- obtenemos los coeficientes del símbolo symbol para la orden de mercado order_type
   ResetLastError();
   if(!SymbolInfoMarginRate(symbolorder_typeinitial_margin_ratemaintenance_margin_rate))
     {
      Print("SymbolInfoMarginRate() failed. Error "GetLastError());
      return;
     }
//--- imprimimos los valores obtenidos de los coeficientes
   string type=(order_type==ORDER_TYPE_BUY ? "Buy" : order_type==ORDER_TYPE_SELL ? "Sell" : "Unknown");
   PrintFormat("Initial margin rate for symbol %s for the %s market order: %f\n"+
               "Maintenance margin rate for symbol %s for the %s market order: %f",
               SYMBOL_NAMEtypeinitial_margin_rate,
               SYMBOL_NAMEtypemaintenance_margin_rate);
  }