Como eu monto meu conselheiro por tentativa e erro - página 18

 

manualmente ou a partir da linha de tendência comprar

da parada do indicador

EURUSDM1

Acabei de afinar um pouco o Expert Advisor.

Arquivos anexados:
2.mq5  17 kb
Hand_support.mq5  160 kb
 
Aleksandr Klapatyuk:

manualmente ou a partir da linha de tendência comprar

da parada do indicador

Acabei de afinar um pouco o Expert Advisor.

...

espero que você tenha a resposta para sua pergunta sobre a configuração do mt4 ... :-)

 
Roman Shiredchenko:

...

espero que sua pergunta tenha sido respondida pelo endereço de instalação do mt4. :-)

Sim! Obrigado!

 

mudou um pouco.

Reverso - inversão de um sinal comercial.

para o indicador tem sua própria inversão. para a linha de tendência de compra tem sua própria inversão.

e separadamente para a linha de tendência para fechar a posição a inversão.

Exemplo: desenhar vender linha de tendência - assim que o preço tocar a linha - comprar sinal

GBPUSDM5

na seguinte imagem - a linha de tendência desencadeou a venda - e fez uma compra

o inverso foi acionado

input string   t7="------ ТРЕНД ЛИНИЯ ------";        // 
input bool     InpReverse0          = true;          // Reverse Open - переворот торгового сигнала

GBPUSDM5

sinput string  t1="------ Как работать Эксперту---";  //    
input double   InpLots              = 0.01;           // Lots
input bool     InpPanel             = true;           // Скрыть кнопки\\по времени Buy\Sell
input bool     InpOnlyLimit         = false;          // Выставить отложенный ордер 
input bool     InpOnlystart         = true;           // Вкл. Buy\Sell
input bool     InpCloseOpposite     = false;          // Вкл.Trailing Stop по индикатору\Close opposite 
input bool     InpReverse           = false;          // Reverse Indicators - переворот торгового сигнала
input string   t7="------ ТРЕНД ЛИНИЯ ------";        // 
input bool     InpReverse0          = false;          // Reverse Open - переворот торгового сигнала
input string   BuyStop_TrendName    = "buy";          // Trend Line Name "buy";
input string   SellStop_TrendName   = "sell";         // Trend Line Name "sell";
input string   BuyClose_TrendName   = "closesell";    // Trend Line Name "closesell";
input string   SellClose_TrendName  = "closebuy";     // Trend Line Name "closebuy";
input bool     InpReverse1          = false;          // Reverse Close - переворот торгового сигнала
//+------------------------------------------------------------------+
Совершение сделок - Торговые операции - MetaTrader 5
Совершение сделок - Торговые операции - MetaTrader 5
  • www.metatrader5.com
Торговая деятельность в платформе связана с формированием и отсылкой рыночных и отложенных ордеров для исполнения брокером, а также с управлением текущими позициями путем их модификации или закрытия. Платформа позволяет удобно просматривать торговую историю на счете, настраивать оповещения о событиях на рынке и многое другое. Открытие позиций...
Arquivos anexados:
Hand_support.mq5  161 kb
2.mq5  17 kb
 
Tudo para operação manual
Arquivos anexados:
 

algo precisa ser feito - com a linha de tendência no final

a linha de tendência não funcionou com o inverso

mas Take Profit trabalhou em pips

EURGBPH2

Общие принципы - Торговые операции - MetaTrader 5
Общие принципы - Торговые операции - MetaTrader 5
  • www.metatrader5.com
Перед тем как приступить к изучению торговых функций платформы, необходимо создать четкое представление об основных терминах: ордер, сделка и позиция. — это распоряжение брокерской компании купить или продать финансовый инструмент. Различают два основных типа ордеров: рыночный и отложенный. Помимо них существуют специальные ордера Тейк Профит...
 
Aleksandr Klapatyuk:

algo precisa ser feito - com a linha de tendência no final

a linha de tendência não funcionou com o inverso.



Não sei se entendi bem.

mas o que é, tudo isso está funcionando.

Tudo bem - estou farto de todos.

Má disposição para a chuva.

Arquivos anexados:
Hand_support.mq5  161 kb
 

Acrescentou outra função.

ofechamento da posição abrirá na direção oposta

//+------------------------------------------------------------------+
//| TradeTransaction function                                        |
//+------------------------------------------------------------------+
void OnTradeTransaction(const MqlTradeTransaction &Trans,const MqlTradeRequest &Request_,const MqlTradeResult &Result_)
  {
//--- get transaction type as enumeration value
   ENUM_TRADE_TRANSACTION_TYPE type=Trans.type;
//--- if transaction is result of addition of the transaction in history
   static bool Flag=true;
   if(Flag)
      if(inpbuysell)
         if(type==TRADE_TRANSACTION_DEAL_ADD)
           {
            long     deal_type         =-1;
            long     deal_entry        =-1;
            double   deal_volume       =0.0;
            string   deal_symbol       =NULL;
            if(HistoryDealSelect(Trans.deal))
              {
               deal_type         =HistoryDealGetInteger(Trans.deal,DEAL_TYPE);
               deal_entry        =HistoryDealGetInteger(Trans.deal,DEAL_ENTRY);
               deal_volume       =HistoryDealGetDouble(Trans.deal,DEAL_VOLUME);
               deal_symbol       =HistoryDealGetString(Trans.deal,DEAL_SYMBOL);
              }
            else
               return;
            if(deal_entry==DEAL_ENTRY_OUT)
              {
               switch((int)deal_type)
                 {
                  case  DEAL_TYPE_BUY:
                     ExtTrade.Buy(deal_volume,deal_symbol);
                     break;
                  case  DEAL_TYPE_SELL:
                     ExtTrade.Sell(deal_volume,deal_symbol);
                     break;
                  default:
                     break;
                     Flag=false;
                 }
              }
           }
  }
//+------------------------------------------------------------------+
Arquivos anexados:
 
Aleksandr Klapatyuk:

Acrescentou outra função.

Quando você fecha uma posição, ela se abre na direção oposta

Se abre, abre...

Mas em todos os pares - que estão abertos.

------------------------------------------------------------------

Eu corrigi um pouco - para fazer o trabalho inverso em cada par - separadamente

//+------------------------------------------------------------------+
//| TradeTransaction function                                        |
//+------------------------------------------------------------------+
void OnTradeTransaction(const MqlTradeTransaction &Trans,const MqlTradeRequest &Request_,const MqlTradeResult &Result_)
  {
//--- if transaction is result of addition of the transaction in history
   static bool Flag=true;
//--- get transaction type as enumeration value
   ENUM_TRADE_TRANSACTION_TYPE type=Trans.type;
   if(Flag && inpbuysell)
      if(type==TRADE_TRANSACTION_DEAL_ADD)
        {
         long     deal_type         =-1;
         long     deal_entry        =-1;
         double   deal_volume       =0.0;
         string   deal_symbol       =deal_symb;
         if(HistoryDealSelect(Trans.deal))
           {
            deal_type         =HistoryDealGetInteger(Trans.deal,DEAL_TYPE);
            deal_entry        =HistoryDealGetInteger(Trans.deal,DEAL_ENTRY);
            deal_volume       =HistoryDealGetDouble(Trans.deal,DEAL_VOLUME);
            deal_symbol       =HistoryDealGetString(Trans.deal,DEAL_SYMBOL);
           }
         else
            return;
         if(deal_entry==DEAL_ENTRY_OUT && deal_symbol==deal_symb)
           {
            switch((int)deal_type)
              {
               case  DEAL_TYPE_BUY:
                  ExtTrade.Buy(deal_volume,deal_symbol);
                  break;
               case  DEAL_TYPE_SELL:
                  ExtTrade.Sell(deal_volume,deal_symbol);
                  break;
               default:
                  break;
                  Flag=false;
              }
           }
        }
  }
//+------------------------------------------------------------------+
Arquivos anexados:
 

arrasto em um caminho ParabolicSAR a partir do

//+------------------------------------------------------------------+
//|                                         TrailingParabolicSAR.mq5 |
//|                        Copyright 2019, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2019, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Include                                                          |
//+------------------------------------------------------------------+
#include <Expert\Expert.mqh>
#include <Expert\Trailing\TrailingParabolicSAR.mqh>
//+------------------------------------------------------------------+
//| Inputs                                                           |
//+------------------------------------------------------------------+
//--- inputs for trailing
input double Trailing_ParabolicSAR_Step   =0.02;  // Speed increment
input double Trailing_ParabolicSAR_Maximum=0.2;   // Maximum rate
//---
bool         Expert_EveryTick=false;
//+------------------------------------------------------------------+
//| Global expert object                                             |
//+------------------------------------------------------------------+
CExpert ExtExpert;
//+------------------------------------------------------------------+
//| Initialization function of the expert                            |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- Initializing expert
   if(!ExtExpert.Init(Symbol(),Period(),Expert_EveryTick,0))
     {
      //--- failed
      printf(__FUNCTION__+": error initializing expert");
      ExtExpert.Deinit();
      return(-1);
     }
//--- Creation of trailing object
   CTrailingPSAR *trailing=new CTrailingPSAR;
   if(trailing==NULL)
     {
      //--- failed
      printf(__FUNCTION__+": error creating trailing");
      ExtExpert.Deinit();
      return(INIT_FAILED);
     }
//--- Add trailing to expert (will be deleted automatically))
   if(!ExtExpert.InitTrailing(trailing))
     {
      //--- failed
      printf(__FUNCTION__+": error initializing trailing");
      ExtExpert.Deinit();
      return(INIT_FAILED);
     }
//--- Set trailing parameters
   trailing.Step(Trailing_ParabolicSAR_Step);
   trailing.Maximum(Trailing_ParabolicSAR_Maximum);
//--- Tuning of all necessary indicators
   if(!ExtExpert.InitIndicators())
     {
      //--- failed
      printf(__FUNCTION__+": error initializing indicators");
      ExtExpert.Deinit();
      return(INIT_FAILED);
     }
//--- ok
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Deinitialization function of the expert                          |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   ExtExpert.Deinit();
  }
//+------------------------------------------------------------------+
//| "Tick" event handler function                                    |
//+------------------------------------------------------------------+
void OnTick()
  {
   ExtExpert.OnTick();
  }
//+------------------------------------------------------------------+
//| "Trade" event handler function                                   |
//+------------------------------------------------------------------+
void OnTrade()
  {
   ExtExpert.OnTrade();
  }
//+------------------------------------------------------------------+
//| "Timer" event handler function                                   |
//+------------------------------------------------------------------+
void OnTimer()
  {
   ExtExpert.OnTimer();
  }
//+------------------------------------------------------------------+

Verificado - funciona.

Alpari MT5

Arquivos anexados:
Razão: