AlgoLift Logo
@algolift/indicators

AlgoLift Indicators. 217 indicators in one TypeScript package.

Moving averages, momentum, trend, volatility, volume, cycles, statistics, regression and 63 candlestick patterns. One API, no dependencies.

npm install @algolift/indicatorsGitHubnpm

217

The indicators by family
63Candlestick patterns
40Momentum
27Moving averages
17Volume
16Trend strength
15Statistics
14Volatility
25Five more families
60.062.565.067.570.065.087030RSIWed Mar 11Thu Mar 12
Figure 1. Bollinger Bands (20, 2) and RSI (14), drawn by the package on the 400 bars its tests use: a trend, a quiet stretch, a 5% gap at bar 300 and a spike at bar 350.
01Why this package

One package, one API, nothing to compile.

TypeScript-native
Types for every function and option, including each default and range.
No dependencies
Plain JavaScript once installed. Nothing native to build, nothing extra pulled in.
Node and the browser
ES module and CommonJS builds for Node 18 and up. The same code runs in AlgoLift’s charts in your browser.
One API for all 217
Every function takes bars and options and returns one value per bar for each output. You can also call any indicator by its id with calculate.
A catalog entry for each
Name, settings with defaults and ranges, outputs, and the columns it reads, all in the exported catalog.
The builder’s own code
AlgoLift’s strategy builder and charts use this package, so the app has one copy of each formula.
02Use it

A number in six lines.

import { rsi, bbands, cdlEngulfing } from '@algolift/indicators';
const bars = await loadBars();// oldest first
const { value } = rsi(bars, { period: 14 });// (number | null)[]
const { upper_band, lower_band } = bbands(bars);// 20 bars, 2 deviations
const { value: engulfing } = cdlEngulfing(bars);// 100, -100, 80, -80 or 0
Output
One value per bar, in the same order as your bars.
Warmup
Null until the indicator has enough bars. Never NaN or infinity.
Mistakes
Bad input throws an error that says why, instead of returning wrong numbers.
Your input
Never changed.
03How we test

405,424

values in 671 test cases, checked on every change. Each indicator has test cases at three or more settings: the exact values it must produce on 400 fixed bars.

How close is close enough

159Exact. 159 indicators match their reference values to the last digit.
44Within 1e−9. 44 differ only in the last digits, because the sums are added in a different order.
2A stated tolerance. 2 have a looser limit, and their catalog entry says why.
12A stated convention. 12 classics follow a convention, and their page says which.
1e−161e−131e−101e−7zlma: exacthwma: exactfwma: exactpwma: exactssf3: exacthtTrendline: exacthilo: exactmmar: exactrainbow: exacthl2: exacthlc3: exactohlc4: exactwcp: exactmidpoint: exactmidprice: exactheikinAshi: exactcdlZ: exactmom: exactroc: exactapo: exactao: exactbop: exactbias: exactbrar: exactcfo: exactcrsi: exactcti: exactdm: exacter: exacteri: exactexhc: exactinertia: exactkdj: exactlrsi: exactpgo: exactpo: exactpsl: exactrvgi: exactstc: exactseqCount: exactslope: exactsmi: exactsqueeze: exactsqueezePro: exactvwmacd: exactadxr: exactvhf: exactrwi: exactamat: exacttrendBars: exacthtTrendmode: exactqstick: exactdpo: exactpmax: exactcksp: exactdecay: exacttrueRange: exactui: exactrvi: exactmassi: exactthermo: exactpdist: exactchandelier: exactatrStop: exactaberration: exactaccbands: exacthwc: exactaobv: exactpvt: exactpvol: exactpvr: exactnvi: exactpvi: exactpvo: exactvosc: exactkvo: exacteom: exactmarketfi: exacttsv: exactwad: exactcg: exactdsp: exactebsw: exactreflex: exacttrendflex: exactmad: exactzscore: exactmedian: exactquantile: exactlinregIntercept: exactzigzag: exactcpr: exactsmcSweep: exactcdlDoji: exactcdlDragonflydoji: exactcdlGravestonedoji: exactcdlSpinningtop: exactcdlMarubozu: exactcdlHammer: exactcdlShootingstar: exactcdlEngulfing: exactcdlMorningstar: exactcdlEveningstar: exactcdlHighwave: exactcdlLongleggeddoji: exactcdlLongline: exactcdlShortline: exactcdlBelthold: exactcdlClosingmarubozu: exactcdlTakuri: exactcdlRickshawman: exactcdlInvertedhammer: exactcdlHangingman: exactcdlDojistar: exactcdlTristar: exactcdlMorningdojistar: exactcdlEveningdojistar: exactcdlAbandonedbaby: exactcdlLadderbottom: exactcdlConcealbabyswall: exactcdl3linestrike: exactcdlTweezerBottom: exactcdlTweezerTop: exactcdlHarami: exactcdlHaramicross: exactcdl3inside: exactcdl3outside: exactcdlHomingpigeon: exactcdlKicking: exactcdlKickingbylength: exactcdlCounterattack: exactcdlInneck: exactcdlOnneck: exactcdlThrusting: exactcdlPiercing: exactcdlDarkcloudcover: exactcdlMatchinglow: exactcdlSeparatinglines: exactcdl2crows: exactcdlUpsidegap2crows: exactcdlUnique3river: exactcdlGapsidesidewhite: exactcdlSticksandwich: exactcdlTasukigap: exactcdlXsidegap3methods: exactcdlBreakaway: exactcdlRisefall3methods: exactcdlMathold: exactcdl3whitesoldiers: exactcdlAdvanceblock: exactcdlStalledpattern: exactcdl3blackcrows: exactcdlIdentical3crows: exactcdl3starsinsouth: exactcdlHikkake: exactcdlHikkakemod: exactdema: exactppo: exactad: exactkama: a stated conventionmacd: a stated conventionstoch: a stated conventionwillr: a stated conventioncmo: a stated conventionadx: a stated conventionaroon: a stated conventionpsar: a stated conventionatr: a stated conventionadosc: a stated conventionmfi: a stated conventionobv: a stated conventionwma: 6.4e-15trima: 2.7e-14rma: 4.4e-16vwma: 7.0e-15alma: 4.4e-16t3: 6.5e-15mcgd: 2.2e-16vidya: 2.8e-16sinwma: 6.7e-16swma: 6.4e-16ssf: 4.9e-15mama: 8.6e-16alligator: 5.5e-16coppock: 2.3e-15kst: 1.4e-13tmo: 1.3e-13chop: 3.3e-12alphatrend: 1.2e-16natr: 7.1e-16hvol: 8.6e-16htDcperiod: 9.9e-16htDcphase: 3.1e-13htPhasor: 8.7e-14htSine: 6.0e-12stdev: 9.0e-11variance: 6.9e-12stderr: 1.5e-8stdevChannel: 1.1e-15skew: 2.7e-14kurtosis: 4.6e-14entropy: 2.7e-16correl: 8.9e-11beta: 2.0e-12logReturn: 2.2e-16drawdown: 3.7e-13tsf: 2.2e-16linregAngle: 2.3e-16sma: 1.3e-15ema: 2.2e-16tema: 2.2e-16rsi: 1.0e-15cci: 5.9e-12trix: 4.0e-12uo: 2.8e-16bbands: 2.4e-14linreg: 1.5e-91e−9 policy
Figure 2. The largest difference between each indicator and its reference values. The dots on the left match exactly.exactconventionwithin 1e−9stated tolerance
The checks
Every indicator against its reference values.Node LTS, on every change.217 indicators
Every reference value rebuilt from scratch, byte for byte.From pinned versions.671 test cases

Reference values come from established libraries (TA-Lib, pandas-ta-classic, pandas-ta and technicalindicators), and their licenses ship with the package in NOTICE.

04Conventions

Twelve classics, and the choice each one makes.

These are the formulas AlgoLift’s strategy nodes run, so they never change to suit anyone. Where a classic indicator has to make a choice, like how it starts or what a flat stretch reads, we say so here, and the tests hold it to that.

IndicatorIts convention
KAMAStarts from the average of the bars before its first value.
MACDEach average starts on the first bars of the series, so the line begins at bar slow − 1.
StochasticA window with no range has no %K, so no %D either.
Williams %RA window with no range has no value.
CMOAdds up the window’s gains and losses, as Chande defined it.
ADX / DMIStarts its smoothing from sums over the first period of bars.
AroonLooks back over the last period bars, including today.
Parabolic SARStarts long, from the first bar’s low.
ATRStarts at bar period − 1. The first bar’s true range is its high minus its low.
Chaikin OscillatorEach average starts from the simple average of its first values.
MFIA window with no money flow either way reads 50.
OBVStarts at 0 on the first bar.
05The index

Browse all 217.

FunctionIndicatorSettingsOutputsCheck

Loading the index.

06No code

Or use them without writing code. AlgoLift’s strategy builder runs this package.

IndicatorRSI · 14ConditionBelow 30EntryLong, next barBacktestES, three years
Start free

7-day free trial. Cancel anytime.