fintech-algorithms

Inverse Head and Shoulders

Install and import

bash
npm install fintech-algorithms
ts
import { inverse_head_and_shoulders } from "fintech-algorithms/geometric-chart-patterns/reversal-structures/inverse-head-and-shoulders";

Signature

inverse_head_and_shoulders()

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
[120, 118.875, 117.75, 116.625, 115.5, 114.375]

Showing 6 of 72 elements.

Call

inverse_head_and_shoulders()

Returns

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

{
  "pattern": "inverse_head_and_shoulders",
  "state": "confirmed",
  "reason": "neckline-break-confirmed",
  "event": {
    "pattern": "inverse_head_and_shoulders",
    "pivot_indices": [14, 22, 31, 39, 47],
    "pivot_prices": [102, 111, 93, 110, 101],
    "pivot_types": ["low", "high", "low", "high", "low"],
    "candidate_available_index": 49,
    "confirmation_index": 56,
    "neckline": 109,
    "metrics": {
      "test_mean": 101.5,
      "level_spread": 0.009852216748768473,
      "retracement_min": 0.08374384236453201,
      "head_dominance": 0.08374384236453201,
      "formation_bars": 33,
      "min_separation": 8
    },
    "prior_move": 0.08823529411764706,
    "state": "confirmed",
    "reason": "neckline-break-confirmed",
    "direction": "bullish"
  },
  "events": [
    {
      "pattern": "inverse_head_and_shoulders",
      "pivot_indices": [14, 22, 31, 39, 47],
      "pivot_prices": [102, 111, 93, 110, 101],
      "pivot_types": ["low", "high", "low", "high", "low"],
      "candidate_available_index": 49,
      "confirmation_index": 56,
      "neckline": 109,
      "metrics": {
        "test_mean": 101.5,
        "level_spread": 0.009852216748768473,
        "retracement_min": 0.08374384236453201,
        "head_dominance": 0.08374384236453201,
        "formation_bars": 33,
        "min_separation": 8
      },
      "prior_move": 0.08823529411764706,
      "state": "confirmed",
      "reason": "neckline-break-confirmed",
      "direction": "bullish"
    }
  ],
  "pivots": [
    {
      "kind": "low",
      "index": 14,
      "confirmation_index": 16,
      "price": 102
    },
    {
      "kind": "high",
      "index": 22,
      "confirmation_index": 24,
      "price": 111
    },
    {
      "kind": "low",
      "index": 31,
      "confirmation_index": 33,
      "price": 93
    }
  ],
  "parameters": {
    "pivot_left": 2,
    "pivot_right": 2,
    "min_swing_bars": 5,
    "max_pattern_bars": 40,
    "max_confirmation_bars": 15,
    "trend_lookback": 6,
    "level_tolerance": 0.025,
    "shoulder_tolerance": 0.025,
    "min_retracement": 0.05,
    "head_margin": 0.05,
    "min_prior_trend": 0.03,
    "break_buffer": 0
  }
}

Other exports

This module also exports confirmedPivots, detectReversal, traceReversal, double_top, double_bottom, triple_top, triple_bottom, head_and_shoulders. 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

Inverse Head and Shoulders — inverse head and shoulders anatomy

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

  • Claim-to-source map