You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

chart-patterns

Package Overview
Dependencies
Maintainers
0
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chart-patterns

Trading Chart Patterns

1.0.26
latest
npmnpm
Version published
Weekly downloads
185
66.67%
Maintainers
0
Weekly downloads
 
Created
Source

chart-patterns

npm version GitHub license

TypeScript library that provides technical analysis for volume-based indicators and uses peak detection algorithms to generate pattern-based indicators.

📊 Market & Volume Distribution

ToolDescription
Market ProfileGenerates TPO profiles with Value Area, Initial Balance, and Point of Control.
Volume ProfileGenerate Volume Profiles to find the Value Area. Process either Kline or tick data to build these profiles.

🧭 Z-Score Tools for Ranges & Swings

ToolDescription
DivergencesDetects bullish/bearish divergences between price and indicators (MFI, RSI).
Peak DetectorZ-Score-based Peak Detector to find swing highs and lows.
Range FinderFinds key support and resistance zones from price swings.
ZigzagsHighlights major price swings only.
ZscoreMeasures how far price deviates from the mean — useful for spotting extremes.

🔍 Orderflow

Requires raw trade data. More information can be found in my blog post here.

ToolDescription
Stacked ImbalancesFinds clusters of aggressive buying or selling — potential turning points.
High Volume NodeHighlights price levels with exceptionally high traded volume.

⚙️ General Indicators

ToolDescription
EMAExponential Moving Average — a weighted moving average that reacts quickly to price.
MFIMoney Flow Index — Volume-based oscillator showing buy/sell pressure.
Pivot PointsCalculates pivot, support, and resistance levels.
RSIRelative Strength Index — Measures momentum to spot overbought/oversold.
SMASimple Moving Average — Simple average of price over a period.
Stochastic RSITracks RSI momentum shifts.
VWAPAverage price weighted by volume.

🕯️ Candlestick Patterns

PatternDescription
DojiSignals indecision — open and close are nearly equal.
EngulfingReversal pattern where one candle fully engulfs the previous.
ExcessDetects large wicks, suggesting rejection from highs or lows.
HaramiSmall candle inside a larger one — potential reversal.
Homing PigeonTwo small-bodied candles in a downtrend — possible bullish reversal.
Inverted HammerSmall body with long upper wick — potential bullish reversal.
MarubozuFull-body candle with no wicks — strong directional move.
Morning Star / Evening StarThree-candle reversal pattern — bullish (morning) or bearish (evening).

Usage

import * as ta from 'chart-patterns';
import { IMarketProfile, ILocalRange, IZScoreConfig, IDivergence } from 'chart-patterns/dist/types';
import { MARKET_PROFILE_PERIODS, SIGNAL_DIRECTION } 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 volumeProfileBarSession = ta.VolumeProfile.createBarSession({
  valueAreaRowSize: 24,
  valueAreaVolume: 0.7,
  pricePrecision: 2
});

// Process candles one by one
candles.forEach((candle) => volumeProfileBarSession.processCandle(candle));

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

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

// Money Flow Index - volume-based momentum oscillator
const mfiValues = ta.MFI.calculateMFI(candles, 14);

// RSI and Stochastic RSI
const rsiValues = ta.RSI.calculateRSI(candles, 14);
const stochRsiResult = ta.RSI.calculateStochasticRSI(candles, 14, 14, 3, 3);

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

const zScoreConfigDivergences: IZScoreConfig = {
  lag: 3,
  threshold: 1,
  influence: 0.75
};

// Divergence Detection - Find divergences between price and indicators
const mfiDivergences: IDivergence[] = ta.Divergences.mfi(candles, zScoreConfigDivergences, 14);
const rsiDivergences: IDivergence[] = ta.Divergences.rsi(candles, zScoreConfigDivergences, 14);

// Candlestick Pattern Detection - Excess (large wicks indicating rejection)
const excessDirection: SIGNAL_DIRECTION = ta.CandlestickPatterns.getCandleExcessDirection(candles[0]);

Visualisations

Market ProfileMFI Divergence
Market Profile visualization showing TPO distribution with Value Area, POC, and VAH/VAL highlighted Screenshot from 2025-07-30 17-28-54
Range Detection
Range detection visualization showing support and resistance levels identified on BTC/USDT price action

FAQs

Package last updated on 30 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts