The rectangle forms the price movement between two horizontal lines. A rectangle is considered an undefined pattern. It is expected that after the price crosses one of the horizontal lines, it will proceed moving for approximately the height of the rectangle in the direction of the breakthrough.
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 4 points. The points found by the DTW are tied to pivots. Once they are found, the indicator checks whether the points comply with the pattern’s rules and the specified maximum permissible deviation: in the interval between the first and the last points, the price is allowed to cross the horizontal lines with ‘high’ and ‘low’, but not with ‘close’ or ‘open’. The largest non-intersecting rectangles among the found patterns that fit the description above are drawn on the chart.
Invert Pattern - Changes the sequence of minima and maxima in the rectangle: the pattern starts with a high pivot if this is ‘false’ and with a low pivot if switched to ‘true’.
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 deviation of points from horizontal lines. It is calculated as a percentage of the height of the rectangle.