Difference calculus, examples. - page 6

 

Averaging by fourth-degree polynomial with arm 72 (fourth-degree EMA) andextrapolation to different arms by cubic parabola(third-degree polynomial).

      a1_Buffer[i]=((open[i] - Znach)    +5061600*a1_Buffer[i+1 ]-7489800    *a1_Buffer[i+2 ]+4926624*a1_Buffer[i+3 ]-1215450*a1_Buffer[i+4 ])/1282975;

      a5_Buffer[i+92]=a1_Buffer[i];   if(i<=1100) { for(z=92-1;z>=0;z--){        a5_Buffer[i+0+z]=  4*a5_Buffer[i+1+z]  -  6*a5_Buffer[i+2+z]  +  4*a5_Buffer[i+3+z]  - 1*a5_Buffer[i+4+z];  }}


      a2_Buffer[i+20]=a5_Buffer[i+20]; 
      
      a3_Buffer[i+38]=a5_Buffer[i+38]; 
      
      a4_Buffer[i+56]=a5_Buffer[i+56];
        
      a6_Buffer[i+74]=a5_Buffer[i+74];

The first figure is a construction scheme, in the second figure all linesthat are not redrawn are drawn to the last value.

The indicators in the basement differ only in the specified line shift.


 

Averaging by fourth-degree polynomial with arm 72 (fourth-degree EMA) andextrapolation to different arms usingfourth-degree polynomial.

      a1_Buffer[i]=((open[i] - Znach)    +5061600*a1_Buffer[i+1 ]-7489800    *a1_Buffer[i+2 ]+4926624*a1_Buffer[i+3 ]-1215450*a1_Buffer[i+4 ])/1282975;

      a5_Buffer[i+92]=a1_Buffer[i];   if(i<=1100) { for(z=92-1;z>=0;z--){        a5_Buffer[i+0+z]=  5*a5_Buffer[i+1+z]  -  10*a5_Buffer[i+2+z]  +  10*a5_Buffer[i+3+z]  - 5*a5_Buffer[i+4+z]  +  1*a5_Buffer[i+5+z];  }}


      a2_Buffer[i+20]=a5_Buffer[i+20]; 
      
      a3_Buffer[i+38]=a5_Buffer[i+38]; 
      
      a4_Buffer[i+56]=a5_Buffer[i+56];
        
      a6_Buffer[i+74]=a5_Buffer[i+74];
   

The first figure is a construction scheme, in the second figure all linesthat are not redrawn are drawn to the last value.

The indicators in the basement differ only in the specified line shift.


 

Alexei, I can give you free advice and a tip.

I've already said that it's, how should I put it mildly... - a thankless task. You will only get curses from those who watch your branch. By the way, it is one of the reasons why you are proud to be alone in your own branch.
But to shift a periodic line with one inflection point to the left by one half-wave (or rather if there is only one inflection point between the local minimum and maximum) without an actual shift you can use the derivative of that function. It really isn't an actual shift, but in essence. The derivative of a function is the angle of a tangent to the line. Calculated simply: buf[i]-buf[i+1]

Here are, for example, the first and second derivatives of a sine wave. The inflection points of the function itself become the local maxima and minima of its derivative.

 
Nikolai Semko:

Alexei, I can give you free advice and a tip.

I've already said that using a shift to the left is, how can I put it mildly ... - a thankless task. Get only curses from those who watch your branch. By the way, it is one of the reasons why you are proud to be alone in your own branch.
But to shift a periodic line with one inflection point to the left by one half-wave (or rather if there is only one inflection point between the local minimum and maximum) without an actual shift you can use the derivative of that function. It really isn't an actual shift, but in essence. The derivative of a function is the angle of a tangent to the line. Calculated simply: buf[i]-buf[i+1]

Here are, for example, the first and second derivatives of a sine wave. The inflection points of the function itself become local maxima and minima of its derivative.

Yes Nikolai, I completely agree with you, and of course each derivative shifts the sine graph by a quarter of the period to the left.

So when it came to comparisons I eliminated the artificial line shift. You can see this in the second figures in the last few posts. All lines except the thin gray one are drawn on the last bar and are not redrawn. And some shift of the chart to the left is due to extrapolation.

And these lines can indeed still be differentiated, in our case remove the first and/or second difference, which was in the prototype. :)))

The shift to the left was used to tie all the lines including the construction lines into a whole picture, and to see the overall scheme.

 
Aleksey Panfilov:

Yes Nicholas, I completely agree with you, of course each derivative shifts the sine graph by a quarter of the period to the left.

That's why when it came to comparisons I eliminated the artificial shift of lines. You can see this in the second figures in the last few posts. All lines except the thin gray one are drawn on the last bar and are not redrawn. And some shifting of the chart to the left is due to extrapolation.

The shift to the left was used to connect all lines, including construction lines, in the complete picture and to demonstrate the general scheme.


The upper chart can be ignored, because it is shifted to the left and the tail is redrawn. And the lower one looks laggy and mundane. What is the point of all this fuss?

 
Nikolai Semko:

You don't even have to pay attention to the upper chart, because it is shifted to the left, and the tail is redrawn. And the lower one looks laggy and mundane. What's the point of all this fuss then?


))))

We'll see "as we go along."

So far, everything is on track. ))

 
Nikolai Semko:

Alexei, I can give you free advice and a tip.

I've already said that shifting to the left is, how should I put it mildly ... - a thankless exercise. You'll only get curses from those who watch your line. By the way, it is one of the reasons why you are proud to be alone in your own branch.
But to shift a periodic line with one inflection point to the left by one half-wave (or rather if there is only one inflection point between the local minimum and maximum) without an actual shift you can use the derivative of that function. It really isn't an actual shift, but in essence. The derivative of a function is the angle of a tangent to the line. Calculated simply: buf[i]-buf[i+1]

Here are, for example, the first and second derivatives of a sine wave. The inflection points of the function itself become local maxima and minima of its derivative.


Here is one possible implementation of this approach. No redrawing and shifting. This is the second derivative of your line.


Files:
Banzai.mq4  5 kb
Banzai.mq5  6 kb
 

Sometimes it even correlates very well and does not lag behind


 
Nikolai Semko:

Alexei, I can give you free advice and a tip.

I've already said that applying the shift to the left - is, how to put it mildly ... - a thankless task. You will only get curses from those who watch your branch. By the way, it is one of the reasons why you are proud to be alone in your own branch.
But to shift a periodic line with one inflection point to the left by one half-wave (or rather if there is only one inflection point between the local minimum and maximum) without an actual shift you can use the derivative of that function. It really isn't an actual shift, but in essence. The derivative of a function is the angle of a tangent to the line. Calculated simply: buf[i]-buf[i+1]

Here are, for example, the first and second derivatives of a sine wave. The inflection points of the function itself become local maxima and minima of its derivative.

I'm in a good mood today.

Alg. on the "shifting the wagons to the left" (what a name for it :) )

Take two SMAs, one fast and one slow.

2. Shift one half cycle to the left (each to its own).

3. We are surprised to see that :

3.0 waveforms are swirling around each other.

The fast one shifts the slow one upwards just before the extremum (sometimes much earlier).

3.2. "Pair" crossovers (up before the extremum, down after it)

4. Shift the bars back to real time, but (unlike n2) by the same amount. One will end at 0, the other will go out strongly to the right

5. Now having seen the crossover of the past extremum and previous crossover, we look where it is. Based on what we can filter out obvious false positives and make nice entrances.

 
Maxim Kuznetsov:

I'm in a good mood today.

Alg. on the "shifting the wagons to the left" (what a name for it :) )

We take two SMAs, a fast one and a slow one.

2. Shift one half cycle to the left (each to its own).

3. We are surprised to see that :

3.0 waveforms are swirling around each other.

The fast one shifts the slow one upwards just before the extremum (sometimes much earlier).

3.2. "Pair" crossovers (up before the extremum, down after it)

4. Shift the bars back to real time, but (unlike n2) by the same amount. One will end at 0, the other will go out strongly to the right

5. Now having seen the crossover of the past extremum and previous crossover, we look where it is. Based on what we can eliminate obvious false positives and make nice entries.


Maybe, there is something in it. But it is not a leftward shift algorithm but a rightward shift algorithm.