A double top is a reversal pattern formed by two consecutive highs that are at the same level and an intermediate minimum between them. It is expected that after the price reaches the maximum again and then falls below the intermediate minimum level, the fall will continue further by about the amount of the difference between the highs and the minimum.
The inverted version of the pattern is also valid - double bottom.
The indicator analyzes the last 600 bars in search of patterns. The DTW (Dynamic Time Warping) algorithm is used for the primary recognition. This algorithm allows you to find compressed and time-stretched sequences of values of the specified source that match a given template of 5 points.
Points 2, 3 and 4 in the patterns found using DTW are tied to the pivots. Points 1 and 5 are placed in low values that are less than the intermediate minimum (point 3). Then the indicator checks the rules and the specified maximum permissible deviation. If several patterns cross each other, the preference is given to the one that is larger and closer to the real-time bar.
Invert Pattern - Invert the pattern to find a double bottom.
Source - Source for the primary search. The indicator searches for the pattern in the source data using the DTW algorithm.
Permissible Deviation - The maximum allowable difference in the height of the tops. The height of the top is calculated from the intermediate minimum. Percentage value.