Drehen und wenden, iMAs versuchen zu betrügen - Seite 9

 
imtochukwu:

Vladimir, ich habe es herausgefunden und es zum Laufen gebracht. Wo kann ich hier Verkaufsaufträge mit Kaufaufträgen vertauschen?

Jedes Signalmodul hat zwei Funktionen, die zur Ausgabe von Kauf- oder Verkaufssignalen verwendet werden. Diese sind "LongCondition" und "ShortCondition".
 
Vladimir Karputov:

Jedes Signalmodul hat zwei Funktionen, die zur Ausgabe von Kauf- oder Verkaufssignalen verwendet werden. Diese sind "LongCondition" und "ShortCondition".


Ich habe verstanden, dass dies in Ihrem EA der Fall ist:

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);
  }
//+------------------------------------------------------------------+‌

und wo ist hier die Linie, die für die Aktion verantwortlich ist? Und wie kann ich diese Eigenschaft ändern?

 
imtochukwu:


Ich verstehe, dass dies in Ihrem EA der Fall ist:

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);
  }
//+------------------------------------------------------------------+‌

und wo ist hier die Linie, die für die Aktion verantwortlich ist? Und wie kann ich diese Eigenschaft ändern?

Bitte fügen Sie den Code korrekt ein:Code korrekt im Forum einfügen

Sie haben den Code NICHT aus dem CODE zitiert, sondern aus dem MODUL SIGNALS.

Sie müssen in meinem Modul nichts ändern, um die Signalrichtung zu ändern, denn es hat eine "Reverse"-Einstellung - je nachdem, welchen Wert diese hat (true oder false), können die Signale direkt umgekehrt werden.

Anhand des Beispiels "LongCondition":

wenn die Umkehrung ("m_reverse") wahr ist und der Schlusskurs abzüglich des Indikatorwertes größer als Null ist - dann geben wir das Signal "Long" (Buy, kaufen)

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:

Bitte fügen Sie den Code korrekt ein:Code korrekt im Forum einfügen

Sie haben den Code NICHT aus dem ADVISOR, sondern aus dem SIGNAL MODULE eingefügt.

Sie müssen nichts ändern, um die Signalrichtung in meinem Modul zu ändern, da es die Einstellung "Reverse" hat - je nachdem, welchen Wert sie hat (true oder false), können die Signale direkt umgekehrt werden.

Anhand des Beispiels "LongCondition":

wenn "m_reverse" wahr ist und der Schlusskurs abzüglich des Indikatorwertes größer als Null ist - dann ist das Signal "Long" (Buy, kaufen)

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, es gibt ein neues Problem. Ihr Expert Advisor wurde kompiliert, aber wenn ich versuche, ihn auf das Diagramm zu ziehen und die Einstellungen zu übernehmen. Ich sehe ein Symbol in der rechten Ecke, das anzeigt, dass der Expert Advisor gestartet wurde. Dann verschwindet er sofort wieder. Was könnte der Grund dafür sein? Diese Umkehrung ist eine gute Sache. Wie kann es in anderen EAs angewendet werden?
 
imtochukwu:

Vladimir, es gibt ein neues Problem. Ihr EA wurde kompiliert, aber wenn ich versuche, ihn auf ein Diagramm zu ziehen und die Einstellungen zu übernehmen. Ich sehe ein Symbol in der rechten Ecke, das anzeigt, dass der EA für eine Weile läuft. Dann verschwindet sie sofort wieder. Was könnte der Grund dafür sein? Diese Umkehrung ist eine gute Sache. Wie kann es auf andere EAs angewendet werden?

Suchen Sie nach Fehlermeldungen im Fenster "Toolbox" des Terminals in den Registerkarten "Experten" und "Journal"...
 

Ich verstehe, dass dies der Abschnitt ist, der für die Eröffnung einer Position verantwortlich ist, wenn "Preis wird steigen" in der Datei 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);
  }


Wenn Sie diesen Code durch den Code Ihres Moduls ersetzen, wird er korrekt funktionieren. Die Sache ist die, dass der Inhalt etwas anders ist als bei Ihnen. Hier gibt es mehr Code... hmm.

 
imtochukwu:

Ich verstehe, dass dies der Abschnitt ist, der für die Eröffnung einer Position verantwortlich ist, wenn "Preis wird steigen" in der Datei 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);
  }


Wenn Sie diesen Code durch den Code Ihres Moduls ersetzen, wird er korrekt funktionieren. Die Sache ist die, dass der Inhalt etwas anders ist als bei Ihnen. Hier gibt es mehr Code... hmm.


Wenn Sie einfach meinen Code nehmen und ihn hier einfügen, wird er nicht funktionieren.
 
Vladimir Karputov:

Wenn Sie einfach meinen Code nehmen und ihn hier einfügen, wird er nicht funktionieren.

Wladimir Karputow:

Wenn Sie einfach meinen Code nehmen und ihn hier einfügen, wird er nicht funktionieren.


Vladimir, wo müssen wir die Rückseite einfügen, damit es funktioniert?

Es ist klar, dass Sie eine Kopie der Datei erstellen und den Namen dieses Einspielers ändern müssen.

 

Wenn Sie die Signale im Standardsignalmodul umkehren möchten:

  • eine Kopie der Datei mit einem anderen Namen erstellen
  • Ändern Sie die Modulbeschreibung

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

  • einfach die Funktionsnamen ändern: LongCondition <--> ShortCondition

 
Vladimir Karputov:

Wenn Sie die Signale im Standardsignalmodul umkehren möchten:

  • eine Kopie der Datei mit einem anderen Namen erstellen
  • Ändern Sie die Modulbeschreibung

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

  • einfach die Funktionsnamen ändern: LongCondition <--> ShortCondition


Vladimir, ich danke Ihnen, Sie waren sehr hilfreich. Nun stellt sich die Frage, wie man die Take-Profit- und Stop-Loss-Aufträge, die der EA erteilt, ausführt. Wie kann ich sie einschränken?
Grund der Beschwerde: