@reincharts/indicators

Indicator calculators, bar transforms and indicator components.

npm install @reincharts/indicators

Everything here is also re-exported by the umbrella package reincharts.

Components

NameDescription
ATRAverage True Range.
BollingerBandsBollinger Bands with a filled band.
ElderRayElder ray bull / bear power histograms.
ForceIndexElder force index.
IndicatorRenders any indicator definition: lines, histograms, areas, dots, step lines, levels and fills.
MACDMACD line, signal line and 4-color histogram.
MovingAverageA moving average line (SMA, EMA, WMA, TMA, HMA or VWMA) on the price pane.
RSIRelative Strength Index with 30 / 50 / 70 levels and a filled 30–70 band.
SARParabolic SAR dots on the price pane.
StochasticStochastic oscillator (%K, %D) with 20 / 80 levels.

Functions

NameDescription
adxADX only (see dmi).
aroonAroon up / down over period + 1 bars (default period 14).
atrAverage true range (Wilder).
bollingerBollinger Bands: basis MA ± multiplier × population standard deviation.
cciCommodity Channel Index: (src − SMA) / (0.015 × mean deviation).
changeBar-to-bar change, absolute and in percent.
comparePercent change of a series relative to its first defined value at or after baseIndex (e.g.
defaultInputsDefault input values of a definition.
defineIndicatorIdentity helper that types a custom indicator definition.
dmiDirectional Movement Index (+DI, −DI) and ADX (Wilder smoothing).
donchianDonchian Channels: highest high, lowest low and their average over period bars.
elderImpulseElder impulse system: 1 (green) when both the EMA and the MACD histogram rise, −1 (red) when both fall, 0 (neutral / blue) otherwise; undefined until both are available.
elderRayElder-ray bull and bear power ("Bull Bear Power" is their sum).
emaExponential moving average (alpha = 2 / (period + 1)), seeded with the SMA of the first period values.
envelopeMoving average envelope: basis × (1 ± percent / 100).
fastStochasticFast stochastic (%K unsmoothed).
forceIndexRaw force index: (src − src[1]) × volume.
heikinAshiHeikin Ashi bars: close = (O+H+L+C)/4, open = (prev open + prev close)/2 (first bar: (O+C)/2), high = max(H, open, close), low = min(L, open, close).
hmaHull moving average: WMA(2·WMA(n/2) − WMA(n), √n).
ichimokuIchimoku Kinko Hyo (defaults 9 / 26 / 52 / 26).
indicatorNameLegend name: short name followed by number and source inputs, plus select inputs that differ from their default ("RSI 14 close", "BB 20 close 2", "MA 9 close ema").
kagiKagi lines: the line extends while price keeps its direction and reverses after moving reversal against it.
keltnerKeltner Channels: MA ± multiplier × ATR (defaults: EMA 20, ×2, ATR 10).
lineBreakLine break (three line break by default): a new line in the trend direction for every new close beyond the last line; a reversal line only when the close breaks the extreme of the last lines lines.
macdMoving Average Convergence Divergence.
mfiMoney Flow Index (volume weighted RSI) on hlc3 by default.
momentumMomentum: src − src[n].
movingAverageAny moving average by type ("sma" | "ema" | "wma" | "rma" | "hma" | "tma").
obvOn-balance volume: cumulative volume signed by the direction of the source.
pointAndFigurePoint & figure columns.
renkoTraditional renko: a new brick each time the price moves one box beyond the last brick's top (up) or bottom (down) — reversals therefore need two boxes from the last close.
resolveInputsDefaults merged with partial inputs (undefined values fall back to defaults).
rmaWilder's moving average (RMA / SMMA, alpha = 1 / period) as used by RSI and ATR.
rocRate of change in percent: 100·(src − src[n]) / src[n].
rsiRelative Strength Index (Wilder smoothing).
sarParabolic SAR (Wilder), with the standard start / increment / max parameters.
slowStochasticSlow stochastic (%K smoothed by 3).
smaSimple moving average.
smoothedForceIndexElder's force index smoothed by a moving average ("Elder Force Index").
stddevRolling population standard deviation.
stochasticFull stochastic oscillator: %K = 100·(C − LL)/(HH − LL) smoothed by kSmoothing, %D = SMA(%K).
supertrendSupertrend: hl2 ± factor × ATR with trailing bands.
tmaTriangular moving average (double smoothed SMA, weights 1, 2, ..., 2, 1).
trueRangeTrue range per bar: max(H − L, |H − prevC|, |L − prevC|).
volumeVolume, its moving average and the bar direction used to color volume bars.
vwapAnchored volume weighted average price with standard deviation bands.
vwmaVolume weighted moving average: Σ(price·volume) / Σ(volume) over period bars (default 20).
williamsRWilliams %R in [−100, 0]: 100·(C − HH)/(HH − LL).
wmaLinearly weighted moving average (weights 1..period, newest heaviest).

Constants

NameDescription
adxIndicatorAverage Directional Index indicator definition (indicators.adx).
aroonIndicatorAroon indicator definition (indicators.aroon).
atrIndicatorAverage True Range indicator definition (indicators.atr).
bollingerIndicatorBollinger Bands indicator definition (indicators.bollinger).
cciIndicatorCommodity Channel Index indicator definition (indicators.cci).
dmiIndicatorDirectional Movement Index indicator definition (indicators.dmi).
donchianIndicatorDonchian Channels indicator definition (indicators.donchian).
elderImpulseIndicatorElder Impulse System indicator definition (indicators.elderImpulse).
elderRayIndicatorElder Ray (Bull / Bear Power) indicator definition (indicators.elderRay).
emaIndicatorMoving Average Exponential indicator definition (indicators.ema).
envelopeIndicatorEnvelope indicator definition (indicators.envelope).
forceIndexIndicatorElder Force Index indicator definition (indicators.forceIndex).
hmaIndicatorHull Moving Average indicator definition (indicators.hma).
ichimokuIndicatorIchimoku Cloud indicator definition (indicators.ichimoku).
indicatorsEvery built-in indicator definition keyed by id.
keltnerIndicatorKeltner Channels indicator definition (indicators.keltner).
macdIndicatorMACD indicator definition (indicators.macd).
mfiIndicatorMoney Flow Index indicator definition (indicators.mfi).
momentumIndicatorMomentum indicator definition (indicators.momentum).
movingAverageTypesEvery moving average type, e.g.
obvIndicatorOn Balance Volume indicator definition (indicators.obv).
priceSourcesEvery built-in price source, e.g.
rocIndicatorRate Of Change indicator definition (indicators.roc).
rsiIndicatorRelative Strength Index indicator definition (indicators.rsi).
sarIndicatorParabolic SAR indicator definition (indicators.sar).
smaIndicatorMoving Average indicator definition (indicators.sma).
stddevIndicatorStandard Deviation indicator definition (indicators.stddev).
stochasticIndicatorStochastic indicator definition (indicators.stochastic).
supertrendIndicatorSupertrend indicator definition (indicators.supertrend).
tmaIndicatorTriangular Moving Average indicator definition (indicators.tma).
volumeIndicatorVolume indicator definition (indicators.volume).
vwapIndicatorVWAP indicator definition (indicators.vwap).
vwmaIndicatorVolume Weighted Moving Average indicator definition (indicators.vwma).
williamsRIndicatorWilliams %R indicator definition (indicators.williamsR).
wmaIndicatorMoving Average Weighted indicator definition (indicators.wma).

Types

NameDescription
AnyMovingAverageOptions
AroonResult
ATROptions
ATRPropsProps of the ATR component.
BandsUpper / middle / lower band values.
BollingerBandsPropsProps of the BollingerBands component.
BollingerOptions
BoxSizeBox / reversal size: a fixed price amount or "atr" (ATR at the last bar).
CCIOptions
ChangeOverOptions
ChangeResult
CompareOptions
DMIOptions
DMIResult
DonchianOptions
ElderImpulseOptions
ElderRayOptions
ElderRayPropsProps of the ElderRay component.
ElderRayResult
EnvelopeOptions
ForceIndexPropsProps of the ForceIndex component.
HeikinAshiBarA source bar with its OHLC replaced by Heikin Ashi values (every other field, e.g.
IchimokuOptions
IchimokuResultIchimoku values computed at each bar, NOT shifted.
IndicatorColorContextExtra context passed to IndicatorOutput.colorFn.
IndicatorComponentPropsProps shared by the convenience indicator components (everything of <Indicator> except definition / inputs).
IndicatorDefinitionEverything needed to compute, draw, name and configure an indicator.
IndicatorFillA filled area between two outputs (by key) or an output and a constant / two constants.
IndicatorInputOne user-editable setting of an indicator (rendered by settings dialogs).
IndicatorLevelA horizontal reference line, e.g.
IndicatorOutputOne plotted output of an indicator.
IndicatorOutputStyleStyle overrides for one output.
IndicatorPropsProps of the Indicator component.
KagiLineA kagi line segment between two reversals.
KagiOptions
KeltnerOptions
LineBreakBarA line break bar (draw like a candle body from open to close).
LineBreakOptions
LookbackOptions
MACDOptions
MACDPropsProps of the MACD component.
MACDResult
MAInputsInputs of the moving average definitions.
MFIOptions
MovingAverageOptions
MovingAveragePropsProps of the MovingAverage component.
MovingAverageTypeMoving average types accepted by the maType option of calculators.
OHLCVOptionsField accessors for calculators that read several bar fields (ATR, Stochastic, VWAP...).
PointAndFigureBoxOne box of a column.
PointAndFigureColumnA column of X (direction 1) or O (direction −1) boxes.
PointAndFigureOptions
PriceSourceBuilt-in price sources.
RenkoBrickA renko brick.
RenkoOptions
RSIOptions
RSIPropsProps of the RSI component.
SAROptions
SARPropsProps of the SAR component.
SmoothedForceIndexOptions
SourceWhat a calculator reads: a built-in price source, a field name or a function of the datum.
SourceOptions
StdDevOptions
StochasticOptions
StochasticPropsProps of the Stochastic component.
StochasticResult
SupertrendOptions
SupertrendResult
TransformOptionsOptions shared by the bar transforms (renko, kagi, point & figure, line break).
ValuesValues aligned 1:1 with the input data; undefined during warm-up or where inputs are missing.
VolumeOptions
VolumeResult
VWAPAnchorWhen a VWAP period starts: every day ("session"), week (Monday), month, year, never, or a custom predicate.
VWAPOptions
VWAPResult
VWMAOptions

On this page