Schau, wie man Roboter kostenlos herunterladen kann
Finden Sie uns auf Telegram!
und werden Sie Mitglied unserer Fangruppe
Interessantes Skript?
Veröffentliche einen Link auf das Skript, damit die anderen ihn auch nutzen können
Hat Ihnen das Skript gefallen?
Bewerten Sie es im Terminal MetaTrader 5
Expert Advisors

ADX System - Experte für den MetaTrader 5

Veröffentlicht:
Vladimir Karputov
Ansichten:
1387
Rating:
(24)
Veröffentlicht:
2017.02.24 10:01
Aktualisiert:
2018.02.16 11:06
Benötigen Sie einen Roboter oder Indikator, der auf diesem Code basiert? Bestellen Sie ihn im Freelance-Bereich Zum Freelance

Autor der Idee — CollectorAutor des mq5 Codes — barabashkakvn.

Signale des iADX Indikators (Average Directional Movement Index).

Das Treffen der Entscheidungen über das Eröffnen oder Schließen von Positionen basiert auf den Wertem des iADX Indikators:

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   double ADXP,ADXC,ADXDIPP;
   double ADXDIPC,ADXDIMP,ADXDIMC;

   ADXP = iADXGet(MAIN_LINE, 2);
   ADXC = iADXGet(MAIN_LINE, 1);
   ADXDIPP = iADXGet(PLUSDI_LINE, 2);
   ADXDIPC = iADXGet(PLUSDI_LINE, 1);
   ADXDIMP = iADXGet(MINUSDI_LINE, 2);
   ADXDIMC = iADXGet(MINUSDI_LINE, 1);

   int total=0;
   for(int i=PositionsTotal()-1;i>=0;i--) // returns the number of open positions
      if(m_position.SelectByIndex(i))
         if(m_position.Symbol()==Symbol() && m_position.Magic()==m_magic)
            total++;

   if(total==0)
     {
      //--- no opened positions identified
      if(m_account.FreeMargin()<(1000*Lots))
        {
         Print("We have no money. Free Margin = ",m_account.FreeMargin());
         return;
        }
      //--- check for long position (BUY) possibility
      if((ADXP<ADXC) && (ADXDIPP<ADXP) && (ADXDIPC>ADXC))
        {
         if(!RefreshRates())
            return;

         if(m_trade.Buy(Lots,m_symbol.Name(),m_symbol.Ask(),m_symbol.Bid()-ExtStopLoss*Point(),
            m_symbol.Ask()+ExtTakeProfit*Point(),"adx sample"))
           {
            Print("BUY order opened : ",m_trade.ResultPrice());
           }
         else
           {
            Print("Error opening BUY. Result Retcode: ",m_trade.ResultRetcode(),
                  ", description of result: ",m_trade.ResultRetcodeDescription(),
                  ", ticket of deal: ",m_trade.ResultDeal());
            return;
           }
        }
      //--- check for short position (SELL) possibility
      if((ADXP<ADXC) && (ADXDIMP<ADXP) && (ADXDIMC>ADXC))
        {
         if(!RefreshRates())
            return;

         if(m_trade.Sell(Lots,m_symbol.Name(),m_symbol.Bid(),m_symbol.Ask()+ExtStopLoss*Point(),
            m_symbol.Bid()-ExtTakeProfit*Point(),"adx sample"))
           {
            Print("SELL order opened : ",m_trade.ResultPrice());
           }
         else
            Print("Error opening Sell. Result Retcode: ",m_trade.ResultRetcode(),
                  ", description of result: ",m_trade.ResultRetcodeDescription(),
                  ", ticket of deal: ",m_trade.ResultDeal());
         return;
        }
      return;
     }

   for(int i=PositionsTotal()-1;i>=0;i--) // returns the number of open positions
      if(m_position.SelectByIndex(i))
         if(m_position.Symbol()==Symbol() && m_position.Magic()==m_magic)
           {
            if(m_position.PositionType()==POSITION_TYPE_BUY) // long position is opened
              {
               if(ADXP>ADXC && ADXDIPP>ADXP && ADXDIPC<ADXC)
                 {
                  m_trade.PositionClose(m_position.Ticket()); // close position
                  return; // exit
                 }
               if(ExtTrailingStop>0)
                 {
                  if(!RefreshRates())
                     return;

                  if(m_symbol.Bid()-m_position.PriceOpen()>Point()*ExtTrailingStop)
                    {
                     if(m_position.StopLoss()<m_symbol.Bid()-Point()*ExtTrailingStop)
                       {
                        m_trade.PositionModify(m_position.Ticket(),m_symbol.Bid()-Point()*ExtTrailingStop,
                                               m_position.TakeProfit());
                        return;
                       }
                    }
                 }
              }
            else
              {
               if(ADXP>ADXC && ADXDIMP>ADXP && ADXDIMC<ADXC)
                 {
                  m_trade.PositionClose(m_position.Ticket()); // close position
                  return; // exit
                 }
               if(ExtTrailingStop>0)
                 {
                  if(!RefreshRates())
                     return;

                  if((m_position.PriceOpen()-m_symbol.Ask())>(Point()*ExtTrailingStop))
                    {
                     if((m_position.StopLoss()>(m_symbol.Ask()+Point()*ExtTrailingStop)) ||
                        (m_position.StopLoss()==0))
                       {
                        m_trade.PositionModify(m_position.Ticket(),m_symbol.Ask()+Point()*ExtTrailingStop,
                                               m_position.TakeProfit());
                        return;
                       }
                    }
                 }
              }
           }
   return;
  }

Die Ergebnisse des Testens auf EURUSD M15, von 2016.06.01 bis 2016.11.24, ursprüngliche Einlage 10000:

ADX System tester

Übersetzt aus dem Russischen von MetaQuotes Ltd.
Originalpublikation: https://www.mql5.com/ru/code/17030

Exp_Fractal_ADX_Cloud Exp_Fractal_ADX_Cloud

Ein Handelssystem, das auf der Kreuzung der Linien DI+ und DI- des Fractal_ADX_Cloud Indikators basiert.

Fractal_ADX_HTF Fractal_ADX_HTF

Der Fractal_ADX Indikator mit der Option, Zeitrahmen in den Eingabeparametern auszuwählen.

TREND_alexcud v_2 TREND_alexcud v_2

Der Expert Advisor verwendet 15 IMA Indikatoren und zwei iAC Indikatoren.

10 pips 10 pips

Pipsing EA. Es werden keine Indikatoren verwendet.