Normalized Template Matching
Install and import#
npm install fintech-algorithmsimport { 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#
[99.874987, 100.159243, 100.421014, 100.350703, 100.560173, 100.558238]Showing 6 of 96 elements.
[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#
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.
References#
- Foundations of Technical Analysis — Andrew W. Lo, Harry Mamaysky, and Jiang Wang
- SciPy `find_peaks` — SciPy project
- The Probability of Backtest Overfitting — David H. Bailey, Jonathan M. Borwein, Marcos López de Prado, and Qiji Jim Zhu
- UCR Suite for Time-Series Subsequence Search — Eamonn Keogh and the University of California, Riverside time-series group
- Applicability decision