Numerical series density

 

I propose to discuss algorithms and methods for finding the density of numbers if those numbers are known.

For example, there are 10 numbers - how do you find the range of numbers that have a higher density relative to the available numbers?

NO.P./P.Number
1 3
2 5
3 6
4 7
5 8
6 23
7 27
8 34
9 36
10 55

I'll post my thoughts a little later, but in the meantime I'd like to hear your thoughts.

 

My algorithm:

1. Find the difference between the numbers - this is just their proximity to each other.

2. If the number is less than the average value of the deltas obtained from item 1, then - 1, and if not - 0.

3. if the value from step 2 is 1, then add the value to the previous total, if not - 0.

4. Find the maximum value from item 3.

5. Define the range - find the value from item 4 and look up from item 3 the number with zero value, then increase the found number by one.

In this way we get the range of numbers whose density is the highest in relation to the others.

NO.P./P.NumberDeltaCloseness valuesClose in successionMaximumDense
1 3 4 3
2 5 2 1 1 5
3 6 1 1 2 6
4 7 1 1 3 7
5 8 1 1 4 8
6 23 15 0 0
7 27 4 1 1
8 34 7 0 0
9 36 2 1 1
10 55 19 0 0


However, areas of equal density may arise, according to this methodology

NO. P./P.NumberDeltaProximity valuesClose in successionMaximumDense
1 11 2
2 12 1 1 1
3 18 6 0 0 18
4 21 3 1 1 21
5 22 1 1 2 22
6 28 6 0 0
7 36 8 0 0 36
8 37 1 1 1 37
9 39 2 1 2 39
10 55 16 0 0

Critical comments and ideas are awaited.

 
Interesting topic, nothing to offer, but I'll keep an eye out).
 

Corrected the first post - in calculating the table the first row was taken into account - it is not necessary to do this, because we are looking for the delta and it appears from the second number. In fact, finding the delta in the second column we find out how close the first number is to the second. Given the above, I want to draw attention to the fact that the column "Dense" (numbers) gets the first number in the sequence (the value of zero in the column "Proximity in a row"), ie in the column "Maximum" pairs of numbers, so the actual number of digits will always be one more.

Why do I bother with this calculation - I have a theory about resistance cloud density according to which the denser the accumulation of probable resistance levels, the more probable the market reversal is. I.e. this theory is applicable to determination of support and resistance levels taking into account market dynamics, and therefore, in theory, it should help to determine entry and exit points with higher probability - I plan to use it to determine take profit point.

 

One way to proceed if there are several clusters is to determine the density of that group using the formula (Maximum number in the group-Minimum number in the group)/(Number of numbers in the group). The smaller the value, the denser the numbers to each other.

NO.P./P.NumberDeltaCloseness valuesCloser in successionMaximumDenseDensity
1 11 2
2 12 1 1 1
3 18 6 0 0 18 1,33
4 21 3 1 1 21
5 22 1 1 2 22
6 28 6 0 0
7 36 8 0 0 36 1,00
8 37 1 1 1 37
9 39 2 1 2 39
10 55 16 0 0
 
-Aleks-:
Take any Market Profile indicator and see how it calculates price density on levels, like this one, it also calculates volumes.

an old, but possibly live version is if you google "Market Profile MT5 - tradeliakeapro"

 
Andy Sanders:
Take any Market Profile indicator and see how it calculates price density on levels, like this one, it also calculates volumes.

an old, but possibly live version is if you google "MT5 Market Profile - tradeliakeapro"

Market Profile is a recurring number of price hits in a range - this range is set by hand (step) and then the total number of bars is simply allocated to groups. I'm talking about defining a range - another task.

 

The task is underdelivered. Tried to figure out the target from the algorithm in the second post, but in it:

"2. If the number is less than the average value of the deltas obtained from item 1, then - 1, and if not - 0.

3. if the value from step 2 is 1, then add the value to the previous total, if not - 0."

The result of item 2 may be only 0 and -1, while item 3 needs +1.

The problems of finding clusters are usually called clustering. They can be difficult if you search clusters by a number of features: for example, pile up men's socks that are close in size and colour. In your case, with a single feature, I think it is enough to set a single-valued clustering condition, and the algorithm is easy to find. Example: find the largest group of levels, the expansion of which will lead to a decrease in the value of density calculated by the formula so-and-so. For example, the formula is: density = number of levels in the group divided by the length of the course range it covers (and even this simplest formula fails on a group of one level). There's also a question: how many times to count the same level if it occurs several times in the history.

There is also an analogue in the probability theory - mode of distribution. It can be easily found if the distribution is unimodal, i.e. probability density has exactly one maximum. But you need a criterion for selecting the right area in terms of width.

 
The longest section when the original row is below average.
 
Vladimir:

The task is underdelivered. Tried to figure out the target from the algorithm in the second post, but in it:

"2. If the number is less than the average value of the deltas obtained from item 1, then - 1, and if not - 0.

3. if the value from step 2 is 1, then add the value to the previous total, if not - 0."

There the "-" sign is used as a dash, not as a minus sign. Here are the formulas from Excel (coordinates considering the table insertion in the upper left corner)

1. =B3-B2

2. =IF(CF($C$3:$C$11)>C3;1;0)

3. =IF(D3=0;0;E2+D3)

4. =MAX(E2:E11)

5. No formula yet - we define it visually.

6. =(G6-G2)/(F2+1)

The sixth formula is semi-automatic - the maximal and minimal numbers of a series need to be corrected as needed, besides I think that it would be more correct to calculate not the difference of integers of the divisible, but to sum the delta and divide it by the number of pairs. The formula is =SUM(C3:C6)/F2

Example 1

P./P.NumberDeltaProximity valuesClose in successionMaximumDenseDensityDensity v2
1 3 4 3 1,00 1,25
2 5 2 1 1 5
3 6 1 1 2 6
4 7 1 1 3 7
5 8 1 1 4 8
6 23 15 0 0
7 27 4 1 1
8 34 7 0 0
9 36 2 1 1
10 55 19 0 0

Example 2

NO.P./P.NumberDeltaProximity valuesClose in successionMaximumDenseDensityDensity v2
1 11 2
2 12 1 1 1
3 18 6 0 0 18 1,33 2,00
4 21 3 1 1 21
5 22 1 1 2 22
6 28 6 0 0
7 36 8 0 0 36 1,00 1,50
8 37 1 1 1 37
9 39 2 1 2 39
10 55 16 0 0
 
Vladimir:

The tasks of finding clusters are usually called clustering. They can be tricky if you are searching for clusters based on a number of features at once: piling up men's socks that are close in size and colour, for example. In your case, with a single feature, I think it is enough to set a single-valued clustering condition, and the algorithm is easy to find. Example: find the largest group of levels, the expansion of which will lead to a decrease in the value of density calculated by the formula so-and-so. For example, the formula is: density = number of levels in the group divided by length of course range it covers (and even this simplest formula fails on a group of one level). There's also a question: how many times to count the same level if it occurs several times in the history.

There is also an analogue in the probability theory - mode of distribution. It can be easily found if the distribution is unimodal, i.e. probability density has exactly one maximum. But I will need a criterion for singling out the required area by its width.

Thank you for your attention. Theoretical excursus is useful, if you can see the effect of knowledge in practice - I gave the original data, showed what the result, and would be grateful if you would do the calculations with formulas and explanations in excel, and show the results. Tasks with search for socks are not applicable here, because there is a search for a similar feature, and we are in advance this feature is not known. How to apply the module here I do not understand, but then again, if I understand correctly - you need to specify the range of getting into the group yourself, and it eliminates the solution.

Answering the question "There is also a question: how many times to count the same level, if it occurs more than once in the history", if I understand correctly, the question is how to be if the numeric sequence of digits is repeated - at first glance the delta between them will be zero, which is a sign of high density and should not destroy the above algorithm.