TypeScript library that provides technical analysis for volume-based indicators and uses peak detection algorithms to generate pattern-based indicators.
// Volume Profile - Session-based API // Create a session for candle-based volume profile constvolumeProfileBarSession = ta.VolumeProfile.createBarSession({ valueAreaRowSize:24, valueAreaVolume:0.7, pricePrecision:2 });
// Process candles one by one for (constcandleofcandles) { volumeProfileBarSession.processCandle(candle); }
// Get value area and distribution results constvalueArea = barSession.getValueArea(); constdistribution = barSession.getVolumeDistribution();
// For raw trade data - even more precision constvolumeProfileTickSession = ta.VolumeProfile.createTickSession(); // Process each individual trade for (consttradeoftrades) { volumeProfileTickSession.processTrade(trade); } // Get detailed trade analysis with exact price levels consttickDistribution = volumeProfileTickSession.getVolumeDistribution();
// Z-Score configuration for peak/pattern detection algorithms constzScoreConfig: 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) };