Searching for market patterns - page 114

 
Svinozavr:

By the pulse indicator. Like I haven't forgotten. I'm "finishing" it now. Here is the picture so far (Eurobucks 5).


The legend is as follows: the impulse itself is marked on the bar with two rhombuses of the respective colour (small and large). A strong bar, which is not an impulse, is marked with a small rhombicon (more about it later).

Logic: average bar spread is calculated, i.e. МА by a modulo (open - close). Then we memorize the value of excess (as soon as it happens) of the bar slope over the average slope. And so when a new bar exceeds this hmmm... OK, the overshoot by some threshold, then this bar is counted as a pulse. The amount of excess is overwritten by the new one. And so on and so on and so forth. Of course, there must be a certain noise threshold, otherwise you will understand that there will be a lot of false signals in the flat.

===

I do not know when I will finish it. Maybe today. Maybe by Mon. Maybe in general... If not "at all", I'll post it here, in the thread. I don't need a hundred premoderation in kodobaz and 200 times in the red army - ratings. If anything, the basic logic described all, write yourself no problem.

The author reserves the right to partially modify the working principle of the indicator, to completely change its logic or reject it altogether.


Peter, as best I could...sorry if I didn't live up to expectations.

#property copyright "Svinozavr"
#property indicator_chart_window // в окне инструмента
#property indicator_buffers 6
#property indicator_color1 Green
#property indicator_color2 Red  
#property indicator_color3 Green
#property indicator_color4 Red  
#property indicator_color5 Green
#property indicator_color6 Red  

// входные параметры
extern double MAperiod     = 200; 
extern double K            = 1.3;   // коэффициент умножения размаха (шумовой порог)
extern double Bord         = 0;     // превышение
              
extern bool   Fade         = false; // режим затухания
extern bool   OC.HL.range  = false; // способ расчёта размаха
extern bool   OC.HL.middle = false; // способ расчёта средней цены
extern bool   Hist         = true;

// массивы индикаторных и вспомогательных буферов
double Top[],Bot[],Sup[],Res[]; 
double up[],dn[];
// общие переменные 
double k0,k1,period; // коэфф. EMA и производный период
double brd; 
int    History=0; // 0- все бары

// инициализация
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
void init() 
{ 
  brd=Bord*Point;
  if(MAperiod>1)
  {
    k0=2/(1+MAperiod); 
    period=MAperiod;
  }
  else 
  { 
    k0=MAperiod; 
    period=(2-MAperiod)/MAperiod;
  }
  k1=1-k0;
   
  if(Hist) 
  {
    int stl=3,sw=1;
  } 
  else 
  {
    stl=0;sw=2;
  }
  SetIndexBuffer(0,Top); // индикатор
  SetIndexStyle(0,DRAW_LINE);
  SetIndexEmptyValue(0,0.0);

  SetIndexBuffer(1,Bot); // вспомогательный буфер
  SetIndexStyle(1,DRAW_LINE);
  SetIndexEmptyValue(1,0.0);

  SetIndexBuffer(2,Sup); // вспомогательный буфер
  SetIndexStyle(2,stl,0,sw);
  SetIndexEmptyValue(2,0.0);
  SetIndexArrow(2,117);

  SetIndexBuffer(3,Res); // вспомогательный буфер
  SetIndexStyle(3,stl,0,sw);
  SetIndexEmptyValue(3,0.0);
  SetIndexArrow(3,117);
  
  SetIndexBuffer(4,up); // вспомогательный буфер
  SetIndexStyle(4,stl,0,sw+1);
  SetIndexEmptyValue(4,0.0);
  SetIndexArrow(4,117);
  
  SetIndexBuffer(5,dn); // вспомогательный буфер
  SetIndexStyle(5,stl,0,sw+1);
  SetIndexEmptyValue(5,0.0);
  SetIndexArrow(5,117);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
void start() 
{
  int limit=Bars-IndicatorCounted()-1; 
  if(limit>1) 
  {
    limit=Bars-1;
    ArrayInitialize(Top,0.0);
    ArrayInitialize(Bot,0.0);
    ArrayInitialize(Sup,0.0);
    ArrayInitialize(Res,0.0);
  }
  if(History!=0 && limit>History) 
  {
    limit=History-1; // кол-во пересчетов по истории
  }  
  // цикл пересчета
  for(int i=limit; i>=0; i--) 
  { 
    // средняя цена
    if(OC.HL.middle)
    {
      double mid=(High[i]+Low[i])/2;
    }  
    else 
    {
      mid=(Close[i]+Open[i])/2;
    }  
    
    // размах
    if(OC.HL.range) 
    {
      double rng=High[i]-Low[i];
    }  
    else 
    {
      rng=MathAbs(Close[i]-Open[i]);
    }  
    
    // EMA
    static double dt,db;
    double ma0; 
    static double ma1;
    if(i==limit && i>1) 
    {
      ma0=rng; // начальное значение
      dt=0;db=0;
    }
    else 
    { // основной расчет
      if(rng>ma1 && Fade) 
      {
        ma0=rng;
      }  
      else 
      {
        ma0=k0*rng+k1*ma1;
      }  
    }
    if(i>0) 
    {
      ma1=ma0;
    }  
    
    // канал
    double diff=K*ma0;
    Top[i]=mid+diff;
    Bot[i]=mid-diff;
    
    // тренд
    static bool trend;
    if(i>0) 
    {
      double difft=Close[i]-Top[i];
      double diffb=Close[i]-Bot[i];
      if(difft>0) 
      {
        trend=1; 
        dt=difft;
        if(Hist) 
        {
          Sup[i]=(Close[i]+Open[i])/2;
          if(difft>=-db+brd) 
          {
            up[i]=Top[i];
          }  
        }
      }
      if(diffb<0) 
      {
        trend=0; 
        db=diffb;
        if(Hist) 
        {
          Res[i]=(Close[i]+Open[i])/2;
          if(diffb<=-dt-brd) 
          {
            dn[i]=Bot[i];
          }  
        }
      }
    }
    if(!Hist && i>0) 
    {
      if(trend) 
      {
        Sup[i]=Bot[i];
      }   
      else 
      {
        Res[i]=Top[i];
      }  
    }
//  Sup[i]=Sup[i+1]; Res[i]=Res[i+1];
  }
}
 

Some https://www.mql5.com/ru/forum/133986/page 5 suggest that the search for market patterns should be abandoned in favour of studying market properties which are undeniable, let us highlight them:

1. The fluctuating properties of the market;

2. any trend is correctable. this property is undeniable. But by no means a pattern, as lawmaking presupposes accurate data. https://www.mql5.com/ru/forum/133986/page7

3. the presence, in price changes, of a natural and random component https://www.mql5.com/ru/forum/133986/page5.

4. Different manifestation of regularities on different TFs (it is still debatable) https://www.mql5.com/ru/forum/133986/page11.

5. Presence of "noise" in quotations, but some are sure that even a single tick contains useful information https://www.mql5.com/ru/forum/133986/page13

6. There are pairs that make up the market sector and set the tone for the movement at the moment https://www.mql5.com/ru/forum/133986/page16

7. The presence of a "fair" price (put out by the central bank for the current day?), to which the current price aspires https://www.mql5.com/ru/forum/133986/page19

8. Fixing (gold, e.g. twice a day) https://www.mql5.com/ru/forum/133986/page20

9. It is necessary to perceive the market as a wild animal, know its habits, study its traces, set ambushes, set traps, bait and shoot accurately! https://www.mql5.com/ru/forum/133986/page24

10. The market is inertial. The essence of successful trading is to understand what is happening now and to participate. TA is a tool that tells you - where you are. https://www.mql5.com/ru/forum/133986/page30


Suggest more global market features to complete the list.

Let's study the consequences of using global market properties in TA and what potential harm other patterns accompanying market properties can do to trade. For example, if one follows these two market properties, one should always trade in a counter-trend, hoping for a return or partial return (correction). But, what if these market properties are violated very often? To what extent can this circumstance be detrimental to the global strategy? Would a correction be able to cover some of the losses?

 
yosuf:

Some https://www.mql5.com/ru/forum/133986/page 5 suggest that the search for market patterns should be abandoned in favour of studying market properties which are undeniable; let us highlight them:

1. The fluctuating properties of the market;

2. any trend is correctable. this property is undeniable. But by no means a pattern, as lawmaking presupposes accurate data. https://www.mql5.com/ru/forum/133986/page7

3. the presence, in price changes, of a natural and random component https://www.mql5.com/ru/forum/133986/page5.

4. Different manifestation of regularities on different TFs (so far it is disputable) https://www.mql5.com/ru/forum/133986/page11

5. Presence of "noise" in quotations, but some are sure that even a single tick contains useful information https://www.mql5.com/ru/forum/133986/page13

6. There are pairs that make up the market sector and set the tone for the movement at the moment https://www.mql5.com/ru/forum/133986/page16

7. The presence of a "fair" price (put out by the central bank for the current day?), to which the current price aspires https://www.mql5.com/ru/forum/133986/page19

8. Fixing (gold, e.g. twice a day) https://www.mql5.com/ru/forum/133986/page20

9. It is necessary to perceive the market as a wild animal, know its habits, study its traces, set ambushes, set traps, bait and shoot accurately! https://www.mql5.com/ru/forum/133986/page24

10. The market is inertial. The essence of successful trading is to understand what is happening now and to participate. TA is a tool that tells you - where you are. https://www.mql5.com/ru/forum/133986/page30


Suggest more global market properties to complete the list.

Let's study the consequences of using global market properties in TA and what potential harm other patterns accompanying market properties can do to trade. For example, if one follows these two market properties, one should always trade in a counter-trend, hoping for a return or partial return (correction). But, what if these market properties are violated very often? To what extent can this circumstance be detrimental to the global strategy? Would a correction be able to cover some of the losses?


If you take two pairs, then no matter how they behave, you can distinguish three market states :

1) impulse movement (abrupt movement)

2) averaged movement

3) slow motion (flat)

Of course, if we look at all these things on real quotes, it is very difficult to choose anything, since in fact, the presence of constant noise provokes the distortion (quite significantly) of the overall picture, and the search for similarity is very difficult...

 
yosuf:
///

10. The market is inertial.....


Suggest more global market features to complete the list.

....


It is already enough to make a profit.
 
There are only two patterns - return and self-reinforcing. The rest are filters)
 
Avals:
There are only two patterns - return and self-reinforcing. The rest are filters).
Please clarify the concept of "self-amplification".
 
Avals:
2 patterns in total - reversion and self amplification. The rest are filters).

Good idea with self-reinforcing. I suggest the coefficient S in the following equation as a self-reinforcing coefficient and look at its behaviour as the price P changes:

P =S*O^a*H^b*L^c*C^d

Using 15 days of OHLC D1 data, got the coefficient values I gave earlier here https://www.mql5.com/ru/forum/140329/page43.

https://c.mql5.com/mql4/forum/2012/11/f1.jpg

It appears to be interesting how the S Gain behaves, for example, after the 14th point is entered, i.e. the last 15th point has not been entered yet which obviously indicates a possible reversal:


The introduction of the 15th point leaves no doubt about the reversal, as the amplification factor increases dramatically by hundreds of times:


Thus, thanks to Avals prompting, I have apparently found a powerful predictor of the onset of a reversal. But, this fact should be double-checked several times. Thank you, Mr. Avals, and I suggest to follow up with the creation of the indicator.

 
yosuf: Please clarify the concept of 'self-reinforcing'.
Positive feedback. You look at a rising price, you buy too, and you drive it up even more.
 

Interesting things happen if we express the average value of the current bar price P through OHLC as follows and investigate the behaviour of the equation coefficients:

P =S*O^a*H^b*L^c*C^d

The found method of determining the coefficients makes it possible to obtain the full (ideal) coincidence of the actual and calculated price values, as can be seen on the chart:

Here is how the coefficients of the equation change in this case:

Now, it is necessary to carry out this procedure with a large enough amount of data and trace the behavior of the ratios at price reversals and look for the forerunners of the reversal. I am sure they must appear. We should have an indicator consisting of four lines like Alligator but let's call it something else, I am thinking of what to call it now.

Notably, the sum of the equation coefficients, as well as the S coefficient, is almost always equal to one, and the last outburst may be a harbinger of an upward movement:


 
...

Thus, thanks to Avals' clue, apparently a powerful predictor of the onset of the reversal has been found. But, this fact should be double-checked several times. Thank you, Mr. Avals, and I suggest you take the matter to the creation of an indicator.



Yusuf, reversal predictors are looked for by beginners at the initial stage. And when they start to understand a little bit, they give up looking and trade a continuation.