Pennant (Function)

image\trumpet2.gif Disclaimer

The Pennant series function returns the start and end prices of the current pennant High and Low lines.

Syntax

Value1 = Pennant(Length, MaxConsolIndex, BarsPast, oTLHiStartPr, oTLHiEndPr, oTLLoStartPr, oTLLoEndPr);

Returns

The oTLHiStartPr, oTLHiEndPr, TLLoStartPr, and oTLLoEndPr output parameters return the start and end prices of the current pennant high and low.  

The Pennant function itself returns:

  • 1 if a pennant has just been identified. (The start and end prices of the defining lines are returned as outputs.)

  • 2 if the price has broken out above the most recently completed pennant within the previous BarPast bars.

  • 3 if the price has broken out below the most recently completed pennant within the previous BarPast bars.

  • -1 if none of the above.

Parameters

Name

Type

Description

Length

Numeric

Sets the number of bars in the pennant.

MaxConsolIndex

Numeric

See algorithm step 1 in remarks.

BarPast

Numeric

See algorithm step 4 in remarks.

oTLHiStartPr

Numeric

Outputs the start price of current pennant’s hi-line.

oTLHiEndPr

Numeric

Outputs the end price of current pennant’s hi-line (this continues to be updated for BarsPast bars after the pennant is confirmed).

oTLLoStartPr

Numeric

Outputs the start price of current pennant’s lo-line.

oTLLoEndPr

Numeric

Outputs the end price of current pennant’s lo-line (this continues to be updated for BarsPast bars after the pennant is confirmed).

 

Remarks

If a new pennant is identified within BarsPast bars of the previous pennant, the new pennant supersedes the previous pennant.

For the purposes of this study, a pennant is defined as a converging consolidation pattern on a bar chart. This includes cases where the two straight lines bounding the pattern's highs and lows are sloping in opposite directions as well as in the same direction, as long as they are converging. The limiting case of when the two lines are parallel is included. Note that this definition automatically includes certain consolidation patterns that may otherwise be known as "flags".

 Algorithm

  1. Check if the Consolidation Index (True Price Channel/Average True Range) is low enough (i.e., < MaxConsolIndex) to indicate a significant degree of price consolidation. ConsolIndex values can range between 1 and Length. Low values indicate price consolidation, high values indicate price extension. To identify reasonable consolidation patterns, some suitable combinations of Length/ MaxConsolIndex could be 7/1.5 and 15/2. (Also see the RS_PriceExtension function, which looks for high values of ConsolIndex.)

  2. If price consolidation is confirmed, outline the pattern by "drawing" a linear regression line through the pattern's highs and a second such line through the pattern's lows, and check if the lines are converging.

  3. If the lines are converging, a pennant exists; finish defining the pennant by shifting the lines outwards as much as necessary to fully enclose all the bars in the consolidation pattern.

  4. For the next BarsPast bars, or until the pennant converges, whichever comes first, look for the price to breakout of the pennant, up or down, whichever comes first. (Simultaneous up and down breakouts are ignored.)

Example

inputs: Length(7), MaxConsolIndex(1.5), BarsPast(5) ;

variables: oTLHiStartPr(0), oTLHiEndPr(0), oTLLoStartPr(0), oTLLoEndPr(0) ;

Value1 = Pennant(Length, MaxConsolIndex, BarsPast, oTLHiStartPr, oTLHiEndPr, oTLLoStartPr, oTLLoEndPr) ;

Plot1(Value1) ;