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

Normalized Template Matching

Install and import#

bash
npm install fintech-algorithms
ts
import { match } from "fintech-algorithms/geometric-chart-patterns/pattern-matching/normalized-template-matching";

Signature#

match()

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
[99.874987, 100.159243, 100.421014, 100.350703, 100.560173, 100.558238]

Showing 6 of 96 elements.

argument 2
[0, 1, 2.5, 4.5, 6, 5]

Showing 6 of 12 elements.

Call#

match()

Returns#

object with 7 fields: template_length, best_start, best_end, correlation, distance, profile, normalization

{
  "template_length": 12,
  "best_start": 58,
  "best_end": 69,
  "correlation": 0.9999999999999999,
  "distance": 8.382057464382987e-15,
  "profile": [
    {
      "start": 0,
      "correlation": 0.5900738849254371,
      "distance": 3.136594771689436,
      "eligible": true
    },
    {
      "start": 1,
      "correlation": 0.3358103596358022,
      "distance": 3.9925620056225477,
      "eligible": true
    },
    {
      "start": 2,
      "correlation": -0.07196549176585781,
      "distance": 5.072195954651257,
      "eligible": true
    }
  ],
  "normalization": "population-z-score-per-window"
}

Diagrams#

Normalized Template Matching — algorithm anatomy
Normalized Template Matching — article hero
Normalized Template Matching — calculation ledger
Normalized Template Matching — causal timeline
Normalized Template Matching — failure boundary
Normalized Template Matching — 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 Pattern Matching family#