/chart-patterns

TypeScript library for technical analysis of chart patterns, volume, and market structure

Primary LanguageTypeScriptMIT LicenseMIT

chart-patterns

npm version GitHub license

Advanced Technical Analysis Library for Algo Traders

chart-patterns is a comprehensive TypeScript/JavaScript library that provides technical analysis tools for financial markets. This library includes traditional candlestick pattern recognition, volume analysis, order flow insights, and market structure identification.

📊 Market & Volume Distribution

Tool Description
Market Profile Generates TPO profiles with Value Area, Initial Balance, and Point of Control.
Volume Profile Builds a volume histogram with Point of Control and Value Area.
Value Area Calculates Value Area, POC, and key volume levels from price data.

🧭 Support & Resistance

Tool Description
Peak Detector Finds swing highs/lows and directional ranges in price movement.
Pivot Points Calculates classic pivot points and support/resistance levels.
Range Finder Finds key support and resistance zones from price swings.
Zscore Measures how far price deviates from the mean — useful for spotting extremes.
Zigzags Identifies significant price swings, filtering out minor moves.

🔍 Orderflow

Footprint candles built from the Orderflow service.

Tool Description
Stacked Imbalances Finds clusters of aggressive buying or selling — potential turning points.
High Volume Node Highlights price levels with exceptionally high traded volume.

⚙️ General Indicators

Tool Description
EMA Exponential Moving Average — responds faster to price changes.
SMA Simple Moving Average — smooths out price over a defined window.
RSI Relative Strength Index — shows overbought/oversold conditions.
VWAP Volume-Weighted Average Price — key level used by institutions.

🕯️ Candlestick Patterns

Pattern Description
Doji Indicates indecision — open and close are nearly equal.
Engulfing A reversal pattern where one candle fully engulfs the previous one.
Excess Identifies candles with excess (tails/wicks) suggesting rejection.
Morning Star / Evening Star Reversal patterns formed across three candles — bullish or bearish.

Usage

import * as ta from 'chart-patterns';
import { IVolumeProfile, IMarketProfile, ILocalRange, IZScoreConfig } from 'chart-patterns/dist/types';
import { MARKET_PROFILE_PERIODS } from 'chart-patterns/dist/constants';

const marketProfiles: IMarketProfile[] = ta.MarketProfile.build({
  candles,
  candleGroupingPeriod: MARKET_PROFILE_PERIODS.DAILY,
  tickSize: 0.1,
  pricePrecision: 2,
  tickMultiplier: 100,
  timezone: 'Europe/London'
});

const volumeProfiles: IVolumeProfile[] = ta.VolumeProfile.build({
  candles,
  tickSize: 0.1,
  period: MARKET_PROFILE_PERIODS.DAILY,
  timezone: 'Europe/London'
});

// Z-Score configuration for peak/pattern detection algorithms
const zScoreConfig: IZScoreConfig = {
  lag: 2,        // Controls smoothing and adaptability to trend changes
  threshold: 0.1, // Number of standard deviations to classify a signal
  influence: 1    // How strongly signals affect future calculations (0-1)
};

const ranges: ILocalRange[] = ta.RangeBuilder.findRanges(candles, zScoreConfig);

// Create zigzag points for pattern recognition
const zigzags = ta.ZigZags.create(candles, zScoreConfig);
  • Maket Profile image

  • Ranges rr_fullsize