Discussion of article "MQL5 Cookbook - Pivot trading signals"

 

New article MQL5 Cookbook - Pivot trading signals has been published:

The article describes the development and implementation of a class for sending signals based on pivots — reversal levels. This class is used to form a strategy applying the Standard Library. Improving the pivot strategy by adding filters is considered.

The EURUSD M15 chart (Fig.2) displays the day (January 15, 2015) Open level below the central pivot. However, later during the day, the price touches the pivot level upwards. Thus, there is a sell signal. If neither stop loss nor take profit are activated, the market exit is performed at the beginning of the next day.

Fig.2. Basic strategy: sell signal

Fig.2. Basic strategy: sell signal

Author: Dennis Kirichenko

 
I've done this, the end result is purely on piwits, you need to dilute it with something and filter it more efficiently :)
 
Maxim Dmitrievsky:
I've done this, in the end, purely by piwits you get a coin, you need something to dilute and filter more effectively :).

An anecdote comes to mind.

- Doctor, my neighbour, he is already 70, says that during the night can five times.


- Open your mouth. Okay, tongue in place... What's stopping you from saying the same thing?

 
MetaQuotes Software Corp.:

Published article MQL5 Recipes - Pivot Trading Signals:

Author: Dennis Kirichenko


There are strange trades that immediately close on the next bar, and not a word about them in the journal.


Also in SignalPivots.mqh from the Model folder there is a discrepancy in LongCondition and ShortCondition:

//+------------------------------------------------------------------+
//| Проверка условия на покупку                                      |
//+------------------------------------------------------------------+
int CSignalPivots::LongCondition(void)
  {
   int result=0;
//--- если Модель 0 учитывается
   if(IS_PATTERN_USAGE(0))
      //--- если Модель 0 не отработана
      if(!m_pattern_0_done)
        {
         m_is_signal=false;
         //--- если день открылся ниже пивота
         if(m_daily_open_pr<m_pivot_val)
           {
            //--- максимальная цена на прошлом баре
            double last_high=m_high.GetData(1);
            //--- если цена получена
            if(last_high>WRONG_VALUE && last_high<DBL_MAX)
               //--- если было касание снизу (с учётом допуска)
               if(last_high>=(m_pivot_val-m_pnt_near))
                 {
                  result=m_pattern_0;
                  m_is_signal=true;
                  //--- в Журнал
                  this.Print(last_high,ORDER_TYPE_BUY);
                 }
           }
         //--- если Модель 1 учитывается
         if(IS_PATTERN_USAGE(1))
           {
            //--- если на прошлом баре был бычий тренд
            if(m_trend_val>0. && m_trend_val!=EMPTY_VALUE)
              {
               //--- если есть ускорение
               if(m_trend_color==0. && m_trend_color!=EMPTY_VALUE)
                  result+=(m_pattern_1+m_speedup_allowance);
               //--- если нет ускорения
               else
                  result+=(m_pattern_1-m_speedup_allowance);
              }
           }
        }
//---
   return result;
  }
//+------------------------------------------------------------------+
//| Проверка условия на продажу                                      |
//+------------------------------------------------------------------+
int CSignalPivots::ShortCondition(void)
  {
   int result=0;
//--- если Модель 0 учитывается
   if(IS_PATTERN_USAGE(0))
      //--- если Модель 0 не отработана
      if(!m_pattern_0_done)
        {
         //--- если день открылся выше пивота
         if(m_daily_open_pr>m_pivot_val)
           {
            //--- минимальная цена на прошлом баре
            double last_low=m_low.GetData(1);
            //--- если цена получена
            if(last_low>WRONG_VALUE && last_low<DBL_MAX)
               //--- если было касание сверху (с учётом допуска)
               if(last_low<=(m_pivot_val+m_pnt_near))
                 {
                  result=m_pattern_0;
                  m_is_signal=true;
                  //--- в Журнал
                  this.Print(last_low,ORDER_TYPE_SELL);
                 }
           }
         //--- если Модель 1 учитывается
         if(IS_PATTERN_USAGE(1))
           {
            //--- если на прошлом баре был медвежий тренд
            if(m_trend_val<0. && m_trend_val!=EMPTY_VALUE)
              {
               //--- если есть ускорение
               if(m_trend_color==0. && m_trend_color!=EMPTY_VALUE)
                  result+=(m_pattern_1+m_speedup_allowance);
               //--- если нет ускорения
               else
                  result+=(m_pattern_1-m_speedup_allowance);
              }
           }
        }
//---
   return result;
  }
 
Igor Nistor:


And also in SignalPivots.mqh from the Model folder there is a discrepancy in LongCondition and ShortCondition:


It is imaginary :-)

The flag in the CSignalPivots::LongCondition() method is simply reset, because it is called first.

There are strange trades that are immediately closed on the next bar, and not a word about them in the log....

I need details from you. Broker, account type, EA and Tester settings.

I have not noticed such behaviour....

 

Pivots indicator not loading

 
Tavamanya:

Pivots indicator not loading


Have a look at the last 2 sentences in the article:


It is most convenient to put the strategy files to the single Pivots folder. Move the indicator files (Pivots.ex5 and MaTrendCatcher.ex5) to the %MQL5\Indicators indicator folder after the compilation.