How do you algorithmise the detection of MA feed clusters? - page 2

 
Dmitry Fedoseev:

I'm too lazy to invent any more. There is some hint that, in principle, the problem is solvable.

All these feeds are just a heatmap from previous prices. Side view. 😉

And unlike the average, the temperature map can be extended into the future. And the blackouts, they're harnesses are easy to look for
 
Maxim Kuznetsov:
All these feeds are just a heatmap from the old prices. Side view.

And unlike the average, the temperature map can be extended into the future. And blackouts, they're easy to find

Yes, it is!

It's easy when you have ready-made stereotypes.

And working them out is no easy task...

Thank you for the referral!
 
Mikhail Toptunov:

Yeah, right!

It's easy when you have ready-made stereotypes.

It's not easy to work out the stereotypes...

Thank you for the direction!

A rough algorithm for calculating a heatmap (e.g. for 100 bar):

for all Close from 1 to 100 :

Close[N]=X will add to heatmap the sum of the row heatmap[Resolution(X)]+={X/N} + {X/(N+1)}+{X/(N+2)}... up to 100.
What is in curly brackets is the "components" of averages, just highlighted.
Resolution(X) - "resolution", e.g. 10 points Round((X-MinimalX)/Point/10)

obtain a vector in which local maxima you need to find.

This vector is practically a vertical profile of prices

 

now that you've started...

direct curve clustering can be detected simply and quickly.

Alg.: search for a max. cluster of points within D on an axis. (probably easier to draw, but not an artist)

for each X point on the secondary axis, mark +1 on X+D and -1 on X-D.

Then run along the supplementary axis and count the cumulative sum of marks. At the same time remembering the maximum, its duration and position.

ALL.

But vertical profile or temperature map option is better, although long and resource consuming

because 1) it is counted directly from prices 2) it keeps matrix connection to SMA 3) it is connected to stack 4) it is variable - you can "play" with fades, blur and find something of your own

 
Mikhail Toptunov:

I've tried recalculating MA repetitions by price, by period.

I did the following:

- determined the moment of each MA transition from one direction to another - signal1

- after receiving the data, count the number of repetitions of signal1 in a bar

but the result turned out to be too noisy


then I detected that the MA of the current bar have a decreasing period on the next bar, i.e. the bundle was shifted down by period

I started to connect the data in a chain to the signal1 and in the obtained data I found the moment of the transition


But it does not work all the same, it makes some noise or does not show.



Damn, the pattern does not work, the top window is empty.


Ideally, the task is to get the values marked with a blue marker

Maxim told you correctly

You take your MA with the maximal period, you take the minimal one

and that's it, here they are - the feeds.

The pattern works great, everything is clearly visible and understandable:


 

Another option

1

Files:
22.mq5  4 kb
 

And one more

Files:
23.mq5  6 kb
 
You could be in for a week or a month...
 
Maxim Kuznetsov:

approximate heatmap calculation algorithm (e.g. for 100 bar):

for all Close from 1 to 100 :

Close[N]=X will add to heatmap the sum of row heatmap[Resolution(X)]+={X/N} + {X/(N+1)}+{X/(N+2)}... up to 100.
What is in curly brackets is the "components" of averages, just highlighted.
Resolution(X) - "resolution", e.g. 10 points Round((X-MinimalX)/Point/10)

obtain a vector in which local maxima you need to find.

This vector is in fact a vertical profile of prices.

I'm trying to integrate the formula... I'm generally tight...

#define           Pmax 100   //размер массива по периоду

void ...
{
   for(int p=5; p<=Pmax; p++) // отбор по периодам
      for(int b=rates_total-Pmax; b<rates_total; b++)
        {
         double pr=sm.d[p-1].m[b]; // массив значений цен МА        p-период, b-бар        
        }
}

I have the value of each period for each bar - pr

What should I get at the end of the calculation?

- A vertical vector (array of values) for each bar,

if I calculate values for the first bar

heatmap[Round((pr-MininalX)/Point/10)]+=pr;

MininalX - minimum price value of 100 MA periods

I know I'm talking nonsense, so please be merciful!)

 
Mikhail Toptunov:

Trying to integrate the formula... I'm Really, really tight...

I have the value of each period for each bar - pr

What should I get at the end of the calculation?

- A vertical vector (array of values) for each bar,

if I calculate values for the first bar

MininalX - minimum price value of 100 MA periods

I know I'm talking nonsense, so please be merciful !)

Yes, you should get a "vertical vector" of sums. Each element of the vector is responsible for e.g. 10 pips.

So for a bar:

1. we run through the prices of Pmax bars, in order to determine the maximum, minimum and from them the size of the vector.

2. once again review prices for each price:

2.1 determine in which element of the vector to add

2.2 determine how much to add. For an offset of N, we will add PRICE * (sum 1/N 1/(N+1) 1/(N+2) . 1/Pmax) .
What is in brackets is the difference of two harmonic series = H(Pmax)-H(N-1), you can count quickly if you want

---

Why is it so: the price at the distance of N bars will "fall" only into the SMA group from Pmax to N. It doesn't matter less than N, and below Pmax we don't count

in each SMA the weights will be 1/period, i.e. in all at once 1/N 1/(N+1) 1/(N+2) ...

Reason: