Lavaggio del cervello: sviluppo del sistema - pagina 5

 

Idea # due punto di partenza (solo per il futuro)

Sto continuando a testare manualmente questa idea con iTrend, PriceChannel_Stop_v1 e T3 TRIX (ROC di T6).mq4 indicatore. Vedi le regole che ho selezionato per il test manuale https://www.mql5.com/en/forum/172979/page3

e si possono trovare anche alcune dichiarazioni.

Questa idea funziona. È l'idea #1.

Ma forexts ha detto di un'altra idea: confermare il segnale di vendita o acquisto da PriceChannel_Stop_v1 non su 0 o 1 barra. Significa prendere in considerazione l'indicatore iTrend dopo che l'ordine è stato aperto. Per ottenere più profitto.

Sarà l'idea n. 2. Penso che finiremo prima con questa idea # 1 e inizieremo a sviluppare un'altra idea # 2. Ma voglio mostrarvi come la curva del prezzo (linea bianca) si sta muovendo attraverso l'indicatore iTrend. Non ne so nulla. Non ho nemmeno pensato. Non ancora. Ho appena postato qui l'immagine perché posso dimenticare e per avere qualche punto di partenza per lo sviluppo di idea # 2.

File:
bw1_idea2.gif  23 kb
 

Lavaggio del cervello su D1 timeframe.

Vedere le immagini.

Solo per ricordare questo sistema di trading molto semplice.

Ho scambiato questo sistema su M15 durante molti mesi. E poi abbiamo creato molti EAs. Per gli EAs e le regole vai a questo thread https://www.mql5.com/en/forum/173031

Ma non ho mai testato questo semplice sistema su timeframe D1.

 

Il sistema di lavaggio del cervello è sempre stato buono per la coppia USDCHF.

Vedi l'esempio dei recenti trade per questa coppia su timeframe H4.

File:
 

Nel post #43 potete vedere alcune immagini del sistema Brainwashing su timeframe D1.

Possiamo vedere su GBPUSD che la barra del 22 novembre è stata chiusa con un segnale. Si prega di notare che stiamo facendo trading sulla barra di chiusura.

Tutte le spiegazioni e i risultati si possono vedere dall'immagine.

Uso il livello = 0.008 per l'indicatore iTrend per il timeframe D1 per GBPUSD. Naturalmente dovrebbe essere rivisto periodicamente in quanto è la regola principale di questo sistema.

File:
gbpusd1_d1.gif  26 kb
 
newdigital:
Sul post #43 potete vedere alcune immagini del sistema Brainwashing su timeframe D1.

Possiamo vedere su GBPUSD che la barra del 22 novembre è stata chiusa con segnale. Si prega di notare che stiamo facendo trading sulla barra di chiusura.

Tutte le spiegazioni e i risultati li potete vedere nell'immagine.

Io uso il livello = 0.008 per l'indicatore iTrend su timeframe D1 per GBPUSD. Naturalmente dovrebbe essere rivisto periodicamente in quanto è la regola principale di questo sistema.

E alcuni trade su altre coppie.

Uso il livello = 0.008 per l'indicatore iTrend per EURUSD D1; 0.006 per USDCHF D1 e 0.6 per USDJPY D1.

E per favore leggi questo post https://www.mql5.com/en/forum/173031 su come stimare il livello dell'indicatore iTrend. Penso che tutti coloro che stanno usando questo sistema Brainwashing dovrebbero stimare il livello perché questo livello dipende dal broker. Ciò significa che, probabilmente, avrete un valore diverso dell'indicatore iTrend (diverso dalle immagini allegate).

Tutte le spiegazioni si possono trovare nelle immagini.

File:
eurusd1_d1.gif  23 kb
usdchf1_d1.gif  24 kb
usdjpy1_d1.gif  26 kb
 

Questo, il canale dei prezzi è migliore

 
/*
//----+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+ 
//Version  July 1, 2006                                              |
Editing   Nikolay Kositsin  15.06.2006  farria@mail.redcom.ru        |
//----+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+ 
*/ 
//+------------------------------------------------------------------+
//|                                            PriceChannel_StopNK.mq4 | 
//|                           Copyright © 2005, TrendLaboratory Ltd. | 
//|                                       E-mail: igorad2004@list.ru | 
//+------------------------------------------------------------------+ 
#property copyright "Copyright © 2005, TrendLaboratory Ltd." 
#property link "E-mail: igorad2004@list.ru" 
//---- îòðèñîâêà èíäèêàòîðà â ãëàâíîì îêíå
#property indicator_chart_window 
//---- êîëè÷åñòâî èíäèêàòîðíûõ áóôôåðîâ
#property indicator_buffers 6 
//---- öâåòà èíäèêàòîðà
#property indicator_color1 Yellow 
#property indicator_color2 Magenta
#property indicator_color3 Lime 
#property indicator_color4 Red 
#property indicator_color5 Lime 
#property indicator_color6 Red  
//---- òîëùèíà èíäèêàòîðíûõ ëèíèé
#property indicator_width1 0
#property indicator_width2 0
#property indicator_width3 2
#property indicator_width4 2
#property indicator_width5 0
#property indicator_width6 0
//---- ÂÕÎÄÍÛÅ ÏÀÐÀÌÅÒÐÛ ÈÍÄÈÊÀÒÎÐÀ þþþþþþææ+ 

// double signal_up = iCustom(NULL,0,"Price ChannelNK", ChannelPeriod,Risk, Signal, Line, Shift,2,1 );



extern int ChannelPeriod=5; 
extern double       Risk=0.10; 
extern bool       Signal=true;
extern bool        Line =true; 
//---- æææææææææææææææææææææææææææææææææææææ+
//---- èíäèêàòîðíûå áóôôåðû
double UpTrendBuffer  []; 
double DownTrendBuffer[]; 
double UpTrendSignal  []; 
double DownTrendSignal[]; 
double UpTrendLine    []; 
double DownTrendLine  [];  
//+------------------------------------------------------------------+
//| PriceChannel_Stop initialization function                        | 
//+------------------------------------------------------------------+
int init() 
{ 
string short_name; 
//---- 6 èíäèêàòîðíûõ áóôôåðà èñïîëüçîâàíû äëÿ ñ÷¸òà
SetIndexBuffer(0,UpTrendBuffer); 
SetIndexBuffer(1,DownTrendBuffer); 
SetIndexBuffer(2,UpTrendSignal); 
SetIndexBuffer(3,DownTrendSignal); 
SetIndexBuffer(4,UpTrendLine); 
SetIndexBuffer(5,DownTrendLine); 
//---- Ñòèëü èñïîëíåíèÿ ãðàôèêà
SetIndexStyle(0,DRAW_ARROW); 
SetIndexStyle(1,DRAW_ARROW); 
SetIndexStyle(2,DRAW_ARROW); 
SetIndexStyle(3,DRAW_ARROW); 
SetIndexStyle(4,DRAW_LINE); 
SetIndexStyle(5,DRAW_LINE); 
SetIndexArrow(0,159); 
SetIndexArrow(1,159); 
SetIndexArrow(2,108); 
SetIndexArrow(3,108); 
//---- óñòàíîâêà çíà÷åíèé èíäèêàòîðà, êîòîðûå íå áóäóò âèäèìû íà ãðàôèêå
SetIndexEmptyValue(0,0.0);
SetIndexEmptyValue(1,0.0);
SetIndexEmptyValue(2,0.0);
SetIndexEmptyValue(3,0.0);
SetIndexEmptyValue(4,0.0);
SetIndexEmptyValue(5,0.0);
//---- èìÿ äëÿ îêîí äàííûõ è ëýéáà äëÿ ñóáúîêîí
short_name="PriceChannel_Stop_v1("+ChannelPeriod+")"; 
IndicatorShortName(short_name); 
SetIndexLabel(0,"UpTrend Stop"); 
SetIndexLabel(1,"DownTrend Stop"); 
SetIndexLabel(2,"UpTrend Signal"); 
SetIndexLabel(3,"DownTrend Signal"); 
SetIndexLabel(4,"UpTrend Line"); 
SetIndexLabel(5,"DownTrend Line"); 
//---- óñòàíîâêà íîìåðà áàðà, íà÷èíàÿ ñ êîòîðîãî áóäåò îòðèñîâûâàòüñÿ èíäèêàòîð 
SetIndexDrawBegin(0,ChannelPeriod); 
SetIndexDrawBegin(1,ChannelPeriod); 
SetIndexDrawBegin(2,ChannelPeriod); 
SetIndexDrawBegin(3,ChannelPeriod); 
SetIndexDrawBegin(4,ChannelPeriod); 
SetIndexDrawBegin(5,ChannelPeriod); 
//---- Óñòàíîâêà ôîðìàòà òî÷íîñòè (êîëè÷åñòâî çíàêîâ ïîñëå äåñÿòè÷íîé òî÷êè) äëÿ âèçóàëèçàöèè çíà÷åíèé èíäèêàòîðà  
IndicatorDigits(Digits);
//---- çàâåðøåíèå èíèöèàëèçàöèè
return(0); 
}
//+------------------------------------------------------------------+
//| PriceChannel_Stop                                                | 
//+------------------------------------------------------------------+
int start() 
{ 
//---- ïðîâåðêà êîëè÷åñòâà áàðîâ íà äîñòàòî÷íîñòü äëÿ ðàñ÷¸òà
if (Bars-1<ChannelPeriod+1)return(0);
//----+ Ââåäåíèå ïåðåìåííûõ ñ ïëàâàþùåé òî÷êîé
double bsmax[1],bsmin[1],high,low,price,dprice; 
//---- ââåäåíèå ïåðåìåííûõ ïàìÿòè  
static int time2,TREND;static double BSMAX,BSMIN;
//----+ Ââåäåíèå öåëûõ ïåðåìåííûõ è ïîëó÷åíèå óæå ïîñ÷èòàííûõ áàðîâ
int trend,MaxBar,bar,limit,ii,counted_bars=IndicatorCounted();
//---- ïðîâåðêà íà âîçìîæíûå îøèáêè
if (counted_bars<0)return(-1);
//---- ïîñëåäíèé ïîñ÷èòàííûé áàð äîëæåí áûòü ïåðåñ÷èòàí 
if (counted_bars>0) counted_bars--;
//---- îïðåäåëåíèå íîìåðà ñàìîãî ñòàðîãî áàðà, íà÷èíàÿ ñ êîòîðîãî áóäåò ïðîèçåä¸í ïåðåñ÷¸ò íîâûõ áàðîâ 
MaxBar=Bars-1-ChannelPeriod-1;
limit=Bars-counted_bars-1; 
//---- èíèöèàëèçàöèÿ íóëÿ
if (limit>MaxBar)
      {
       for (bar=limit;bar>=MaxBar;bar--) 
        { 
         UpTrendBuffer  [bar]=0.0; 
         DownTrendBuffer[bar]=0.0; 
         UpTrendSignal  [bar]=0.0; 
         DownTrendSignal[bar]=0.0; 
         UpTrendLine    [bar]=0.0; 
         DownTrendLine  [bar]=0.0; 
        } 
       limit=MaxBar;
      }
//---- èçìåíåíèå ðàçìåðîâ âðåìåííûõ áóôôåðîâ 
if(ArrayResize(bsmax,limit+2)!=limit+2)return(-1);
if(ArrayResize(bsmin,limit+2)!=limit+2)return(-1);
//---- ïðåäâàðèòåëüíûé öèêë ðàñ÷¸òà âðåìåííûõ áóôôåðîâ 
for (bar=limit;bar>=0;bar--) 
  { 
   high=High[bar]; 
   low =Low [bar]; 
   ii=bar-1+ChannelPeriod; 
   while(ii>=bar) 
    { 
     price=High[ii]; 
     if(high<price)high=price; 
     price=Low[ii]; 
     if(low>price) low=price; 
     ii--; 
    } 
  dprice=(high-low)*Risk;
  bsmax[bar]=high-dprice; 
  bsmin[bar]=low +dprice;
 }
//----
int Tnew=Time[limit+1];
//+--- âîññòàíîâëåíèå çíà÷åíèé ïåðåìåííûõ +======+
if (limit<MaxBar)
  if (Tnew==time2)
   {
     bsmax[limit+1]=BSMAX;
     bsmin[limit+1]=BSMIN;
     trend=TREND;
   } 
  else 
   {
    if (Tnew>time2)Print("Îøèáêà âîññòàíîâëåíèÿ ïåðåìåííûõ. Tnew>time2");
              else Print("Îøèáêà âîññòàíîâëåíèÿ ïåðåìåííûõ. Tnew<time2");
    Print("Áóäåò ïðîèçâåä¸í ïåðåñ÷¸ò èíäèêàòîðà íà âñåõ áàðàõ");
    return(-1); 
   }
//+--- +==========================================+

//---- îñíîâíîé öèêë ðàñ÷¸òà èíäèêàòîðà
for (bar=limit;bar>=0;bar--) 
 { 
  //+--- Ñîõðàíåíèå çíà÷åíèé ïåðåìåííûõ +====+ 
   if (bar==1)
    {
     if(((limit==1)&&(time2==Time[2]))||(limit>1))
       {
         time2=Time [2];
         BSMAX=bsmax[2]; 
         BSMIN=bsmin[2];
         TREND=trend;
       }
    }
  //+---+====================================+     
   //----
   UpTrendBuffer  [bar]=0.0; 
   DownTrendBuffer[bar]=0.0; 
   UpTrendSignal  [bar]=0.0; 
   DownTrendSignal[bar]=0.0; 
   UpTrendLine    [bar]=0.0; 
   DownTrendLine  [bar]=0.0; 
   //----
  if (Close[bar]>bsmax[bar+1])trend= 1; 
  if (Close[bar]<bsmin[bar+1])trend=-1; 
  //----
  if(trend>0 && bsmin[bar]<bsmin[bar+1]) bsmin[bar]=bsmin[bar+1]; 
  if(trend<0 && bsmax[bar]>bsmax[bar+1]) bsmax[bar]=bsmax[bar+1]; 
  //---- +++
  if (trend>0) 
   { 
     price=bsmin[bar];
    if (Signal==true && DownTrendBuffer[bar+1]>0) 
     { 
      UpTrendSignal[bar]=price; 
      if(Line==true) UpTrendLine[bar]=price; 
     } 
    else 
     { 
      UpTrendBuffer[bar]=price; 
      if(Line==true) UpTrendLine[bar]=price; 
     }
  }  
 //---- +++
 if (trend<0) 
  { 
   price=bsmax[bar];
   if (Signal==true && UpTrendBuffer[bar+1]>0) 
    { 
     DownTrendSignal[bar]=price;
     if(Line==true) DownTrendLine[bar]=price; 
    } 
   else 
    { 
     DownTrendBuffer[bar]=price;
     if(Line==true) DownTrendLine[bar]=price;
    } 
  } 
  //---- +++
 } 
//----
return(0); 
}
//+------------------------------------------------------------------+

 

Ecco un EA di base per questo indicatore:

//+------------------------------------------------------------------+
//|                                          EA_Price_Channel_NK.mq4 |
//|                        Copyright 2018, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict

extern bool open_buy = true;
extern bool open_sell = true;

 extern int  MagicNumber   = 451;
 extern  double StopLoss   = 135;
 extern  double TakeProfit = 400;
 extern  double lots       = 0.1; 
 string Text ; 
extern int Tral_Stop      = 180;                       

 // double signal_up = iCustom(NULL,0,"Price ChannelNK", ChannelPeriod,Risk, Signal, Line, Shift,2,1 );

extern int ChannelPeriod=5; 
extern double       Risk=0.10; 
extern bool       Signal=true;
extern bool        Line =true; 

datetime time0; 
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   if( time0 == Time[0] ) return;
       time0= Time[0];
   
   if( count_tip(OP_BUY) > 0 ) trailing_stop();
   if( count_tip(OP_SELL) > 0 ) trailing_stop();
   
   
    double signal_up = iCustom(NULL,0,"Price ChannelNK", ChannelPeriod,Risk, Signal, Line, 2,1 );
    double sl_buy = MathMin( Bid - StopLoss*Point, signal_up );
      
      
       if( signal_up != 0.0 && open_buy && count_tip(OP_BUY ) == 0 )
         {
          int ticket_buy = OrderSend(_Symbol, OP_BUY, lots, Ask, 3, sl_buy, Ask +TakeProfit*Point, "RsiEma", MagicNumber);
         }
  
  
    double signal_down = iCustom(NULL,0,"Price ChannelNK", ChannelPeriod,Risk, Signal, Line, 3,1 );
    double sl_sell = MathMax( Ask + StopLoss*Point, signal_down );
      
      
       if( signal_down != 0.0 && open_sell && count_tip(OP_SELL) == 0 )
         {
          int ticket_sell  = OrderSend(_Symbol, OP_SELL, lots, Bid, 3, sl_sell, Bid - TakeProfit*Point, "RsiEma", MagicNumber);
         }
   
   
  }
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
int count_tip( int tip = -1)
{
   int cpte_order = 0; 
  for (int i = (OrdersTotal()-1); i >=0; i--)
  {
    if( OrderSelect(i,SELECT_BY_POS,MODE_TRADES) == false) continue;    
    if( OrderMagicNumber()==MagicNumber && OrderType()== tip) cpte_order++;
   }
  return(cpte_order);
}

//+------------------------------------------------------------------+
//   https://book.mql4.com/trading/ordermodify
//------------------------------------------------------------------------------- 1 --
void trailing_stop ( )                                  // Special function 'start'
  {
   string Symb=Symbol();                        // Symbol
//------------------------------------------------------------------------------- 2 --
   for(int i=1; i<=OrdersTotal(); i++)          // Cycle searching in orders
     {
      if (OrderSelect(i-1,SELECT_BY_POS)==true) // If the next is available
        {                                       // Analysis of orders:
         int Tip=OrderType();                   // Order type
         if(OrderSymbol()!=Symb||Tip>1)continue;// The order is not "ours"
         double SL=OrderStopLoss();             // SL of the selected order
         //---------------------------------------------------------------------- 3 --
         while(true)                            // Modification cycle
           {
            double TS=Tral_Stop;                // Initial value
            int Min_Dist= (int) MarketInfo(Symb,MODE_STOPLEVEL);//Min. distance
            if (TS < Min_Dist)                  // If less than allowed
               TS=Min_Dist;                     // New value of TS
            //------------------------------------------------------------------- 4 --
            bool Modify=false;                  // Not to be modified
            switch(Tip)                         // By order type
              {
               case 0 :                         // Order Buy
                  if (NormalizeDouble(SL,Digits)< // If it is lower than we want
                     NormalizeDouble(Bid-TS*Point,Digits))
                    {
                     SL=Bid-TS*Point;           // then modify it
                      Text="Buy ";        // Text for Buy 
                     Modify=true;               // To be modified
                    }
                  break;                        // Exit 'switch'
               case 1 :                         // Order Sell
                  if (NormalizeDouble(SL,Digits)> // If it is higher than we want
                     NormalizeDouble(Ask+TS*Point,Digits)
                     || NormalizeDouble(SL,Digits)==0)//or equal to zero
                    {
                     SL=Ask+TS*Point;           // then modify it
                     Text="Sell ";              // Text for Sell 
                     Modify=true;               // To be modified
                    }
              }                                 // End of 'switch'
            if (Modify==false)                  // If it is not modified
               break;                           // Exit 'while'
            //------------------------------------------------------------------- 5 --
            double TP    =OrderTakeProfit();    // TP of the selected order
            double Price =OrderOpenPrice();     // Price of the selected order
            int    Ticket=OrderTicket();        // Ticket of the selected order
 
            Alert ("Modification ",Text,Ticket,". Awaiting response..");
            bool Ans=OrderModify(Ticket,Price,SL,TP,0);//Modify it!
            //------------------------------------------------------------------- 6 --
            if (Ans==true)                      // Got it! :)
              {
               Alert ("Order ",Text,Ticket," is modified:)");
               break;                           // From modification cycle.
              }
            //------------------------------------------------------------------- 7 --
            int Error=GetLastError();           // Failed :(
            switch(Error)                       // Overcomable errors
              {
               case 130:Alert("Wrong stops. Retrying.");
                  RefreshRates();               // Update data
                  continue;                     // At the next iteration
               case 136:Alert("No prices. Waiting for a new tick..");
                  while(RefreshRates()==false)  // To the new tick
                     Sleep(1);                  // Cycle delay
                  continue;                     // At the next iteration
               case 146:Alert("Trading subsystem is busy. Retrying ");
                  Sleep(500);                   // Simple solution
                  RefreshRates();               // Update data
                  continue;                     // At the next iteration
                  // Critical errors
               case 2 : Alert("Common error.");
                  break;                        // Exit 'switch'
               case 5 : Alert("Old version of the client terminal.");
                  break;                        // Exit 'switch'
               case 64: Alert("Account is blocked.");
                  break;                        // Exit 'switch'
               case 133:Alert("Trading is prohibited");
                  break;                        // Exit 'switch'
               default: Alert("Occurred error ",Error);//Other errors
              }
            break;                              // From modification cycle
           }                                    // End of modification cycle
         //---------------------------------------------------------------------- 8 --
        }                                       // End of order analysis
     }                                          // End of order search
//------------------------------------------------------------------------------- 9 --
   return;                                      // Exit start()
  }
//----------------------------------------------------------------
 
Chart EURUSD, H1, 2018.10.27 14:45 UTC, FxPro Financial Services Ltd, MetaTrader 4, Real
Chart EURUSD, H1, 2018.10.27 14:45 UTC, FxPro Financial Services Ltd, MetaTrader 4, Real
  • www.mql5.com
Symbol: EURUSD. Periodicity: H1. Broker: FxPro Financial Services Ltd. Trading Platform: MetaTrader 4. Trading Mode: Real. Date: 2018.10.27 14:45 UTC.
 


IMMAGINE DELL'INDICATORE

Un principiante deve iniziare con questo tipo di indicatore e EA .... e cercare di migliorarlo,


È un codice MQL4

Hai una funzione di trailing stop nel codice, che funziona bene

Motivazione: