Chart Pattern Triple Top

A triple top is a reversal pattern formed by three consecutive highs that are at the same level and intermediate lows between them. It is expected that after the price reaches the third maximum and then falls below the intermediate minimum level, the fall will continue further by about the amount of the difference between the highs and lows.


The inverted version of the pattern is also valid - the triple 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 7 points.


Points 2-6 in the patterns found using DTW are tied to the pivots. Points 1 and 7 are placed in low values that are less than the lowest of the intermediate minimums. Once the points are found, the indicator checks the specified maximum permissible deviation. If several found patterns are crossing each other, preference is given to the one that is largest and closest to the real-time bar.


Inputs:


Invert Pattern - Invert the pattern to find a triple 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 smallest of the intermediate minima. Percentage value.