Skip to content

Technical Analysis Library with Market Profile, Volume Profile, Footprint Candle Patterns, Trading Ranges, and Candlestick Patterns

License

Notifications You must be signed in to change notification settings

focus1691/chart-patterns

Repository files navigation

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 Process candles or individual trades to build volume histograms 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';

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

// Volume Profile - Session-based API
// Create a session for candle-based volume profile
const barSession = ta.VolumeProfile.createBarSession({
  valueAreaRowSize: 24,
  valueAreaVolume: 0.7,
  pricePrecision: 2
});

// Process candles one by one
for (const candle of candles) {
  barSession.processCandle(candle);
}

// Get value area and distribution results
const valueArea = barSession.getValueArea();
const distribution = barSession.getVolumeDistribution();

// For raw trade data - even more precision
const tickSession = ta.VolumeProfile.createTickSession();
// Process each individual trade
for (const trade of trades) {
  tickSession.processTrade(trade);
}
// Get detailed trade analysis with exact price levels
const tickDistribution = tickSession.getVolumeDistribution();

// 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

About

Technical Analysis Library with Market Profile, Volume Profile, Footprint Candle Patterns, Trading Ranges, and Candlestick Patterns

Topics

Resources

License

Stars

Watchers

Forks