Vyacheslav Kornev: I think it's pretty clear. If it's not. Then write me a criterion of density, what to understand by this value.
That's the thing, it's a matter of discussion...
Whether or not you need to consider the ratio of numbers in the group to each other - you just need to look at how many numbers fit in the range of the group. Earlier I gave two methods of calculation - which one is better - I don't know.
Okay, I got it. I'll tell you what to do. You're just misleading people. You're not looking for density. You're looking for clusters. When we're working with integers.
Row : 1,2,3,4,5,6 is the density reference. 100%
Row 1,2,_,4,5,6 - is less dense.
A more dense row than 1,2,3,4,5,6. Limited to 6, does not exist.
Look, you too can eliminate 65 and 71
If only 5, we lose 21.
Or wrong? The task was to find clusters so? Our numbers are only ordinal numbers. Only the delta matters.
You propose a method of solving the problem, which shows a decent result. However, I cannot yet decide which method is better, including accuracy.
The tightest is 40 and 42
Such a group we do not have ...
I'm telling you. A smaller delta will show a higher density.
The density of a single number in relation to its neighbour, yes, but not of a group...
I think it's pretty clear. If it's not. Then write me a criterion of density, what to understand by this value.
That's the thing, it's a matter of discussion...
Whether or not you need to consider the ratio of numbers in the group to each other - you just need to look at how many numbers fit in the range of the group. Earlier I gave two methods of calculation - which one is better - I don't know.
Can you explain the practical application to me?
Second paragraph https://www.mql5.com/ru/forum/163871#comment_3938228
The script now splits the numbers into groups (areas) and calculates the density for each group.
I think the code can be simplified without losing functionality - suggestions are welcome.