You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TypeScript library that provides technical analysis for volume-based indicators and uses peak detection algorithms to generate pattern-based indicators.
Three-candle reversal pattern β bullish (morning) or bearish (evening).
Usage
import*astafrom'chart-patterns';import{IMarketProfile,ILocalRange,IZScoreConfig}from'chart-patterns/dist/types';import{MARKET_PROFILE_PERIODS,SIGNAL_DIRECTION}from'chart-patterns/dist/constants';// Market ProfileconstmarketProfiles: 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 profileconstvolumeProfileBarSession=ta.VolumeProfile.createBarSession({valueAreaRowSize: 24,valueAreaVolume: 0.7,pricePrecision: 2});// Process candles one by onefor(constcandleofcandles){volumeProfileBarSession.processCandle(candle);}// Get value area and distribution resultsconstvalueArea=barSession.getValueArea();constdistribution=barSession.getVolumeDistribution();// For raw trade data - even more precisionconstvolumeProfileTickSession=ta.VolumeProfile.createTickSession();// Process each individual tradefor(consttradeoftrades){volumeProfileTickSession.processTrade(trade);}// Get detailed trade analysis with exact price levelsconsttickDistribution=volumeProfileTickSession.getVolumeDistribution();// Money Flow Index - volume-based momentum oscillatorconstmfiValues=ta.MFI.calculateMFI(candles,14);// RSI and Stochastic RSIconstrsiValues=ta.RSI.calculateRSI(candles,14);conststochRsiResult=ta.RSI.calculateStochasticRSI(candles,14,14,3,3);// Z-Score configuration for peak/pattern detection algorithmsconstzScoreConfig: IZScoreConfig={lag: 2,// Controls smoothing and adaptability to trend changesthreshold: 0.1,// Number of standard deviations to classify a signalinfluence: 1// How strongly signals affect future calculations (0-1)};constranges: ILocalRange[]=ta.RangeBuilder.findRanges(candles,zScoreConfig);// Create zigzag points for pattern recognitionconstzigzags=ta.ZigZags.create(candles,zScoreConfig);// Candlestick Pattern Detection - Excess (large wicks indicating rejection)constexcessDirection: SIGNAL_DIRECTION=ta.CandlestickPatterns.getCandleExcessDirection(candles[0]);// Returns: SIGNAL_DIRECTION.BULLISH (long lower wick), BEARISH (long upper wick), // BIDIRECTIONAL (both), or NONE// Process multiple candles for excess patternsconstexcessSignals=candles.map(candle=>({timestamp: candle.timestamp,direction: ta.CandlestickPatterns.getCandleExcessDirection(candle)})).filter(signal=>signal.direction!==ta.SIGNAL_DIRECTION.NONE);
Visualisations
Market Profile Output
Range Detection Output
About
TypeScript library for technical analysis of chart patterns, volume, and market structure