This indicator automatically draws bearish pennant patterns and price projections derived from the ranges that constitute the patterns.
█ CONCEPTS
Green and Red Candles
• A green candle is one that closes with a close price equal to or above the price it opened. • A red candle is one that closes with a close price that is lower than the price it opened.
Swing Highs and Swing Lows
• A swing high is a green candle or series of consecutive green candles followed by a single red candle to complete the swing and form the peak. • A swing low is a red candle or series of consecutive red candles followed by a single green candle to complete the swing and form the trough.
Peak and Trough Prices (Basic)
• The peak price of a complete swing high is the high price of either the red candle that completes the swing high or the high price of the preceding green candle, depending on which is higher. • The trough price of a complete swing low is the low price of either the green candle that completes the swing low or the low price of the preceding red candle, depending on which is lower.
Historic Peaks and Troughs
The current, or most recent, peak and trough occurrences are referred to as occurrence zero. Previous peak and trough occurrences are referred to as historic and ordered numerically from right to left, with the most recent historic peak and trough occurrences being occurrence one.
Broken and Unbroken Peaks and Troughs
Upon the completion of a new swing low the high of the green candle that completes the swing low will be above, below or equal to the current peak price. And similarly, upon the completion of a new swing high the low of the red candle that completes the swing high will be above, below or equal to the current trough price.
If the high price of the green candle that completes the current swing low is higher than or equal to the current peak price then the current peak is broken. If the high of the green candle that completes the current swing low is below the current peak price, then the current peak is unbroken.
Similarly, if the low price of the red candle that completes the current swing high is lower than or equal to the current trough price then the current trough is broken. If the low price of the red candle that completes the current swing high is above the current trough price, then the current trough is unbroken.
Range
The range is simply the difference between the current peak and current trough prices, generally expressed in terms of points or pips.
Upper Trends
• A return line uptrend is formed when the current peak price is higher than the preceding peak price. • A downtrend is formed when the current peak price is lower than the preceding peak price. • A double-top is formed when the current peak price is equal to the preceding peak price.
Lower Trends
• An uptrend is formed when the current trough price is higher than the preceding trough price. • A return line downtrend is formed when the current trough price is lower than the preceding trough price. • A double-bottom is formed when the current trough price is equal to the preceding trough price.
Wave Cycles
A wave cycle is here defined as a complete two-part move between a swing high and a swing low, or a swing low and a swing high. The first swing high or swing low will set the course for the sequence of wave cycles that follow; for example a chart that begins with a swing low will form its first complete wave cycle upon the formation of the first complete swing high and vice versa.
Figure 1.
Retracement and Extension Ratios
Retracement and extension ratios are calculated by dividing the current range by the preceding range and multiplying the answer by 100. Retracement ratios are those that are equal to or below 100% of the preceding range and extension ratios are those that are above 100% of the preceding range.
Bullish and Bearish Pennant Patterns
• Bullish pennants are generally composed of three troughs and two peaks. The first peak being higher than the second peak and the first trough being lower than both the second and third troughs, with the third trough being higher than the second trough. • Bearish pennants are generally composed of three peaks and two troughs. The first trough being lower than the second trough and the first peak being higher than both the second and third peaks, with third peak being lower than the second peak.
In this script I have used minimum and maximum retracement and extension ratios to set parameters for pattern identification:
• Wave 1 of the pattern, referred to as AB, is set to a minimum ratio of 100%. • Wave 2 of the pattern, referred to as BC, is set to a maximum ratio of 30%. • Wave 3 of the pattern, referred to as CD, has no ratio measurements but will always be below 100% by default. • Wave 4 of the pattern, referred to as DE, has no ratio measurements but will always be below 100% by default.
█ FEATURES
Inputs
• Unbroken Troughs • AB Minimum Ratio • BC Maximum Ratio • Pole Color • Flag Color • Extend Current Flag Lines • Show Labels • Label Color • Show Projection Lines • Extend Current Projection Lines
Alerts
Users can set alerts for when the patterns occur.
█ LIMITATIONS
All green and red candle calculations are based on differences between open and close prices, as such I have made no attempt to account for green candles that gap lower and close below the close price of the preceding candle, or red candles that gap higher and close above the close price of the preceding candle. This may cause some unexpected behaviour on some markets and timeframes. I can only recommend using 24-hour markets, if and where possible, as there are far fewer gaps and, generally, more data to work with.