Torciendo y girando, iMA está tratando de engañar - página 9

 
imtochukwu:

Vladimir, lo resolvió y lo puso en marcha. ¿Dónde puedo intercambiar órdenes de venta con órdenes de compra aquí?

Cada módulo de señales tiene dos funciones, que se utilizan para emitir señales de compra o de venta. Se trata de "LongCondition" y "ShortCondition".
 
Vladimir Karputov:

Cada módulo de señales tiene dos funciones, que se utilizan para emitir señales de compra o de venta. Se trata de "LongCondition" y "ShortCondition".


Entiendo que en su EA estos son:

int CSignalMA::LongCondition(void)
  {
   int result=0;
   int idx=StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
   if(m_reverse)
      if(DiffCloseMA(idx)>0.0)
        {
         //--- the close price is above the indicator (the indicator has no objections to buying)
         if(IS_PATTERN_USAGE(0))
            result=m_pattern_0;
        }
   if(!m_reverse)
      if(DiffCloseMA(idx)<0.0)
        {
         //--- the close price is below the indicator (the indicator has no objections to buying)
         if(IS_PATTERN_USAGE(0))
            result=m_pattern_0;
        }
//--- return the result
   return(result);
  }
//+------------------------------------------------------------------+
//| "Voting" that price will fall.                                   |
//+------------------------------------------------------------------+
int CSignalMA::ShortCondition(void)
  {
   int result=0;
   int idx   =StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
   if(m_reverse)
      if(DiffCloseMA(idx)<0.0)
        {
         //--- the close price is below the indicator (the indicator has no objections to buying)
         if(IS_PATTERN_USAGE(0))
            result=m_pattern_0;
        }
   if(!m_reverse)
      if(DiffCloseMA(idx)>0.0)
        {
         //--- the close price is above the indicator (the indicator has no objections to buying)
         if(IS_PATTERN_USAGE(0))
            result=m_pattern_0;
        }
//--- return the result
   return(result);
  }
//+------------------------------------------------------------------+‌

y ¿dónde está la línea responsable de la acción? ¿Y cómo puedo cambiar esta propiedad?

 
imtochukwu:


Entiendo que en su EA esto es así:

int CSignalMA::LongCondition(void)
  {
   int result=0;
   int idx=StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
   if(m_reverse)
      if(DiffCloseMA(idx)>0.0)
        {
         //--- the close price is above the indicator (the indicator has no objections to buying)
         if(IS_PATTERN_USAGE(0))
            result=m_pattern_0;
        }
   if(!m_reverse)
      if(DiffCloseMA(idx)<0.0)
        {
         //--- the close price is below the indicator (the indicator has no objections to buying)
         if(IS_PATTERN_USAGE(0))
            result=m_pattern_0;
        }
//--- return the result
   return(result);
  }
//+------------------------------------------------------------------+
//| "Voting" that price will fall.                                   |
//+------------------------------------------------------------------+
int CSignalMA::ShortCondition(void)
  {
   int result=0;
   int idx   =StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
   if(m_reverse)
      if(DiffCloseMA(idx)<0.0)
        {
         //--- the close price is below the indicator (the indicator has no objections to buying)
         if(IS_PATTERN_USAGE(0))
            result=m_pattern_0;
        }
   if(!m_reverse)
      if(DiffCloseMA(idx)>0.0)
        {
         //--- the close price is above the indicator (the indicator has no objections to buying)
         if(IS_PATTERN_USAGE(0))
            result=m_pattern_0;
        }
//--- return the result
   return(result);
  }
//+------------------------------------------------------------------+‌

y ¿dónde está la línea responsable de la acción? ¿Y cómo puedo cambiar esta propiedad?

Por favor, inserte el código correctamente:Inserte el código correctamente en el foro

Has citado el código NO DESDE EL CÓDIGO, sino desde el MÓDULO DE SEÑALES.

No es necesario cambiar nada en mi módulo para cambiar la dirección de la señal, porque tiene el ajuste "Reverse" - dependiendo del valor que tenga (true o false) las señales pueden ser invertidas directamente.

Utilizando el ejemplo de "LongCondition":

si la inversión ("m_reverse") es verdadera y el precio de cierre menos el valor del indicador es mayor que cero - entonces damos la señal "Long" (Compra, buy)

int CSignalMA::LongCondition(void)
  {
   int result=0;
   int idx=StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
   if(m_reverse)
      if(DiffCloseMA(idx)>0.0)
        {
         //--- the close price is above the indicator (the indicator has no objections to buying)
         if(IS_PATTERN_USAGE(0))
            result=m_pattern_0;
        }
   if(!m_reverse)
      if(DiffCloseMA(idx)<0.0)
        {
         //--- the close price is below the indicator (the indicator has no objections to buying)
         if(IS_PATTERN_USAGE(0))
            result=m_pattern_0;
        }
//--- return the result
   return(result);
  }
 
Vladimir Karputov:

Por favor, inserte el código correctamente:Inserte el código correctamente en el foro

NO has pegado el código del ASESOR, sino del MÓDULO DE SEÑALES.

No es necesario cambiar nada para cambiar la dirección de la señal en mi módulo, porque tiene el ajuste "Reverse" - dependiendo del valor que tenga (true o false) las señales se pueden invertir directamente.

Utilizando el ejemplo de "LongCondition":

si "m_reverse" es verdadero y el precio de cierre menos el valor del indicador es mayor que cero - entonces se da la señal "Long" (Compra, buy)

int CSignalMA::LongCondition(void)
  {
   int result=0;
   int idx=StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
   if(m_reverse)
      if(DiffCloseMA(idx)>0.0)
        {
         //--- the close price is above the indicator (the indicator has no objections to buying)
         if(IS_PATTERN_USAGE(0))
            result=m_pattern_0;
        }
   if(!m_reverse)
      if(DiffCloseMA(idx)<0.0)
        {
         //--- the close price is below the indicator (the indicator has no objections to buying)
         if(IS_PATTERN_USAGE(0))
            result=m_pattern_0;
        }
//--- return the result
   return(result);
  }

Vladimir, hay un nuevo problema. Su Asesor Experto ha compilado, pero cuando trato de arrastrarlo al gráfico y de acuerdo con la configuración. Veo un icono en la esquina derecha que muestra que el Asesor Experto ha sido lanzado. Luego desaparece de inmediato. ¿Cuál puede ser la razón? Esta inversión es buena. ¿Cómo se puede aplicar en otros EA?
 
imtochukwu:

Vladimir, hay un nuevo problema. Su EA ha compilado, pero cuando trato de arrastrarlo a un gráfico y de acuerdo con la configuración. Veo un icono en la esquina derecha que dice que el EA está funcionando durante un tiempo. Luego desaparece de inmediato. ¿Cuál puede ser la razón? Esta inversión es buena. ¿Cómo puede aplicarse a otros EA?

Busque los mensajes de error en la ventana "Caja de herramientas" del terminal en las pestañas "Expertos" y "Diario"...
 

Entiendo que esta es la sección que se encarga de abrir una posición si "el precio va a subir" en el archivo SignalMA.mqh ?

//+------------------------------------------------------------------+
//| "Voting" that price will grow.                                   |
//+------------------------------------------------------------------+
int CSignalMA::LongCondition(void)
  {
   int result=0;
   int idx   =StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
   if(DiffCloseMA(idx)<0.0)
     {
      //--- the close price is below the indicator
      if(IS_PATTERN_USAGE(1) && DiffOpenMA(idx)>0.0 && DiffMA(idx)>0.0)
        {
         //--- the open price is above the indicator (i.e. there was an intersection), but the indicator is directed upwards
         result=m_pattern_1;
         //--- consider that this is an unformed "piercing" and suggest to enter the market at the current price
         m_base_price=0.0;
        }
     }
   else
     {
      //--- the close price is above the indicator (the indicator has no objections to buying)
      if(IS_PATTERN_USAGE(0))
         result=m_pattern_0;
      //--- if the indicator is directed upwards
      if(DiffMA(idx)>0.0)
        {
         if(DiffOpenMA(idx)<0.0)
           {
            //--- if the model 2 is used
            if(IS_PATTERN_USAGE(2))
              {
               //--- the open price is below the indicator (i.e. there was an intersection)
               result=m_pattern_2;
               //--- suggest to enter the market at the "roll back"
               m_base_price=m_symbol.NormalizePrice(MA(idx));
              }
           }
         else
           {
            //--- if the model 3 is used and the open price is above the indicator
            if(IS_PATTERN_USAGE(3) && DiffLowMA(idx)<0.0)
              {
               //--- the low price is below the indicator
               result=m_pattern_3;
               //--- consider that this is a formed "piercing" and suggest to enter the market at the current price
               m_base_price=0.0;
              }
           }
        }
     }
//--- return the result
   return(result);
  }


¿Qué pasa si sustituyes esto por el código de tu módulo, funcionará correctamente? Lo que pasa es que el contenido es ligeramente diferente al suyo. Hay más código aquí... hmm.

 
imtochukwu:

Entiendo que esta es la sección que se encarga de abrir una posición si "el precio va a subir" en el archivo SignalMA.mqh ?

//+------------------------------------------------------------------+
//| "Voting" that price will grow.                                   |
//+------------------------------------------------------------------+
int CSignalMA::LongCondition(void)
  {
   int result=0;
   int idx   =StartIndex();
//--- analyze positional relationship of the close price and the indicator at the first analyzed bar
   if(DiffCloseMA(idx)<0.0)
     {
      //--- the close price is below the indicator
      if(IS_PATTERN_USAGE(1) && DiffOpenMA(idx)>0.0 && DiffMA(idx)>0.0)
        {
         //--- the open price is above the indicator (i.e. there was an intersection), but the indicator is directed upwards
         result=m_pattern_1;
         //--- consider that this is an unformed "piercing" and suggest to enter the market at the current price
         m_base_price=0.0;
        }
     }
   else
     {
      //--- the close price is above the indicator (the indicator has no objections to buying)
      if(IS_PATTERN_USAGE(0))
         result=m_pattern_0;
      //--- if the indicator is directed upwards
      if(DiffMA(idx)>0.0)
        {
         if(DiffOpenMA(idx)<0.0)
           {
            //--- if the model 2 is used
            if(IS_PATTERN_USAGE(2))
              {
               //--- the open price is below the indicator (i.e. there was an intersection)
               result=m_pattern_2;
               //--- suggest to enter the market at the "roll back"
               m_base_price=m_symbol.NormalizePrice(MA(idx));
              }
           }
         else
           {
            //--- if the model 3 is used and the open price is above the indicator
            if(IS_PATTERN_USAGE(3) && DiffLowMA(idx)<0.0)
              {
               //--- the low price is below the indicator
               result=m_pattern_3;
               //--- consider that this is a formed "piercing" and suggest to enter the market at the current price
               m_base_price=0.0;
              }
           }
        }
     }
//--- return the result
   return(result);
  }


¿Qué pasa si sustituyes esto por el código de tu módulo, funcionará correctamente? Lo que pasa es que el contenido es ligeramente diferente al suyo. Hay más código aquí... hmm.


Si tomas mi código y lo pegas aquí, no funcionará.
 
Vladimir Karputov:

Si tomas mi código y lo pegas aquí, no funcionará.

Vladimir Karputov:

Si tomas mi código y lo pegas aquí, no funcionará.


Vladimir, ¿dónde hay que pegar el reverso para que funcione?

Está claro que tendrá que crear una copia del archivo y cambiar el nombre de este inludio.

 

Si desea cambiar las señales a la inversa en el módulo de señales estándar:

  • crear una copia del archivo con un nombre diferente
  • Cambiar la descripción del módulo

// wizard description start
//+------------------------------------------------------------------+
//| Description of the class                                         |
//| Title=***          |
//| Type=SignalAdvanced                                              |
//| Name=Moving Average                                              |

  • simplemente cambiar los nombres de las funciones: LongCondition <--> ShortCondition

 
Vladimir Karputov:

Si desea cambiar las señales a la inversa en el módulo de señales estándar:

  • crear una copia del archivo con un nombre diferente
  • Cambiar la descripción del módulo

// wizard description start
//+------------------------------------------------------------------+
//| Description of the class                                         |
//| Title=***          |
//| Type=SignalAdvanced                                              |
//| Name=Moving Average                                              |

  • simplemente cambiar los nombres de las funciones: LongCondition <--> ShortCondition


Vladimir, gracias, has sido de gran ayuda. Ahora queda la pregunta de cómo hacer las órdenes de Take Profit y Stop Loss que coloca el EA. ¿Cómo puedo hacer que se limiten?
Razón de la queja: