Lavagem cerebral: desenvolvimento do sistema - página 5

 

Idéia # dois pontos de partida (apenas para o futuro)

Continuo testando manualmente esta idéia com o iTrend, PriceChannel_Stop_v1 e T3 TRIX (ROC de T6).mq4 indicador. Veja as regras que selecionei para os testes manuais https://www.mql5.com/en/forum/172979/page3

e você pode encontrar também algumas declarações.

Esta idéia funciona. É a idéia número 1.

Mas forexts disseram sobre uma outra idéia: confirmar o sinal de venda ou compra do PriceChannel_Stop_v1 não em 0 ou 1 barra. Isso significa levar em conta o indicador iTrend depois que o pedido foi aberto. Para obter mais lucro.

Será a idéia número 2. Acho que terminaremos com esta idéia nº 1 primeiro e começaremos a desenvolver uma outra idéia nº 2. Mas quero mostrar como a curva de preços (linha branca) está se movendo através do indicador iTrend. Não sei nada sobre isso. Eu nem pensei nisso. Ainda não. Apenas coloquei aqui a imagem porque posso esquecer e ter algum ponto de partida para o desenvolvimento da idéia nº 2.

Arquivos anexados:
bw1_idea2.gif  23 kb
 

Lavagem cerebral no período de tempo D1.

Veja as imagens.

Apenas para relembrar este sistema comercial muito simples.

Eu negociei este sistema na M15 durante muitos meses. E então nós criamos muitos EAs. Para EAs e regras, vá para este tópico https://www.mql5.com/en/forum/173031

Mas eu nunca testei este sistema simples no tempo D1.

Arquivos anexados:
 

O sistema de lavagem cerebral sempre foi bom para o par USDCHF.

Veja o exemplo das recentes negociações para este par no cronograma H4.

Arquivos anexados:
 

No post #43 você pode ver algumas imagens do sistema de lavagem cerebral no período de tempo D1.

Podemos ver no GBPUSD que o bar do dia 22 de novembro foi fechado com sinal. Por favor, note que estamos negociando na barra de fechamento.

Todas as explicações e resultados que você pode ver a partir da imagem.

Eu uso nível = 0,008 para o indicador iTrend para o período de tempo D1 para GBPUSD. É claro que deve ser revisto periodicamente, pois é a principal regra para este sistema.

Arquivos anexados:
gbpusd1_d1.gif  26 kb
 
newdigital:
No post #43 você pode ver algumas imagens do sistema de lavagem cerebral no período de tempo D1.

Podemos ver no GBPUSD que o bar do dia 22 de novembro foi fechado com sinal. Por favor, note que estamos negociando no bar de fechamento.

Todas as explicações e resultados que você pode ver na imagem.

Eu uso nível = 0,008 para o indicador iTrend para o período de tempo D1 para GBPUSD. É claro que deve ser revisto periodicamente, pois é a principal regra para este sistema.

E algumas negociações em outros pares.

Eu uso nível = 0,008 para o indicador iTrend para EURUSD D1; 0,006 para USDCHF D1 e 0,6 para USDJPY D1.

E por favor leia este post https://www.mql5.com/en/forum/173031 sobre como estimar o nível do indicador iTrend. Eu acho que todos que estão usando este sistema de lavagem cerebral devem estimar o nível porque este nível depende do corretor. Isso significa que, provavelmente você terá um valor diferente do indicador iTrend (diferente das imagens anexas).

Toda a explicação que você pode encontrar nas imagens.

Arquivos anexados:
eurusd1_d1.gif  23 kb
usdchf1_d1.gif  24 kb
usdjpy1_d1.gif  26 kb
 

Este aqui, o canal de preços é melhor

Arquivos anexados:
 
/*
//----+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+ 
//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); 
}
//+------------------------------------------------------------------+

 

Aqui está uma EA básica para este indicador :

//+------------------------------------------------------------------+
//|                                          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.
 


IMAGEM DO INDICADOR

Um iniciante tem que começar com este tipo de indicador e EA .... e tentar melhorá-lo,


É um código MQL4

Você tem uma fonte de parada de rastreamento no código, que funciona bem

Razão: