ACCOUNT_MARGIN_SO_SO

 

El valor que da este parámetro en la función...

AccountInfoDouble(ACCOUNT_MARGIN_SO_SO);

puede ser absoluto o en porcentaje, ¿sobre qué valor se aplica ese porcentaje?. ¿Sobre el balance inicial, sobre el actual o sobre otro parámetro?.

No lo dice la ayuda. 

 
josemiguel1812 :

El valor que da este parámetro en la función...

puede ser absoluto o en porcentaje, ¿sobre qué valor se aplica ese porcentaje?. ¿Sobre el balance inicial, sobre el actual o sobre otro parámetro?.

No lo dice la ayuda. 

Se trata de margen, por lo que es el margen en la divisa de depósito o margen en porcentaje.

Nivel de Margen (%) = Patrimonio / Margen.

 
angevoyageur:

Se trata de margen, por lo que es el margen en la divisa de depósito o margen en porcentaje.

Nivel de Margen (%) = Patrimonio / Margen.

¿Entonces está función está mal?

//------------------------------- NIVEL CIERRE FORZOSO o Stop Out -----------------------------------
double nivelCierreStopOut()
{
   double nivelStop= AccountInfoDouble(ACCOUNT_MARGIN_SO_SO);
   ENUM_ACCOUNT_STOPOUT_MODE modoSO= (ENUM_ACCOUNT_STOPOUT_MODE)AccountInfoInteger(ACCOUNT_MARGIN_SO_MODE);
   if(modoSO==ACCOUNT_STOPOUT_MODE_PERCENT) nivelStop= nivelStop*balanceCuenta();
   return(nivelStop);
}
//---------------------------- BALANCE ACTUAL de la CUENTA ----------------------
double balanceCuenta()
{              //balance actual
   double balanc;
   balanc= AccountInfoDouble(ACCOUNT_BALANCE);
   return(balanc);
}
 
josemiguel1812:

¿Entonces está función está mal?

Sí, el Stopout es relacion con Margen, no con Balance.
 
angevoyageur:
Sí, el Stopout es relacion con Margen, no con Balance.

Entonces, la línea de código correcta debería ser...

if(modoSO==ACCOUNT_STOPOUT_MODE_PERCENT) nivelStop= nivelStop*AccountInfoDouble(ACCOUNT_MARGIN);

¿o con?...

AccountInfoDouble(ACCOUNT_FREEMARGIN)
 
josemiguel1812:

Entonces, la línea de código correcta debería ser...

¿o con?...

En realidad no.

Si el valor es un porcentaje, debe ser comparado con el % de margen AccountInfoDouble(ACCOUNT_MARGIN_LEVEL), de lo contrario con margen AccountInfoDouble(ACCOUNT_MARGIN).

   if(modoSO==ACCOUNT_STOPOUT_MODE_PERCENT)
   {
      if(AccountInfoDouble(ACCOUNT_MARGIN_LEVEL) <= AccountInfoDouble(ACCOUNT_MARGIN_SO_SO))
         //--- !!!! StopOut
         ...
   }
   else
   {
      if(AccountInfoDouble(ACCOUNT_MARGIN) <= AccountInfoDouble(ACCOUNT_MARGIN_SO_SO))
         //--- !!!! StopOut
         ...
   }


Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Account Properties
Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Account Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Environment State / Account Properties - Documentation on MQL5
 
angevoyageur:

En realidad no.

Si el valor es un porcentaje, debe ser comparado con el % de margen AccountInfoDouble(ACCOUNT_MARGIN_LEVEL), de lo contrario con margen AccountInfoDouble(ACCOUNT_MARGIN).


Disculpe Alain:

Busco el obtener ACCOUNT_MARGIN_SO_SO en valor absoluto siempre, aún cuando el broker lo de en porcentaje. Por eso, si el broker informa en porcentaje aplico la línea...

if(modoSO==ACCOUNT_STOPOUT_MODE_PERCENT) nivelStop= nivelStop*????????();

 donde sigo con la duda de qué función es ?????????()

 
josemiguel1812 :

Disculpe Alain:

Busco el obtener  ACCOUNT_MARGIN_SO_SO en valor absoluto siempre, aún cuando el broker lo de en porcentaje. Por eso, si el broker informa en porcentaje aplico la línea...

 donde sigo con la duda de qué función es ?????????()

Que ya he respondido ...

       if ( AccountInfoDouble ( ACCOUNT_MARGIN_LEVEL ) <= AccountInfoDouble ( ACCOUNT_MARGIN_SO_SO ))
         //--- !!!! StopOut 

y

Nivel de Margen (%) = Patrimonio / Margen.

Así que le toca a ti ahora.

 
angevoyageur:

Que ya he respondido ...

y

Así que le toca a ti ahora.

Je suis un âne ...

A ver si ahora acierto

//------------------------------- CAPITAL MÍNIMO PARA CIERRE FORZOSO o Stop Out -----------------------------------
double nivelCierreStopOut()
{     //%nivelSO= equity / margen; AccountInfoDouble(ACCOUNT_EQUITY) / AccountInfoDouble(ACCOUNT_MARGIN)
   double nivelStop= AccountInfoDouble(ACCOUNT_MARGIN_SO_SO);
   ENUM_ACCOUNT_STOPOUT_MODE modoSO= (ENUM_ACCOUNT_STOPOUT_MODE)AccountInfoInteger(ACCOUNT_MARGIN_SO_MODE);
   if(modoSO==ACCOUNT_STOPOUT_MODE_PERCENT) nivelStop= AccountInfoDouble(ACCOUNT_EQUITY) / nivelStop;
   return(nivelStop);
}
 
josemiguel1812:

Je suis un âne ...

A ver si ahora acierto

Razón de la queja: