Chart Pattern Pennant

Pennant is a figure of technical analysis implying the continuation of the main trend after the consolidation section. The main trend forms a flagpole, and the consolidation area is a triangle pennant. It is expected that after the price breaks through the pennant line in the direction of the main trend, further price growth will be approximately equal to the size of the flagpole.

Inverted version of the pennant found in the downtrend is also valid.

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 with a given template of 5 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:

In the interval between points 2 and 5, the price is allowed to cross the pennant lines with ‘high’ and ‘low’, but not with ‘close’ or ‘open’. The largest non-overlapping pennants among the found patterns that fit the description above are drawn on the chart.


Invert Pattern - Invert the pattern to search for a pennant in the downtrend.

Source - Source for the primary search. The indicator searches for the pattern in the source data using the DTW algorithm.