
Security News
TC39 Advances 11 Proposals for Math Precision, Binary APIs, and More
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
chart-patterns
Advanced tools
TypeScript library that provides technical analysis for volume-based indicators and uses peak detection algorithms to generate pattern-based indicators.
Tool | Description |
---|---|
Market Profile | Generates TPO profiles with Value Area, Initial Balance, and Point of Control. |
Volume Profile | Generate Volume Profiles to find the Value Area. Process either Kline or tick data to build these profiles. |
Tool | Description |
---|---|
Divergences | Detects bullish/bearish divergences between price and indicators (MFI, RSI). |
Peak Detector | Z-Score-based Peak Detector to find swing highs and lows. |
Range Finder | Finds key support and resistance zones from price swings. |
Zigzags | Highlights major price swings only. |
Zscore | Measures how far price deviates from the mean — useful for spotting extremes. |
Requires raw trade data. More information can be found in my blog post here.
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. |
Tool | Description |
---|---|
EMA | Exponential Moving Average — a weighted moving average that reacts quickly to price. |
MFI | Money Flow Index — Volume-based oscillator showing buy/sell pressure. |
Pivot Points | Calculates pivot, support, and resistance levels. |
RSI | Relative Strength Index — Measures momentum to spot overbought/oversold. |
SMA | Simple Moving Average — Simple average of price over a period. |
Stochastic RSI | Tracks RSI momentum shifts. |
VWAP | Average price weighted by volume. |
Pattern | Description |
---|---|
Doji | Signals indecision — open and close are nearly equal. |
Engulfing | Reversal pattern where one candle fully engulfs the previous. |
Excess | Detects large wicks, suggesting rejection from highs or lows. |
Harami | Small candle inside a larger one — potential reversal. |
Homing Pigeon | Two small-bodied candles in a downtrend — possible bullish reversal. |
Inverted Hammer | Small body with long upper wick — potential bullish reversal. |
Marubozu | Full-body candle with no wicks — strong directional move. |
Morning Star / Evening Star | Three-candle reversal pattern — bullish (morning) or bearish (evening). |
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]);
Market Profile | MFI Divergence |
|
|
Range Detection | |
|
FAQs
Trading Chart Patterns
The npm package chart-patterns receives a total of 181 weekly downloads. As such, chart-patterns popularity was classified as not popular.
We found that chart-patterns demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.