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

Descending Triangle

Install and import#

bash
npm install fintech-algorithms
ts
import { detectDescendingTriangle } from "fintech-algorithms/geometric-chart-patterns/continuation-structures/descending-triangle";

Signature#

detectDescendingTriangle()

Worked example#

executed 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
[140, 138, 136, 134, 132, 130]

Showing 6 of 96 elements.

Call#

detectDescendingTriangle()

Returns#

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

{
  "pattern": "descending_triangle",
  "state": "confirmed",
  "reason": "breakout-confirmed",
  "event": {
    "pattern": "descending_triangle",
    "state": "confirmed",
    "reason": "breakout-confirmed",
    "pivot_indices": [16, 22, 28, 34, 40, 46],
    "pivot_prices": [108, 122, 108, 118, 108.1, 115],
    "pivot_types": ["low", "high", "low", "high", "low", "high"],
    "candidate_available_index": 48,
    "confirmation_index": 50,
    "breakout_direction": "bearish",
    "expected_direction": "bearish",
    "subtype": null,
    "upper_boundary": 113.66666666666667,
    "lower_boundary": 108.125,
    "metrics": {
      "upper_slope": -0.2916666666666667,
      "lower_slope": 0.00416666666666643,
      "upper_relative_slope": -0.0025769400677367106,
      "lower_relative_slope": 0.00003681342953909377,
      "upper_intercept": 128.25,
      "lower_intercept": 107.91666666666669,
      "width_start": 15.59999999999998,
      "width_end": 6.72499999999998,
      "convergence": 0.5689102564102572,
      "parallel_gap": 0.002613753497275804,
      "impulse": -0.18181818181818182,
      "impulse_direction": "bearish",
      "formation_bars": 30
    }
  },
  "events": [
    {
      "pattern": "descending_triangle",
      "state": "confirmed",
      "reason": "breakout-confirmed",
      "pivot_indices": [16, 22, 28, 34, 40, 46],
      "pivot_prices": [108, 122, 108, 118, 108.1, 115],
      "pivot_types": ["low", "high", "low", "high", "low", "high"],
      "candidate_available_index": 48,
      "confirmation_index": 50,
      "breakout_direction": "bearish",
      "expected_direction": "bearish",
      "subtype": null,
      "upper_boundary": 113.66666666666667,
      "lower_boundary": 108.125,
      "metrics": {
        "upper_slope": -0.2916666666666667,
        "lower_slope": 0.00416666666666643,
        "upper_relative_slope": -0.0025769400677367106,
        "lower_relative_slope": 0.00003681342953909377,
        "upper_intercept": 128.25,
        "lower_intercept": 107.91666666666669,
        "width_start": 15.59999999999998,
        "width_end": 6.72499999999998,
        "convergence": 0.5689102564102572,
        "parallel_gap": 0.002613753497275804,
        "impulse": -0.18181818181818182,
        "impulse_direction": "bearish",
        "formation_bars": 30
      }
    }
  ],
  "pivots": [
    {
      "kind": "low",
      "index": 16,
      "confirmation_index": 18,
      "price": 108
    },
    {
      "kind": "high",
      "index": 22,
      "confirmation_index": 24,
      "price": 122
    },
    {
      "kind": "low",
      "index": 28,
      "confirmation_index": 30,
      "price": 108
    }
  ],
  "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#

This module also exports traceDescendingTriangle. 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.

Diagrams#

Descending Triangle — algorithm anatomy
Descending Triangle — article hero
Descending Triangle — calculation ledger
Descending Triangle — causal timeline
Descending Triangle — failure boundary
Descending Triangle — method comparison

How it works#

This page states the contract — how to call it correctly. The article explains the concept: why it works, and where it breaks.

Read the article →

References#

The rest of the Continuation Structures family#