Sponsored by Backticks — a visual canvas to build, backtest and optimize trading strategies in your browser. Built on top of this library.
A streaming, allocation-light technical-analysis toolkit for JavaScript / TypeScript. Every indicator is a class with a nextValue(...) method that consumes one bar at a time, so the same code path drives both backtests and live trading without rebuilding state. A second method, momentValue(...), computes the indicator's value for a hypothetical bar without committing any state — useful for tick-by-tick recalculation inside an unfinished candle.
momentValue everywhere. Ask "what would the value be if this bar closed now?" without mutating state.lwc and ti) with epsilon ≤ 1e-9. See the Test column in the indicator tables below for which oracle each one is verified against.lib/ bundle — ~85 kB tarball.npm install @debut/indicators
import { SMA, RSI, MACD, BollingerBands } from '@debut/indicators';
const sma = new SMA(20);
const rsi = new RSI(14);
const macd = new MACD(12, 26, 9);
const bb = new BollingerBands(20, 2);
for (const bar of bars) {
const sm = sma.nextValue(bar.close);
const r = rsi.nextValue(bar.close);
const m = macd.nextValue(bar.close); // → { macd, signal, histogram }
const b = bb.nextValue(bar.close); // → { lower, middle, upper }
// ...indicator outputs are `undefined` until each one's warmup completes.
}
nextValue returns undefined until the indicator has seen enough bars to produce a result (its "warmup" — typically period bars). After that it returns the current value on every call.
nextValue(...) — close-of-barCall this once per closed bar. The method advances internal state and returns the new indicator value. Subsequent calls reflect the committed state.
momentValue(...) — intra-barCall this with the live (still-forming) candle's price/volume to read what the indicator would report if the bar closed now, without committing any state. Useful when you want to react inside the candle but recompute cleanly when the next real nextValue arrives.
const sma = new SMA(4);
[1, 2, 3].forEach((v) => sma.nextValue(v)); // warmup
sma.momentValue(8); // 3.5 ← preview if close=8
sma.nextValue(4); // 2.5 ← actual close=4 commits state
sma.momentValue(8); // 4.75 ← preview based on committed state
sma.nextValue(8); // 4.25 ← actual close=8 commits state
Below is the full catalog grouped by category. Names in code style are the exact named export from @debut/indicators. Linkable indicator names lead to a per-indicator doc page in docs/. The Test column marks which external library the cross-SDK validation runs against — `lwc` = lightweight-charts-indicators, `ti` = technicalindicators (see Cross-SDK validation for what that means).
| Indicator | Export | Test | Description |
|---|---|---|---|
| Simple Moving Average | SMA |
ti |
Arithmetic mean over a period. |
| Exponential Moving Average | EMA |
ti |
Weighted average emphasizing recent prices. |
| Weighted Moving Average | WMA |
ti |
Linearly increasing weights toward the latest bar. |
| Linearly Weighted MA | LWMA |
Linear weighting variant. | |
| Exponential Weighted MA | EWMA |
Configurable α; lighter than EMA for tick smoothing. | |
| Smoothed Moving Average | SMMA |
Wilder smoothing (α = 1/period). | |
| Wilder's Smoothed MA | WEMA |
ti |
Same shape as RMA, included for compatibility. |
| Welles Wilder's Smoothing | WWS |
Classic Wilder smoothing. | |
| Adaptive Moving Average | AMA |
Kaufman adaptive — speeds up in trend, slows in chop. | |
| Running Moving Average | RMA |
α = 1/period; SMA-seeded. | |
| Hull Moving Average | HMA |
lwc |
Reduced-lag MA via WMA chaining. |
| Double EMA | DEMA |
lwc |
2 × EMA − EMA(EMA). |
| Triple EMA | TEMA |
Three-stage EMA reduction of lag. | |
| Arnaud Legoux MA | ALMA |
lwc |
Gaussian-weighted MA. |
| Volume Weighted MA | VWMA |
lwc |
Each bar weighted by volume. |
| McGinley Dynamic | McGinleyDynamic |
lwc |
Self-adjusting MA reacting to market speed. |
| Least Squares MA | LSMA |
lwc |
Endpoint of rolling linear regression. |
| Indicator | Export | Test | Description |
|---|---|---|---|
| Relative Strength Index | RSI |
ti |
Classic 14-period momentum oscillator. |
| Stochastic | Stochastic |
ti |
Close vs. high-low range. |
| Stochastic RSI | StochasticRSI |
ti |
Stochastic applied to RSI. |
| Commodity Channel Index | CCI |
ti |
Deviation-from-mean cyclic oscillator. |
| Williams %R | Williams |
Inverse-stochastic momentum. | |
| Awesome Oscillator | AO |
ti |
Bill Williams 5/34 SMA difference of HL2. |
| Accelerator Oscillator | AC |
Bill Williams AO derivative. | |
| Chande Momentum Oscillator | CMO |
Wilder-style CMO. | |
| Chande MO (LWC) | ChandeMO |
lwc |
LWC reference variant; raw rolling sums. |
| Detrended Price Oscillator | DPO |
SMA-detrended price. | |
| Relative Vigor Index | RVI |
lwc |
SWMA-based vigor / signal pair. |
| SMI Ergodic | SMIErgodic |
lwc |
Double-smoothed momentum (TSI without 100×). |
| True Strength Index | TSI |
lwc |
Double-EMA momentum oscillator with signal. |
| Bollinger Bands %B | BBPercentB |
lwc |
Price position relative to BB. |
| Fisher Transform | FisherTransform |
lwc |
Gaussian-mapped price extremes. |
| Ultimate Oscillator | UltimateOscillator |
Multi-timeframe weighted momentum. | |
| Connor's RSI | cRSI |
Composite RSI / streak / percent-rank. | |
| Relative Volatility Index | RelativeVolatilityIndex |
lwc |
RSI on stdev of close. |
| Indicator | Export | Test | Description |
|---|---|---|---|
| MACD | MACD |
ti |
Difference of two EMAs with signal/histogram. |
| Momentum | Momentum |
lwc |
close − close[length]. |
| Rate of Change | ROC |
ti |
Percentage change over a period. |
| Balance of Power | BOP |
lwc |
(close − open) / (high − low). |
| Bull-Bear Power | BullBearPower |
lwc |
Elder: high + low − 2·EMA(close). |
| Force Index | ForceIndex |
Elder: signed price-volume impulse. | |
| Elder Ray | ElderRay |
Bull / bear power split. | |
| Price Oscillator | PriceOscillator |
lwc |
Percent-PPO with signal/histogram. |
| Coppock Curve | CoppockCurve |
lwc |
WMA of summed long/short ROCs. |
| TRIX | TRIX |
ti |
ROC of triple-smoothed EMA. |
| KST | KST |
lwc |
"Know Sure Thing" weighted ROC sum + signal. |
| Indicator | Export | Test | Description |
|---|---|---|---|
| Average Directional Index | ADX |
ti |
Trend strength irrespective of direction. |
| Directional Movement Index | DMI |
+DI, −DI, ADX. |
|
| Ichimoku Cloud | Ichimoku |
Conversion / base / spans / lagging. | |
| Parabolic SAR | PSAR |
ti |
Welles Wilder's trailing stop. |
| Supertrend | SuperTrend |
ATR-based dynamic support/resistance. | |
| Aroon | Aroon |
lwc |
Bars-since-extreme up/down lines. |
| Choppiness | Choppiness |
lwc |
Range-vs-volatility chop measure. |
| Mass Index | MassIndex |
lwc |
Reversal detection via H-L EMA ratio. |
| Vortex | Vortex |
lwc |
VI+ / VI− directional pair. |
| Trend Strength Index | TrendStrengthIndex |
lwc |
Pearson correlation of close vs. bar index. |
| Chande Kroll Stop | ChandeKrollStop |
lwc |
Long / short ATR-based stop levels. |
| Indicator | Export | Test | Description |
|---|---|---|---|
| Average True Range | ATR |
ti |
Wilder ATR with selectable smoothing. |
| Average Daily Range | ADR |
lwc |
SMA of high − low. |
| Historical Volatility | HistoricalVolatility |
lwc |
Annualized stdev of log returns. |
| Bollinger BandWidth | BBBandWidth |
lwc |
(upper − lower) / basis × 100. |
| Standard Deviation | StandardDeviation |
Streaming biased stdev provider. |
| Indicator | Export | Test | Description |
|---|---|---|---|
| Bollinger Bands | BollingerBands |
ti |
SMA ± k × stdev. |
| Donchian Channels | DC |
Highest-high / lowest-low envelope. | |
| Keltner Channel | KeltnerChannel |
ti |
EMA / ATR envelope. |
| Envelopes | Envelopes |
ti |
Fixed-percentage MA bands. |
| Median (with bands ready upstream) | Median |
lwc |
Rolling median of HL2. |
| Indicator | Export | Test | Description |
|---|---|---|---|
| On Balance Volume | OBV |
lwc |
Cumulative signed volume. |
| Money Flow Index | MFI |
ti |
Volume-weighted RSI. |
| Price Volume Trend | PVT |
lwc |
Volume scaled by relative price change. |
| Volume Oscillator | VolumeOscillator |
ti |
Difference between volume EMAs. |
| Chaikin Oscillator | ChaikinOscillator |
EMA spread of A/D line. | |
| Chaikin Money Flow | ChaikinMF |
lwc |
A/D divided by volume over a window. |
| Ease of Movement | EaseOfMovement |
lwc |
Price change vs. volume. |
| Klinger Oscillator | Klinger |
lwc |
Long-term money-flow oscillator. |
| Net Volume | NetVolume |
lwc |
Signed volume by candle direction. |
| Volume Profile | VolumeProfile |
Session histogram with POC / VAH / VAL. |
| Indicator | Export | Test | Description |
|---|---|---|---|
| Heiken Ashi | HeikenAshi |
Smoothed candle stream. | |
| Fractal | Fractal |
Bill Williams 5-bar fractals. | |
| Pivot Levels | Pivot |
Classic / Woodie / Camarilla / Fibonacci. | |
| Trend Lines | TrendLines |
Pivot-derived trend line detection. | |
| Extremums | Extremums |
Fractal-style local extrema provider. |
| Indicator | Export | Description |
|---|---|---|
| Move | Move |
Direction move with minimum power p. |
| Wave | Wave |
Bullish/bearish candle series with power p. |
Every stateful indicator exposes two methods:
dumpState() returns a JSON-safe snapshot of all internal runtime state.restoreState(state) restores that snapshot into a new indicator instance and returns the instance.The snapshot includes nested providers and rolling buffers such as CircularBuffer, so an indicator can continue after a process restart without replaying the full history. Constructor parameters are still part of the indicator configuration: restore state into an instance created with the same period/options that produced the snapshot.
import { EMA } from '@debut/indicators';
const ema = new EMA(20);
for (const close of history) {
ema.nextValue(close);
}
// Persist this string in your own runtime storage: database, file, Redis, etc.
const serialized = JSON.stringify(ema.dumpState());
// Later, after a restart:
const restored = new EMA(20).restoreState(JSON.parse(serialized));
const liveValue = restored.nextValue(nextClose);
For live systems, save the state after committing each closed bar, together with the indicator configuration and stream identity. On startup, recreate each indicator with the same constructor arguments, call restoreState(...), then continue feeding new bars through nextValue(...).
Each is a streaming class:
import { Doji, BullishEngulfingPattern, HammerPattern } from '@debut/indicators';
const doji = new Doji();
const engulfing = new BullishEngulfingPattern();
const hammer = new HammerPattern(); // 5-bar with confirmation candle
for (const bar of bars) {
if (doji.nextValue(bar.open, bar.high, bar.low, bar.close)) console.log('Doji', bar.time);
if (engulfing.nextValue(bar.open, bar.high, bar.low, bar.close)) console.log('Bull Engulfing', bar.time);
if (hammer.nextValue(bar.open, bar.high, bar.low, bar.close)) console.log('Hammer', bar.time);
}
nextValue returns true when the pattern fires, false if not, and undefined while it's still warming
$ claude mcp add Indicators \
-- python -m otcore.mcp_server <graph>