npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

fast-technical-indicators

v1.1.4

Published

High-performance technical indicators with zero dependencies - compatible with technicalindicators package

Readme

Fast Technical Indicators

npm version License: MIT TypeScript

A high-performance, zero-dependency technical indicators library for JavaScript and TypeScript. 100% API-compatible with the popular technicalindicators package, but with significant performance improvements and no external dependencies.

This library powers the Algoticker no-code algorithmic trading platform, but can be used independently in any JavaScript/Node.js project.

🚀 Why Fast Technical Indicators?

  • 🔥 High Performance: Optimized algorithms with minimal overhead
  • 📦 Zero Dependencies: No external packages required
  • 🔄 100% Compatible: Drop-in replacement for technicalindicators
  • 🎯 Self-Sufficient: Each indicator method is completely independent
  • 📊 Streaming Support: Real-time data processing with nextValue()
  • 🛡️ Type Safe: Full TypeScript support with comprehensive type definitions
  • ✅ Well Tested: Extensive test suite comparing against reference implementation

📈 Performance

Benchmarks show significant performance improvements over the original technicalindicators package:

| Indicator | Performance Improvement | |-----------|------------------------| | SMA | 3.6x - 9.6x faster | | EMA | 2.5x - 8.8x faster | | RSI | 6.4x - 8.6x faster | | MACD | 4.9x - 7.9x faster | | WMA | 5.1x - 7.1x faster | | CCI | 3.1x - 6.4x faster | | Stochastic | 1.3x - 1.8x faster | | Bollinger Bands | 1.4x - 6.3x faster | | ATR | 2.3x - 6.3x faster | | OBV | 1.0x - 5.9x faster |

Performance improvements scale with dataset size. Larger datasets show more dramatic speedups.

Run benchmarks yourself: npm run benchmark

🛠️ Installation

npm install fast-technical-indicators

📚 Usage

Basic Usage (Functional API)

import { sma, ema, rsi, macd, bollingerbands } from 'fast-technical-indicators';

const prices = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];

// Simple Moving Average
const smaResult = sma({ period: 4, values: prices });
console.log(smaResult); // [2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5]

// Exponential Moving Average
const emaResult = ema({ period: 4, values: prices });

// Relative Strength Index
const rsiResult = rsi({ period: 14, values: prices });

// MACD
const macdResult = macd({ 
  values: prices, 
  fastPeriod: 12, 
  slowPeriod: 26, 
  signalPeriod: 9 
});

// Bollinger Bands
const bbResult = bollingerbands({ 
  period: 20, 
  values: prices, 
  stdDev: 2 
});

Class-Based API (Streaming)

Perfect for real-time data processing:

import { SMA, EMA, RSI, MACD } from 'fast-technical-indicators';

// Initialize indicators
const smaIndicator = new SMA({ period: 20, values: [] });
const rsiIndicator = new RSI({ period: 14, values: [] });

// Process data point by point
const prices = [100, 101, 99, 102, 98, 103];

prices.forEach(price => {
  const smaValue = smaIndicator.nextValue(price);
  const rsiValue = rsiIndicator.nextValue(price);
  
  if (smaValue !== undefined) {
    console.log(`SMA: ${smaValue}`);
  }
  
  if (rsiValue !== undefined) {
    console.log(`RSI: ${rsiValue}`);
  }
});

🔧 Available Indicators

Moving Averages

  • SMA - Simple Moving Average
  • EMA - Exponential Moving Average
  • WMA - Weighted Moving Average
  • WEMA - Wilder's Exponential Moving Average
  • MACD - Moving Average Convergence Divergence

Oscillators

  • RSI - Relative Strength Index
  • CCI - Commodity Channel Index
  • Awesome Oscillator - Awesome Oscillator (AO)
  • Stochastic RSI - Stochastic RSI (%K, %D)

Momentum Indicators

  • ROC - Rate of Change
  • Stochastic - Stochastic Oscillator (%K, %D)
  • Williams %R - Williams Percent Range
  • TRIX - Triple Exponential Moving Average
  • Ultimate Oscillator - Multiple timeframe momentum oscillator
  • DPO - Detrended Price Oscillator (removes trend component)
  • Price Oscillator - Difference between fast and slow moving averages
  • PPO - Percentage Price Oscillator (MACD in percentage terms)
  • PSAR - Parabolic Stop and Reverse
  • KST - Know Sure Thing

Volume Indicators

  • OBV - On-Balance Volume
  • ADL - Accumulation/Distribution Line
  • VWAP - Volume Weighted Average Price
  • Force Index - Force Index
  • MFI - Money Flow Index
  • Volume Profile - Volume Profile analysis

Volatility Indicators

  • Bollinger Bands - Bollinger Bands with %B and Width
  • ATR - Average True Range
  • Donchian Channels - Highest high and lowest low channels with middle line
  • Volatility Index - Statistical measure of price volatility
  • Keltner Channels - Keltner Channels
  • Chandelier Exit - Chandelier Exit stop loss

Directional Movement

  • True Range - True Range calculation
  • ADX - Average Directional Index

Trend Indicators

  • SuperTrend - Trend-following indicator using ATR
  • Aroon Indicator - Measures time since highest high and lowest low
  • Aroon Oscillator - Difference between Aroon Up and Aroon Down
  • Linear Regression - Statistical trend analysis with slope, intercept and forecast
  • Moving Average Envelope - Moving average with percentage-based upper and lower bands
  • Pivot Points - Support and resistance levels (Standard, Fibonacci, Camarilla, Woodie)
  • Ichimoku Cloud - Ichimoku Kinko Hyo cloud indicator

Candlestick Patterns

  • Doji - Doji pattern detection
  • Dragonfly Doji - Dragonfly Doji pattern detection
  • Gravestone Doji - Gravestone Doji pattern detection
  • Bullish/Bearish Engulfing - Engulfing pattern detection
  • Hammer Pattern - Hammer pattern detection (confirmed and unconfirmed)
  • Hanging Man - Hanging Man pattern detection (confirmed and unconfirmed)
  • Shooting Star - Shooting Star pattern detection (confirmed and unconfirmed)
  • Bullish/Bearish Harami - Harami pattern detection
  • Bullish/Bearish Harami Cross - Harami Cross pattern detection
  • Bullish/Bearish Marubozu - Marubozu pattern detection
  • Bullish/Bearish Spinning Top - Spinning Top pattern detection
  • Bullish/Bearish Hammer Stick - Hammer Stick pattern detection
  • Bullish/Bearish Inverted Hammer Stick - Inverted Hammer Stick pattern detection
  • Piercing Line - Piercing Line pattern detection
  • Dark Cloud Cover - Dark Cloud Cover pattern detection
  • Morning Star - Morning Star pattern detection
  • Evening Star - Evening Star pattern detection
  • Morning Doji Star - Morning Doji Star pattern detection
  • Evening Doji Star - Evening Doji Star pattern detection
  • Three White Soldiers - Three White Soldiers pattern detection
  • Three Black Crows - Three Black Crows pattern detection
  • Tweezer Top/Bottom - Tweezer pattern detection
  • Abandoned Baby - Abandoned Baby pattern detection
  • Downside Tasuki Gap - Downside Tasuki Gap pattern detection
  • General Bullish/Bearish - General bullish/bearish pattern detection

Utilities

  • Highest - Highest value over period
  • Lowest - Lowest value over period
  • Standard Deviation - Statistical standard deviation
  • Sum - Sum over period
  • Average Gain - Average of positive changes
  • Average Loss - Average of negative changes
  • Cross Up/Down - Detect line crossovers

Chart Types

  • Heikin Ashi - Heikin Ashi candlesticks
  • Renko - Renko charts

Additional Indicators

  • Fibonacci Retracement - Fibonacci retracement levels

📊 API Reference

Simple Moving Average (SMA)

// Functional
sma({ period: 20, values: number[] }) => number[]

// Class-based  
new SMA({ period: 20, values?: number[] })
smaInstance.nextValue(price: number) => number | undefined

Exponential Moving Average (EMA)

// Functional
ema({ period: 20, values: number[] }) => number[]

// Class-based
new EMA({ period: 20, values?: number[] })
emaInstance.nextValue(price: number) => number | undefined

Relative Strength Index (RSI)

// Functional
rsi({ period: 14, values: number[] }) => number[]

// Class-based
new RSI({ period: 14, values?: number[] })
rsiInstance.nextValue(price: number) => number | undefined

MACD

interface MACDInput {
  values: number[];
  fastPeriod?: number;    // default: 12
  slowPeriod?: number;    // default: 26
  signalPeriod?: number;  // default: 9
  SimpleMAOscillator?: boolean; // default: false
  SimpleMASignal?: boolean;     // default: false
}

interface MACDOutput {
  MACD?: number;
  signal?: number;
  histogram?: number;
}

// Functional
macd(input: MACDInput) => MACDOutput[]

// Class-based
new MACD(input: MACDInput)
macdInstance.nextValue(price: number) => MACDOutput | undefined

Bollinger Bands

interface BollingerBandsInput {
  period?: number;    // default: 20
  values: number[];
  stdDev?: number;    // default: 2
}

interface BollingerBandsOutput {
  upper?: number;
  middle?: number;
  lower?: number;
  pb?: number;      // %B
  width?: number;   // Band width
}

// Functional
bollingerbands(input: BollingerBandsInput) => BollingerBandsOutput[]

// Class-based
new BollingerBands(input: BollingerBandsInput)
bbInstance.nextValue(price: number) => BollingerBandsOutput | undefined

🔄 Migration from technicalindicators

This library is a drop-in replacement. Simply change your import:

// Before
import { sma, ema, rsi, macd } from 'technicalindicators';

// After  
import { sma, ema, rsi, macd } from 'fast-technical-indicators';

// Everything else stays the same!

🧪 Testing

The library includes comprehensive tests comparing results with the original technicalindicators package:

npm test           # Run tests
npm run test:watch # Watch mode
npm run test:coverage # Coverage report

📊 Benchmarks

Run performance comparisons:

npm run benchmark

🤝 Contributing

Contributions are welcome! Please ensure:

  1. All indicators remain zero dependency
  2. Methods are self-sufficient (no internal function calls between indicators)
  3. API remains 100% compatible with technicalindicators
  4. New indicators include comprehensive tests and benchmarks

📄 License

MIT - see LICENSE file for details.

🙏 Acknowledgments

This library maintains API compatibility with the excellent technicalindicators package by @anandanand84. We've reimplemented the algorithms for better performance while keeping the familiar interface.


Made with ❤️ for the trading community

Build faster, trade smarter 🚀