A powerful, lightweight JavaScript library for Technical Analysis and financial market data calculations.
ta.js works in React out of the box — pure JavaScript, zero runtime dependencies, side-effect-free exports. Import from the ESM bundle and call the functions:
import { sma, rsi } from 'ta.js/ta.esm.js';The only Node-only feature is ta.multi.sim (Monte Carlo via worker_threads); the build pipeline aliases it to a browser stub so ta.multi is undefined in browser bundles rather than crashing.
npm install ta.js
Three browser bundles are shipped. Pick whichever fits your setup:
<!-- IIFE bundle (recommended) — exposes `window.ta` -->
<script src="https://unpkg.com/ta.js/ta.iife.min.js"></script>
<script>
ta.sma([1,2,3,4,5,6,10], 6); // [3.5, 5]
ta.aroon.up([[10,7],[12,9],[14,11],[13,10],[15,12]], 4);
</script>
<!-- ES module (for <script type="module"> and modern bundlers) -->
<script type="module">
import { sma, rsi } from 'https://unpkg.com/ta.js/ta.esm.js';
sma([1,2,3,4,5,6,10], 6);
</script>
<!-- Legacy bundle (top-level function globals; kept for backward compatibility) -->
<script src="https://unpkg.com/ta.js/ta.min.js"></script>const ta = require('ta.js');
ta.sma([1,2,3,4,5,6,10], 6); // [3.5, 5]
ta.aroon.up([[10,7],[12,9],[14,11],[13,10],[15,12]], 4);import { sma, rsi, aroon } from 'ta.js/ta.esm.js';
sma([1,2,3,4,5,6,10], 6);<script src="https://unpkg.com/ta.js/ta.iife.min.js"></script>
<script>
ta.sma([1,2,3,4,5,6,10], 6);
</script>ta.js v2.0 is the fastest pure-JS technical-analysis library at production data sizes. Across 67 cross-library benchmark cases at 100k bars, ta.js wins 66, typically by 2-3× over the next-best competitor and ~10× over tulind's native C bindings (JS↔C marshaling overhead overwhelms the native-math advantage at every size we tested).
Headline indicators at 100,000 bars (ops/sec, higher is better):
| indicator | ta.js | next-best | margin |
|---|---|---|---|
| sma | 2,290 | @debut/indicators 779 |
2.94× |
| ema | 1,870 | trading-signals 1,480 |
1.26× |
| rsi | 1,340 | @debut/indicators 373 |
3.59× |
| macd | 606 | trading-signals 337 |
1.80× |
| bbands | 1,140 | @debut/indicators 370 |
3.08× |
| atr | 1,380 | @debut/indicators 1,000 |
1.38× |
| stoch | 303 | @debut/indicators 241 |
1.26× |
| vwap | 1,220 | technicalindicators 400 |
3.05× |
Measured on Apple M3 / Darwin 25.3.0 arm64 / Node v25.1.0 against technicalindicators 3.1.0, trading-signals 7.4.3, @debut/indicators 1.3.22, and tulind 0.8.20. Full per-case tables across 1k / 10k / 100k bar inputs are in BENCHMARKS.md. Reproduce on your hardware with:
cd bench
npm install
npm run bench:md # regenerates BENCHMARKS.md + bench/results.json
Quote ratios, not absolute ops/sec, when comparing across machines.
https://github.com/Bitvested/ta.js/blob/main/EXAMPLES.md
- Simple Moving Average
- Smoothed Moving Average
- Weighted Moving Average
- Exponential Moving Average
- Hull Moving Average
- Least Squares Moving Average
- Volume Weighted Moving Average
- Volume Weighted Weighted Moving Average
- Wilder's Smoothing Moving Average
- Parabolic Weighted Moving Average
- Hyperbolic Weighted Moving Average
- Kaufman Adaptive Moving Average
- Custom Weighted Moving Average
- Double Exponential Moving Average
- Triple Exponential Moving Average
- Triangular Moving Average
- Tilson T3 Moving Average
- Zero-Lag Exponential Moving Average
- Variable Index Dynamic Average
- Moving Average Convergence / Divergence
- MACD Signal
- MACD Bars
- Relative Strength Index
- Wilder's Relative Strength Index
- True Strength Index
- Balance Of Power
- Force Index
- Accumulative Swing Index
- Alligator Indicator
- Williams %R
- Stochastics
- Fibonacci Retracement
- Bollinger Bandwidth
- Ichimoku Cloud
- Average True Range
- Aroon Up
- Aroon Down
- Money Flow Index
- Rate Of Change
- Coppock Curve
- Know Sure Thing
- On-Balance Volume
- Volume-Weighted Average Price
- Fractals
- Crossover
- Momentum
- HalfTrend
- ZigZag
- Parabolic SAR
- SuperTrend
- Elder Ray Index
- Historical Volatility
- Relative Vigor Index
- Relative Vigor Index Signal
- RSI Divergence
- Divergence
- TRIX
- Accumulation/Distribution Line
- Commodity Channel Index
- Plus Directional Movement
- Minus Directional Movement
- Plus Directional Indicator
- Minus Directional Indicator
- Directional Movement Index
- Average Directional Index
- Average Directional Index Rating
- Stochastic RSI
- Percentage Price Oscillator
- Absolute Price Oscillator
- Chaikin Money Flow
- Negative Volume Index
- Positive Volume Index
- Ease Of Movement
- Normalized Average True Range
- Detrended Price Oscillator
- Mass Index
- Ulcer Index
- Vortex Indicator
- KDJ Indicator
- Alligator Oscillator
- Chande Momentum Oscillator
- Chaikin Oscillator
- Aroon Oscillator
- Awesome Oscillator
- Accelerator Oscillator
- Fisher Transform
- Ultimate Oscillator
- Klinger Volume Oscillator
- Sum
- Standard Deviation
- Standard Deviation Series
- Linear Regression Slope
- Linear Regression Intercept
- Linear Regression Angle
- Time Series Forecast
- Variance
- Normal CDF
- Inverse Normal Distribution
- Monte Carlo Simulation
- Percentile
- Correlation
- Covariance
- Percentage Difference
- Expected Return
- Abnormal Return
- Kelly Criterion
- Martingale
- Anti-Martingale
- Permutations
- Expected Trails
- Winratio
- Average Win
- Average Loss
- Return Positive
- Return Negative
- Drawdown
- Median
- Recent High
- Recent Low
- Median Absolute Deviation
- Average Absolute Deviation
- Standard Error
- Sum Squared Differences
- Logarithm
- Exponent
- Normalize
- Denormalize
- Normalize Pair
- Normalize From
- Standardize
- Z-Score
- P-Value
- K-means Clustering
- Mean Squared Error
- Cumulative
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
ta.js is an open-source project created and actively maintained by Nino Kroesen.
This library was built with performance in mind for high-frequency data and algorithmic trading systems. If you are interested in seeing these indicators in action within a live quantitative trading environment, check out Bitvested.