Assista a como baixar robôs de negociação gratuitos

Roteiro interessante?
Então poste um link sobre isto -
deixe que outros avaliem

Você gostou do roteiro? Experimente no terminal MetaTrader 5

Especialistas

ADX System - expert para MetaTrader 5

ADX System | Portuguese English Русский 中文 Español Deutsch 日本語

Publicado por:
Vladimir Karputov
Visualizações:
817
Classificação:
votos: 19
Publicado:
2017.02.01 08:17
Atualizado:
2018.02.16 11:06

Autor da ideia — Collectorautor do código mq5 — barabashkakvn.

Sinais do indicador iADX, Average Directional Movement Index.

Toma de decisões sobre a abertura o fechamento de posições com base nas indicações do iADX:

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

Resultado em EURUSD M15, de 2016.06.01 a 2016.11.24, depósito inicial 10000:

ADX System tester

Traduzido do russo por MetaQuotes Software Corp
código original: https://www.mql5.com/ru/code/17030

Exp_Fractal_ADX_Cloud Exp_Fractal_ADX_Cloud

Sistema de negociação baseada na interseção das linhas DI+ e DI- do indicador Fractal_ADX_Cloud.

Fractal_ADX_HTF Fractal_ADX_HTF

Indicador Fractal_ADX com possibilidade de alterar o timeframe do indicador nos parâmetros de entrada.

TREND_alexcud v_2 TREND_alexcud v_2

No trabalho do Expert Advisor, usam-se 15 indicadores IMA e dois indicadores iAC.

10 pips 10 pips

Expert-scalper. Não são utilizados indicadores no trabalho.