Come ho assemblato il mio consulente per tentativi ed errori - pagina 18

 

manualmente o dalla linea di tendenza acquistare

dall'arresto dell'indicatore

EURUSDM1

Ho appena modificato un po' l'Expert Advisor.

File:
2.mq5  17 kb
Hand_support.mq5  160 kb
 
Aleksandr Klapatyuk:

manualmente o dalla linea di tendenza acquistare

dall'arresto dell'indicatore

Ho appena modificato un po' l'Expert Advisor.

...

spero che tu abbia ottenuto la risposta alla tua domanda sul setup di mt4 ... :-)

 
Roman Shiredchenko:

...

spero che la tua domanda abbia trovato risposta nell'indirizzo di installazione di mt4... :-)

Sì, grazie!

 

è cambiato un po'.

Reverse - inversione di un segnale di trading.

per l'indicatore ha la sua inversione. per la linea di tendenza a comprare ha la sua inversione.

e separatamente per la linea di tendenza per chiudere la posizione l'inversione.

Esempio: disegnare la trendline di vendita - non appena il prezzo tocca la linea - segnale di acquisto

GBPUSDM5

sulla seguente immagine - la linea di tendenza ha innescato la vendita - e ha fatto un acquisto

l'inversione è stata innescata

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
Торговая деятельность в платформе связана с формированием и отсылкой рыночных и отложенных ордеров для исполнения брокером, а также с управлением текущими позициями путем их модификации или закрытия. Платформа позволяет удобно просматривать торговую историю на счете, настраивать оповещения о событиях на рынке и многое другое. Открытие позиций...
File:
Hand_support.mq5  161 kb
2.mq5  17 kb
 
Tutto per il funzionamento manuale
File:
 

qualcosa deve essere fatto - con la linea di tendenza sulla chiusura

la linea di tendenza non ha funzionato con l'inverso

ma Take Profit ha lavorato sui pip

EURGBPH2

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

qualcosa deve essere fatto - con la linea di tendenza sulla chiusura

la linea di tendenza non ha funzionato con l'inverso.



Non so se ho capito bene.

ma quello che è, funziona tutto.

Va bene - ne ho abbastanza di tutti.

Pioggia di cattivo umore.

File:
Hand_support.mq5  161 kb
 

Aggiunta un'altra funzione.

chiudendo la posizione si aprirà nella direzione opposta

//+------------------------------------------------------------------+
//| 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;
                 }
              }
           }
  }
//+------------------------------------------------------------------+
File:
 
Aleksandr Klapatyuk:

Aggiunta un'altra funzione.

Quando si chiude una posizione, si apre nella direzione opposta

Se si apre, si apre -

Ma su tutte le coppie - che sono aperte.

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

L'ho corretto un po' - per far funzionare il reverse su ogni coppia - separatamente

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

pesca a strascico in modo ParabolicSAR dalla termica

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

Controllato - funziona.

Alpari MT5

Motivazione: