# Pennant

`D08-F03-A05` · Geometric Chart Patterns → Continuation Structures · archetype `row-classify` · difficulty 2/5 · verification **contract**

Full page: https://docs.thefintechbuilder.com/geometric-chart-patterns/continuation-structures/pennant/
Agent skill: `npx skills add IslamBaraka90/Fintech-Algorithms-Library` — https://docs.thefintechbuilder.com/guides/agent-skill/

## Install and import

```bash
npm install fintech-algorithms
```

```ts
import { detectPennant } from "fintech-algorithms/geometric-chart-patterns/continuation-structures/pennant";
```

## Signature

```ts
detectPennant()
```

## Worked example

This entry is a thin wrapper its test never calls directly, so it was invoked with the arguments its shared implementation received. Real output, not asserted against a published figure.

### Input

`argument 1`:

```json
[92, 94.416667, 96.833333, 99.25, 101.666667, 104.083333]
```

Showing 6 of 96 elements.

### Call

```ts
detectPennant()
```

### Returns

object with 7 fields: pattern, state, reason, event, events, pivots, parameters

```json
{
  "pattern": "pennant",
  "state": "confirmed",
  "reason": "breakout-confirmed",
  "event": {
    "pattern": "pennant",
    "state": "confirmed",
    "reason": "breakout-confirmed",
    "pivot_indices": [16, 22, 28, 34, 40, 46],
    "pivot_prices": [125, 115, 123, 116.5, 121, 118],
    "pivot_types": ["high", "low", "high", "low", "high", "low"],
    "candidate_available_index": 48,
    "confirmation_index": 49,
    "breakout_direction": "bullish",
    "expected_direction": "bullish",
    "subtype": null,
    "upper_boundary": 119.5,
    "lower_boundary": 118.375,
    "metrics": {
      "upper_slope": -0.16666666666666666,
      "lower_slope": 0.125,
      "upper_relative_slope": -0.0013917884481558802,
      "lower_relative_slope": 0.0010438413361169101,
      "upper_intercept": 127.66666666666667,
      "lower_intercept": 112.25,
      "width_start": 10.75,
      "width_end": 2,
      "convergence": 0.813953488372093,
      "parallel_gap": 0.0024356297842727903,
      "impulse": 0.22950819269013703,
      "impulse_direction": "bullish",
      "formation_bars": 30
    }
  },
  "events": [
    {
      "pattern": "pennant",
      "state": "confirmed",
      "reason": "breakout-confirmed",
      "pivot_indices": [16, 22, 28, 34, 40, 46],
      "pivot_prices": [125, 115, 123, 116.5, 121, 118],
      "pivot_types": ["high", "low", "high", "low", "high", "low"],
      "candidate_available_index": 48,
      "confirmation_index": 49,
      "breakout_direction": "bullish",
      "expected_direction": "bullish",
      "subtype": null,
      "upper_boundary": 119.5,
      "lower_boundary": 118.375,
      "metrics": {
        "upper_slope": -0.16666666666666666,
        "lower_slope": 0.125,
        "upper_relative_slope": -0.0013917884481558802,
        "lower_relative_slope": 0.0010438413361169101,
        "upper_intercept": 127.66666666666667,
        "lower_intercept": 112.25,
        "width_start": 10.75,
        "width_end": 2,
        "convergence": 0.813953488372093,
        "parallel_gap": 0.0024356297842727903,
        "impulse": 0.22950819269013703,
        "impulse_direction": "bullish",
        "formation_bars": 30
      }
    }
  ],
  "pivots": [
    {
      "kind": "high",
      "index": 16,
      "confirmation_index": 18,
      "price": 125
    },
    {
      "kind": "low",
      "index": 22,
      "confirmation_index": 24,
      "price": 115
    },
    {
      "kind": "high",
      "index": 28,
      "confirmation_index": 30,
      "price": 123
    }
  ],
  "parameters": {
    "pivot_left": 2,
    "pivot_right": 2,
    "pivots_per_side": 3,
    "max_pattern_bars": 44,
    "max_confirmation_bars": 4,
    "impulse_lookback": 12,
    "flat_tolerance": 0.00045,
    "min_slope": 0.00022,
    "parallel_tolerance": 0.00035,
    "min_convergence": 0.18,
    "min_impulse": 0.055,
    "break_buffer": 0.001
  }
}
```

## Other exports

`tracePennant`. Every module additionally exports `run` as an alias of its primary
function, and a `meta` object carrying its catalog id, domain, family, shape and article URL.

## Verification and provenance

Tier: **contract**.

The module loads, the entry point is callable and its declared signature matches the compiled code. The example below is real captured output, but no independently published figure asserts the numbers.

Both tiers guarantee the signature. Full explanation: https://docs.thefintechbuilder.com/guides/verification/

Generated from the docs.json payload shipped inside fintech-algorithms@0.12.0.
The signature and parameter list are checked against the compiled implementation at build time,
so a description that contradicts the code fails the build rather than reaching this file.

## Links

- Article (how it works, step by step): https://thefintechbuilder.com/geometric-chart-patterns/continuation-structures/pennant/
- Implementation source: https://github.com/IslamBaraka90/Fintech-Algorithms-Library/blob/main/src/geometric-chart-patterns/continuation-structures/pennant/impl.ts
- Package on npm: https://www.npmjs.com/package/fintech-algorithms
- Domain index for agents: https://docs.thefintechbuilder.com/geometric-chart-patterns/llms.txt
