fintech-algorithms
Using a coding agent? Give it the skill: npx skills add IslamBaraka90/Fintech-Algorithms-Library What it does →

Continuation Structures

6 algorithms in Geometric Chart Patterns.

In this family#

  1. Ascending Triangle contract

    Scans a close series for an ascending triangle - a flat ceiling sitting over a rising floor - and reports whether that shape is still forming, has broken out, or was rejected. The two boundaries are least-squares lines fitted through the confirmed swing highs and swing lows of a pivot window; the shape passes when the ceiling's relative slope is within flat_tolerance of zero, the floor's is at least min_slope, and the channel narrows by at least min_convergence. A close beyond either boundary by break_buffer within max_confirmation_bars of the last pivot ends the search, and only a bullish break confirms.

    detectAscendingTriangle(close, parameters)
  2. Descending Triangle contract

    Scans a close series for a descending triangle - a falling ceiling pressing down on a flat floor - and reports whether that shape is still forming, has broken out, or was rejected. The two boundaries are least-squares lines fitted through the confirmed swing highs and swing lows of a pivot window; the shape passes when the floor's relative slope is within flat_tolerance of zero, the ceiling's is at most -min_slope, and the channel narrows by at least min_convergence. A close beyond either boundary by break_buffer within max_confirmation_bars of the last pivot ends the search, and only a bearish break confirms.

    detectDescendingTriangle(close, parameters)
  3. Symmetrical Triangle contract

    Scans a close series for a symmetrical triangle - a falling ceiling and a rising floor closing on each other - and reports whether that shape is still forming, has broken out, or was rejected. The shape passes when the fitted ceiling's relative slope is at most -min_slope, the floor's is at least min_slope, and the channel narrows by at least min_convergence. The prior move over impulse_lookback bars sets the expected side only when its size reaches min_impulse; without that, a break through either boundary by break_buffer confirms.

    detectSymmetricalTriangle(close, parameters)
  4. Flag contract

    Scans a close series for a flag - a strong prior move followed by a narrow channel drifting against it - and reports whether that shape is still forming, has broken out, or was rejected. The shape passes when the move over impulse_lookback bars reaches min_impulse, both fitted boundaries slope against it by more than min_slope, the gap between their relative slopes is within parallel_tolerance, and the channel ends between 0.65 and 1.35 times its starting width. Only a break in the impulse's own direction, by break_buffer within max_confirmation_bars of the last pivot, confirms.

    detectFlag(close, parameters)
  5. Pennant contract

    Scans a close series for a pennant - a strong prior move followed by a small converging triangle - and reports whether that shape is still forming, has broken out, or was rejected. The shape passes when the move over impulse_lookback bars reaches min_impulse, the fitted ceiling's relative slope is at most -min_slope, the floor's is at least min_slope, and the channel narrows by at least min_convergence. Only a break in the impulse's own direction, by break_buffer within max_confirmation_bars of the last pivot, confirms.

    detectPennant(close, parameters)
  6. Rising/Falling Wedge contract

    Scans a close series for a wedge - two boundaries tilted the same way while converging - and reports whether that shape is still forming, has broken out, or was rejected. A rising wedge needs both fitted slopes at or above min_slope with the floor rising faster than the ceiling, and expects a bearish break; a falling wedge needs both at or below -min_slope with the ceiling falling faster than the floor, and expects a bullish break. Either way the channel must narrow by at least min_convergence, the matching subtype (rising or falling) is reported on the event, and a break the other way is recorded as rejected.

    detectRisingFallingWedge(close, parameters)

What they share#

Every topic here is a row-classify, so once you have called one the rest follow the same shape. Import paths differ only in the final segment:

ts
import { detectAscendingTriangle } from "fintech-algorithms/geometric-chart-patterns/continuation-structures/ascending-triangle";
import { detectDescendingTriangle } from "fintech-algorithms/geometric-chart-patterns/continuation-structures/descending-triangle";

Read them in the order above — the sequence is pedagogical, not alphabetical.

Where this sits#

Geometric Chart Patterns collects 64 algorithms across 7 families. For the concept behind this family rather than the call signatures, see the concept guides.