Momentum and oscillators

Bounded and unbounded oscillators, momentum measures and divergence detection. See the indicator reference for how to read a signature, and Indicators for the construction and guarding rules.

AdvanceDeclineRatioBars

Ratio of up (including doji) to down candles; an all-up window returns the up count.

new AdvanceDeclineRatioBars(candleIndicator: Indicator<Candle>, length: number = 9)
Parameter Type Default Meaning
candleIndicator Indicator<Candle> required The chart candle series.
length number 9 Number of bars in the calculation window.
  • Input: Chart candles.
  • Value (getValue() after hasValue()): number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars value: 8. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 16 candles to 1e-9. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new AdvanceDeclineRatioBars(candles);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value === undefined) return;
  manager.debugLog('AdvanceDeclineRatioBars', value);
});

Aroon

Aroon on length + 1 candles; the newest equal high/low wins.

new Aroon(candleIndicator: Indicator<Candle>, length: number = 14)
Parameter Type Default Meaning
candleIndicator Indicator<Candle> required The chart candle series.
length number 14 Number of bars in the calculation window.
  • Input: Chart candles.
  • Value (getValue() after hasValue()): AroonValue
    • up: number | undefined
    • down: number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars up: 14; down: 14. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 23 candles to 1e-9. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new Aroon(candles);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  manager.debugLog('Aroon', value);
});

AroonOscillator

Aroon Up minus Aroon Down.

new AroonOscillator(candleIndicator: Indicator<Candle>, length: number = 14)
Parameter Type Default Meaning
candleIndicator Indicator<Candle> required The chart candle series.
length number 14 Number of bars in the calculation window.
  • Input: Chart candles.
  • Value (getValue() after hasValue()): number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars value: 14. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 23 candles to 1e-9. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new AroonOscillator(candles);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value === undefined) return;
  manager.debugLog('AroonOscillator', value);
});

AverageDailyRange

Simple average of each chart candle range; the name does not imply a request for daily candles.

new AverageDailyRange(candleIndicator: Indicator<Candle>, length: number = 14)
Parameter Type Default Meaning
candleIndicator Indicator<Candle> required The chart candle series.
length number 14 Number of bars in the calculation window.
  • Input: Chart candles.
  • Value (getValue() after hasValue()): number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars value: 13. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 22 candles to 1e-9. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new AverageDailyRange(candles);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value === undefined) return;
  manager.debugLog('AverageDailyRange', value);
});

AwesomeOscillator

Five-bar minus 34-bar simple average of hl2.

new AwesomeOscillator(candleIndicator: Indicator<Candle>)
Parameter Type Default Meaning
candleIndicator Indicator<Candle> required The chart candle series.
  • Input: Chart candles.
  • Value (getValue() after hasValue()): number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars value: 33. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 33 candles to 1e-9. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new AwesomeOscillator(candles);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value === undefined) return;
  manager.debugLog('AwesomeOscillator', value);
});

BalanceOfPower

Candle body divided by its range; a zero range has no finite value.

new BalanceOfPower(candleIndicator: Indicator<Candle>)
Parameter Type Default Meaning
candleIndicator Indicator<Candle> required The chart candle series.
  • Input: Chart candles.
  • Value (getValue() after hasValue()): number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars value: 0. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 0 candles to 1e-9. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new BalanceOfPower(candles);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value === undefined) return;
  manager.debugLog('BalanceOfPower', value);
});

BBTrend

Difference of the short and long Bollinger lower-band distance and upper-band distance, divided by the short basis, in percent.

new BBTrend(candleIndicator: Indicator<Candle>, shortLength: number = 20, longLength: number = 50, multiplier: number = 2)
Parameter Type Default Meaning
candleIndicator Indicator<Candle> required OHLC candle stream.
shortLength number 20 Short Bollinger length, 1 to 5000.
longLength number 50 Long Bollinger length, 1 to 5000.
multiplier number 2 Population-standard-deviation multiplier, at least 0.001.
  • Input: Candle stream; the built-in fixes its source to close.
  • Value (getValue() after hasValue()): number | undefined
  • Warm-up: First value at bar max(shortLength, longLength) - 1. Exact finite-window restart; a zero basis emits undefined. The chart preloads 30 periods and draws columns around zero.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new BBTrend(candles, 20, 50, 2);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value === undefined) return;
  manager.debugLog('value', value);
});

BollingerPercentB

Position of the source within population-standard-deviation Bollinger Bands.

new BollingerPercentB(sourceIndicator: Indicator<number | undefined>, length: number = 20, multiplier: number = 2)
Parameter Type Default Meaning
sourceIndicator Indicator<number | undefined> required The selected price source.
length number 20 Number of bars in the calculation window.
multiplier number 2 Number of population standard deviations for the Bollinger bands.
  • Input: A numeric price series.
  • Value (getValue() after hasValue()): number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars value: 19. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 19 candles to 1e-9. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new BollingerPercentB(candles.close);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value === undefined) return;
  manager.debugLog('BollingerPercentB', value);
});

BullBearPower

Bull power plus bear power relative to the EMA of close.

new BullBearPower(candleIndicator: Indicator<Candle>, length: number = 13)
Parameter Type Default Meaning
candleIndicator Indicator<Candle> required The chart candle series.
length number 13 Number of bars in the calculation window.
  • Input: Chart candles.
  • Value (getValue() after hasValue()): number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars value: 12. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 261 candles to 1e-9. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new BullBearPower(candles);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value === undefined) return;
  manager.debugLog('BullBearPower', value);
});

CCI

Commodity channel index: (typical price − its mean) / (0.015 × mean deviation) over period.

new CCI(candleIndicator: Indicator<Candle>, period: number)
Parameter Type Default Meaning
candleIndicator Indicator<Candle> required The candle series.
period number required The window length (20 classically).
  • Input: The candle series.
  • Value (getValue() after hasValue()): number | undefined
  • Warm-up: undefined until period candles have been seen.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new CCI(candles, 20);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value === undefined) return;
  manager.debugLog('CCI20', value);
});

ChandeMomentumOscillator

Chande momentum oscillator: 100 × (sum of gains − sum of losses) / (sum of gains + sum of losses) over length, between −100 and 100.

new ChandeMomentumOscillator(sourceIndicator: Indicator<number | undefined>, length: number = 9)
Parameter Type Default Meaning
sourceIndicator Indicator<number | undefined> required The number stream.
length number 9 The window length.
  • Input: A number stream.
  • Value (getValue() after hasValue()): number | undefined
  • Warm-up: Returns a number from the first candle, NaN while there has been no price change; the window is complete after length candles.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new ChandeMomentumOscillator(candles.close, 9);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value === undefined || Number.isNaN(value)) return;
  manager.debugLog('CMO', value);
});

ChopZone

One column per candle; zone carries the rounded EMA-angle color classification.

new ChopZone(candleIndicator: Indicator<Candle>)
Parameter Type Default Meaning
candleIndicator Indicator<Candle> required The chart candle series.
  • Input: Chart candles.
  • Value (getValue() after hasValue()): ChopZoneValue
    • value: number | undefined
    • zone: number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars value: 0. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 122 candles to 1e-9. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new ChopZone(candles);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  manager.debugLog('ChopZone', value);
});

ConnorsRSI

Mean of price RSI, consecutive-close streak RSI and the rank of the one-bar return against earlier returns.

new ConnorsRSI(candleIndicator: Indicator<Candle>, rsiLength: number = 3, streakLength: number = 2, rankLength: number = 100)
Parameter Type Default Meaning
candleIndicator Indicator<Candle> required The chart candle series.
rsiLength number 3 Wilder RSI length for closing prices.
streakLength number 2 Wilder RSI length for the consecutive up/down streak.
rankLength number 100 Lookback for the percentage rank of one-bar returns.
  • Input: Chart candles.
  • Value (getValue() after hasValue()): number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars value: 100. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 101 candles to 1e-9. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new ConnorsRSI(candles);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value === undefined) return;
  manager.debugLog('ConnorsRSI', value);
});

CoppockCurve

Weighted average of the sum of the long and short close returns.

new CoppockCurve(candleIndicator: Indicator<Candle>, wmaLength: number = 10, longLength: number = 14, shortLength: number = 11)
Parameter Type Default Meaning
candleIndicator Indicator<Candle> required The chart candle series.
wmaLength number 10 Weighted moving average length for the sum of returns.
longLength number 14 Long rate-of-change lookback.
shortLength number 11 Short rate-of-change lookback.
  • Input: Chart candles.
  • Value (getValue() after hasValue()): number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars value: 23. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 26 candles to 1e-9. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new CoppockCurve(candles);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value === undefined) return;
  manager.debugLog('CoppockCurve', value);
});

Divergences

Finds regular and hidden divergences between price swings and a target series (an oscillator), using Swings pivots.

new Divergences(candleIndicator: Indicator<Candle>, source: 'close' | 'high/low', period: number, maxPivots: number, maxPivotAge: number, targetIndicator: Indicator<number | undefined>, minPivotAge: number)
Parameter Type Default Meaning
candleIndicator Indicator<Candle> required The candle series.
source 'close' | 'high/low' required Pivot price: 'close' or 'high/low'.
period number required Candles on each side that define a pivot.
maxPivots number required Maximum pivots kept.
maxPivotAge number required Pivots older than this many candles are dropped.
targetIndicator Indicator<number | undefined> required The series compared with price (for example new RSI(candles.close, 14)).
minPivotAge number required Minimum age, in candles, of the older pivot of a divergence.
  • Input: The candle series plus a target number stream (for example an RSI).
  • Value (getValue() after hasValue()): DivergenceInfo
    • index: number
    • positiveRegular: readonly Divergence[]
    • positiveHidden: readonly Divergence[]
    • negativeRegular: readonly Divergence[]
    • negativeHidden: readonly Divergence[]
  • Divergence is { pivotIndex: number; pivotTime: number; pivotPrice: number; pivotTarget: number }.
  • Warm-up: Ready from the first candle, with empty lists until pivots exist; a pivot is only confirmed period candles after it forms.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new Divergences(candles, 'close', 5, 10, 60, new RSI(candles.close, 14), 5);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value.positiveRegular.length > 0) manager.debugLog('bullish divergence', value.positiveRegular.length);
});

DMI

Independent TradingView DMI: strict directional dominance, fixnan DIs and a zero-DX denominator of one. Existing ADX stays unchanged.

new DMI(candleIndicator: Indicator<Candle>, adxSmoothing: number = 14, diLength: number = 14)
Parameter Type Default Meaning
candleIndicator Indicator<Candle> required The chart candle series.
adxSmoothing number 14 Wilder smoothing length of directional strength.
diLength number 14 Wilder smoothing length of true range and directional movement.
  • Input: Chart candles.
  • Value (getValue() after hasValue()): DMIValue
    • adx: number | undefined
    • posDI: number | undefined
    • negDI: number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars adx: 27; posDI: 14; negDI: 14. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 419 candles to 1e-9. The catalog reserves 500 bars in addition to its parameter-dependent minimum. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new DMI(candles);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  manager.debugLog('DMI', value);
});

DPO

Detrended price oscillator: close − SMA(period) as it was period / 2 + 1 candles ago.

new DPO(sourceIndicator: Indicator<number | undefined>, period: number = 20)
Parameter Type Default Meaning
sourceIndicator Indicator<number | undefined> required The number stream.
period number 20 The SMA length.
  • Input: A number stream.
  • Value (getValue() after hasValue()): number | undefined
  • Warm-up: First value on candle period + floor(period / 2) + 1 (31 for period 20).
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new DPO(candles.close, 20);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value === undefined) return;
  manager.debugLog('DPO', value);
});

FisherTransform

Recursive Fisher transform of hl2, with its preceding value as the trigger.

new FisherTransform(candleIndicator: Indicator<Candle>, length: number = 9)
Parameter Type Default Meaning
candleIndicator Indicator<Candle> required The chart candle series.
length number 9 Number of bars in the calculation window.
  • Input: Chart candles.
  • Value (getValue() after hasValue()): FisherTransformValue
    • fisher: number | undefined
    • trigger: number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars fisher: 8; trigger: 9. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 71 candles to 1e-9. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new FisherTransform(candles);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  manager.debugLog('FisherTransform', value);
});

HARSI

JayRogers' Heikin Ashi RSI Oscillator: Heikin Ashi candles of zero-centred RSIs (RSI − 50, from −50 to +50; its levels are ±20 and ±30). The open is the previous candle's close RSI, the high and the low the higher and the lower of the high's and the low's RSIs.

new HARSI(candleIndicator: ICandleIndicator, period: number, openSmoothingLength: number = 1)
Parameter Type Default Meaning
candleIndicator ICandleIndicator required The candle series.
period number required The RSI length.
openSmoothingLength number 1 How many times the Heikin Ashi open weighs the previous open against the previous close (1, the classic Heikin Ashi open, by default).
  • Input: The candle series.
  • Value (getValue() after hasValue()): HARSIValue | undefined
    • open: number
    • high: number
    • low: number
    • close: number
  • Sub-indicators: .open, .high, .low, .close, usable as inputs to other indicators.
  • Warm-up: First value on candle period + 1.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new HARSI(candles, 14);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value === undefined) return;
  manager.debugLog('HA-RSI close', value.close, value.close > value.open ? 'green' : 'red');
});

HistoricalVolatility

Population standard deviation of log returns, annualized with TradingView's intraday/daily versus higher-timeframe rule.

new HistoricalVolatility(candleIndicator: Indicator<Candle>, length: number = 10)
Parameter Type Default Meaning
candleIndicator Indicator<Candle> required The chart candle series.
length number 10 Number of bars in the calculation window.
  • Input: Chart candles.
  • Value (getValue() after hasValue()): number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars value: 10. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 17 candles to 1e-9. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new HistoricalVolatility(candles);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value === undefined) return;
  manager.debugLog('HistoricalVolatility', value);
});

KDJ

KDJ oscillator: raw stochastic dK, then K and D smoothed with a 1/3 weight, and J = 3K − 2D.

new KDJ(candleIndicator: ICandleIndicator, extremePeriod: number)
Parameter Type Default Meaning
candleIndicator ICandleIndicator required The candle series.
extremePeriod number required High/low look-back (9 classically).
  • Input: The candle series.
  • Value (getValue() after hasValue()): KDJValue
    • K: number
    • D: number
    • J: number
    • dK: number
  • Warm-up: Values from the first candle (K and D start at 50); allow extremePeriod candles before trusting them.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new KDJ(candles, 9);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  manager.debugLog('K', value.K, 'D', value.D, 'J', value.J);
});

KnowSureThing

Weighted sum of four SMA-smoothed rates of change and its SMA signal.

new KnowSureThing(candleIndicator: Indicator<Candle>, rocLength1: number = 10, rocLength2: number = 15, rocLength3: number = 20, rocLength4: number = 30, smaLength1: number = 10, smaLength2: number = 10, smaLength3: number = 10, smaLength4: number = 15, signalLength: number = 9)
Parameter Type Default Meaning
candleIndicator Indicator<Candle> required The chart candle series.
rocLength1 number 10 Lookback of rate-of-change component 1.
rocLength2 number 15 Lookback of rate-of-change component 2.
rocLength3 number 20 Lookback of rate-of-change component 3.
rocLength4 number 30 Lookback of rate-of-change component 4.
smaLength1 number 10 SMA length of rate-of-change component 1.
smaLength2 number 10 SMA length of rate-of-change component 2.
smaLength3 number 10 SMA length of rate-of-change component 3.
smaLength4 number 15 SMA length of rate-of-change component 4.
signalLength number 9 Length of the signal moving average.
  • Input: Chart candles.
  • Value (getValue() after hasValue()): KnowSureThingValue
    • value: number | undefined
    • signal: number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars value: 44; signal: 52. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 52 candles to 1e-9. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new KnowSureThing(candles);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  manager.debugLog('KnowSureThing', value);
});

MACD

Moving average convergence divergence: macd = fast MA − slow MA, signal = MA(macd), histogram = macd − signal.

new MACD(sourceIndicator: Indicator<number | undefined>, maType: 'sma' | 'ema', fastPeriod: number, slowPeriod: number, signalMaType: 'sma' | 'ema', signalPeriod: number)
Parameter Type Default Meaning
sourceIndicator Indicator<number | undefined> required The number stream (usually closes).
maType 'sma' | 'ema' required Average for the fast and slow lines: 'ema' or 'sma'.
fastPeriod number required Fast average length (12 classically).
slowPeriod number required Slow average length (26).
signalMaType 'sma' | 'ema' required Average for the signal line: 'ema' or 'sma'.
signalPeriod number required Signal average length (9).
  • Input: A number stream.
  • Value (getValue() after hasValue()): MACDValue
    • macd: number | undefined
    • signal: number | undefined
    • histogram: number | undefined
  • Warm-up: macd after slowPeriod candles; signal and histogram after slowPeriod + signalPeriod − 1 candles (34 with 12/26/9). hasValue() is true from the first candle: guard each field.
  • All six arguments are required; there are no defaults.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new MACD(candles.close, 'ema', 12, 26, 'ema', 9);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value.macd === undefined || value.signal === undefined || value.histogram === undefined) return;
  manager.debugLog('MACD', value.macd, 'signal', value.signal, 'histogram', value.histogram);
});

MassIndex

Rolling sum of candle range EMA divided by its double EMA.

new MassIndex(candleIndicator: Indicator<Candle>, length: number = 10)
Parameter Type Default Meaning
candleIndicator Indicator<Candle> required The chart candle series.
length number 10 Number of bars in the calculation window.
  • Input: Chart candles.
  • Value (getValue() after hasValue()): number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars value: 25. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 121 candles to 1e-9. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new MassIndex(candles);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value === undefined) return;
  manager.debugLog('MassIndex', value);
});

Momentum

Momentum: value − value length candles ago.

new Momentum(sourceIndicator: Indicator<number | undefined>, length: number = 10)
Parameter Type Default Meaning
sourceIndicator Indicator<number | undefined> required The number stream.
length number 10 How many candles back to compare.
  • Input: A number stream.
  • Value (getValue() after hasValue()): number | undefined
  • Warm-up: undefined for the first length candles.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new Momentum(candles.close, 10);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value === undefined) return;
  manager.debugLog('momentum', value);
});

PriceOscillator

Percentage price oscillator, configurable EMA/SMA signal and histogram.

new PriceOscillator(sourceIndicator: Indicator<number | undefined>, fastLength: number = 12, slowLength: number = 26, signalLength: number = 9, maType: string = "EMA", signalMaType: string = "EMA")
Parameter Type Default Meaning
sourceIndicator Indicator<number | undefined> required The selected price source.
fastLength number 12 Fast calculation length.
slowLength number 26 Slow calculation length.
signalLength number 9 Length of the signal moving average.
maType string "EMA" Moving average of the fast and slow prices: EMA or SMA.
signalMaType string "EMA" Moving average of the oscillator signal: EMA or SMA.
  • Input: A numeric price series.
  • Value (getValue() after hasValue()): PriceOscillatorValue
    • value: number | undefined
    • signal: number | undefined
    • histogram: number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars value: 25; signal: 33; histogram: 33. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 306 candles to 1e-9. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new PriceOscillator(candles.close);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  manager.debugLog('PriceOscillator', value);
});

PringsSpecialK

Weighted sum of twelve smoothed returns, followed by two SMA signal stages.

new PringsSpecialK(sourceIndicator: Indicator<number | undefined>, signalLength1: number = 100, signalLength2: number = 100)
Parameter Type Default Meaning
sourceIndicator Indicator<number | undefined> required The selected price source.
signalLength1 number 100 First SMA signal length.
signalLength2 number 100 Second SMA signal length.
  • Input: A numeric price series.
  • Value (getValue() after hasValue()): PringsSpecialKValue
    • value: number | undefined
    • signal: number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars value: 724; signal: 922. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 922 candles to 1e-9. Fixed ROC components require at least 724 bars even with short signal lengths; the catalog reserves 950. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new PringsSpecialK(candles.close);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  manager.debugLog('PringsSpecialK', value);
});

RankCorrelationIndex

Spearman price/time rank correlation, optional smoothing and population Bollinger Bands.

new RankCorrelationIndex(candleIndicator: Indicator<Candle>, source: string = "close", length: number = 10, smoothingType: string = "SMA", smoothingLength: number = 14, bbMultiplier: number = 2)
Parameter Type Default Meaning
candleIndicator Indicator<Candle> required The chart candle series.
source string "close" Price field: open, high, low, close, hl2, hlc3, ohlc4 or hlcc4.
length number 10 Number of bars in the calculation window.
smoothingType string "SMA" Optional smoothing: None, SMA, SMA + Bollinger Bands, EMA, SMMA (RMA), WMA or VWMA.
smoothingLength number 14 Length of the optional smoothing average.
bbMultiplier number 2 Population standard deviation multiplier of the optional Bollinger bands.
  • Input: Chart candles.
  • Value (getValue() after hasValue()): RankCorrelationIndexValue
    • value: number | undefined
    • average: number | undefined
    • upper: number | undefined
    • lower: number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars value: 10; average: 23; upper: -1; lower: -1. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 25 candles to 1e-9. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new RankCorrelationIndex(candles);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  manager.debugLog('RankCorrelationIndex', value);
});

RCIRibbon

Three Spearman rank correlations of price with time, using average ranks for ties.

new RCIRibbon(candleIndicator: Indicator<Candle>, source: string = "close", shortLength: number = 10, middleLength: number = 30, longLength: number = 50)
Parameter Type Default Meaning
candleIndicator Indicator<Candle> required The chart candle series.
source string "close" Price field: open, high, low, close, hl2, hlc3, ohlc4 or hlcc4.
shortLength number 10 Short rank-correlation window.
middleLength number 30 Middle rank-correlation window.
longLength number 50 Long rank-correlation window.
  • Input: Chart candles.
  • Value (getValue() after hasValue()): RCIRibbonValue
    • short: number | undefined
    • middle: number | undefined
    • long: number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars short: 10; middle: 30; long: 50. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 50 candles to 1e-9. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new RCIRibbon(candles);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  manager.debugLog('RCIRibbon', value);
});

ROC

Rate of change, in percent: 100 × (value − value length ago) / value length ago.

new ROC(sourceIndicator: Indicator<number | undefined>, length: number = 9)
Parameter Type Default Meaning
sourceIndicator Indicator<number | undefined> required The number stream.
length number 9 How many candles back to compare.
  • Input: A number stream.
  • Value (getValue() after hasValue()): number | undefined
  • Warm-up: undefined for the first length candles.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new ROC(candles.close, 9);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value === undefined) return;
  manager.debugLog('ROC %', value);
});

RSI

Relative strength index (Wilder): 100 − 100 / (1 + average gain / average loss) over period, between 0 and 100.

new RSI(sourceIndicator: Indicator<number>, period: number)
Parameter Type Default Meaning
sourceIndicator Indicator<number> required The number stream (usually closes).
period number required The averaging length (14 classically).
  • Input: A number stream whose values are never undefined (candles.close, a PartialIndicator). It does not accept the output of another averaging indicator, which is number | undefined.
  • Value (getValue() after hasValue()): number | undefined
  • Warm-up: undefined for the first period candles; the first value arrives on candle period + 1.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new RSI(candles.close, 14);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value === undefined) return;
  if (value < 30) manager.debugLog('oversold', value);
});

RSILambda

A function (price) => rsi that returns the RSI the current candle would have if it closed at price. Use it to find the price that would push RSI through a level.

new RSILambda(sourceIndicator: Indicator<number>, period: number)
Parameter Type Default Meaning
sourceIndicator Indicator<number> required The number stream (usually closes).
period number required The RSI length.
  • Input: A number stream whose values are never undefined.
  • Value (getValue() after hasValue()): (value: number) => number | undefined
  • Warm-up: The function returns undefined during the first period candles.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new RSILambda(candles.close, 14);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  const ifDown2pct = value(0.98 * (candles.getValue()?.close ?? 0));
  if (ifDown2pct === undefined) return;
  manager.debugLog('RSI if the next close is 2% lower', ifDown2pct);
});

SMIErgodicIndicator

Double-EMA-smoothed price change divided by double-EMA-smoothed absolute change.

new SMIErgodicIndicator(candleIndicator: Indicator<Candle>, longLength: number = 20, shortLength: number = 5, signalLength: number = 5)
Parameter Type Default Meaning
candleIndicator Indicator<Candle> required The chart candle series.
longLength number 20 Long calculation length.
shortLength number 5 Short calculation length.
signalLength number 5 Length of the signal moving average.
  • Input: Chart candles.
  • Value (getValue() after hasValue()): SMIErgodicIndicatorValue
    • value: number | undefined
    • signal: number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars value: 24; signal: 28. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 336 candles to 1e-9. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new SMIErgodicIndicator(candles);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  manager.debugLog('SMIErgodicIndicator', value);
});

SMIErgodicOscillator

Double-EMA-smoothed price change divided by double-EMA-smoothed absolute change.

new SMIErgodicOscillator(candleIndicator: Indicator<Candle>, longLength: number = 20, shortLength: number = 5, signalLength: number = 5)
Parameter Type Default Meaning
candleIndicator Indicator<Candle> required The chart candle series.
longLength number 20 Long calculation length.
shortLength number 5 Short calculation length.
signalLength number 5 Length of the signal moving average.
  • Input: Chart candles.
  • Value (getValue() after hasValue()): number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars value: 28. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 315 candles to 1e-9. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new SMIErgodicOscillator(candles);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value === undefined) return;
  manager.debugLog('SMIErgodicOscillator', value);
});

SqueezeMomentum

Squeeze momentum (LazyBear): detects Bollinger bands inside Keltner channels (squeezeState: 'on') and measures momentum with a linear regression of the price against its range midpoint.

new SqueezeMomentum(candleIndicator: ICandleIndicator, length: number = 20, mult: number = 2.0, lengthKC: number = 20, multKC: number = 1.5, useTrueRange: boolean = true)
Parameter Type Default Meaning
candleIndicator ICandleIndicator required The candle series.
length number 20 Bollinger length.
mult number 2.0 Bollinger multiplier (see note).
lengthKC number 20 Keltner length.
multKC number 1.5 Keltner multiplier.
useTrueRange boolean true Use true range (true) or high − low (false) for the Keltner width.
  • Input: The candle series.
  • Value (getValue() after hasValue()): SqueezeMomentumValue
    • momentum: number | undefined
    • squeezeState: SqueezeState | undefined
    • momentumColor: MomentumColor | undefined
  • SqueezeState is 'on' | 'off' | 'none'.
  • MomentumColor is 'lime' | 'green' | 'red' | 'maroon'.
  • Warm-up: Fields are undefined until the Bollinger, Keltner and regression windows are full (about length + lengthKC candles).
  • Faithful to the original script, the Bollinger width uses multKC rather than mult.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new SqueezeMomentum(candles);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value.momentum === undefined || value.squeezeState === undefined) return;
  manager.debugLog('squeeze', value.squeezeState, 'momentum', value.momentum, value.momentumColor);
});

Stochastic

Stochastic oscillator: stochastic = 100 × (close − lowest low) / (highest high − lowest low) over extremePeriod, k = its kPeriod SMA, d = the dPeriod SMA of k.

new Stochastic(sourceIndicator: Indicator<Candle | number | undefined>, extremePeriod: number, kPeriod: number, dPeriod: number)
Parameter Type Default Meaning
sourceIndicator Indicator<Candle | number | undefined> required Candles, or a number stream.
extremePeriod number required High/low look-back (14 classically).
kPeriod number required %K smoothing (3 for the slow stochastic, 1 for the fast one).
dPeriod number required %D smoothing (3).
  • Input: The candle series (uses high/low/close), or a number stream (then the same stream serves as high, low and close).
  • Value (getValue() after hasValue()): StochasticOutput
    • stochastic: number | undefined
    • k: number | undefined
    • d: number | undefined
  • Warm-up: stochastic from the first candle; k after kPeriod candles; d after kPeriod + dPeriod − 1 candles. The range uses a partial window during the first extremePeriod candles.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new Stochastic(candles, 14, 3, 3);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value.k === undefined || value.d === undefined) return;
  manager.debugLog('%K', value.k, '%D', value.d);
});

StochasticMomentumIndex

Double-EMA-smoothed position in the rolling high/low range and its EMA signal.

new StochasticMomentumIndex(candleIndicator: Indicator<Candle>, kLength: number = 10, dLength: number = 3, emaLength: number = 3)
Parameter Type Default Meaning
candleIndicator Indicator<Candle> required The chart candle series.
kLength number 10 High/low range length (1 to 15000).
dLength number 3 Length of both EMA stages (1 to 4999).
emaLength number 3 Signal EMA length (1 to 4999).
  • Input: Chart candles.
  • Value (getValue() after hasValue()): StochasticMomentumIndexValue
    • value: number | undefined
    • signal: number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars value: 13; signal: 15. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 105 candles to 1e-9. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new StochasticMomentumIndex(candles);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  manager.debugLog('StochasticMomentumIndex', value);
});

TRIX

TRIX: the one-candle change of a triple EMA of the log price, times 10,000.

new TRIX(sourceIndicator: Indicator<number | undefined>, period: number = 18)
Parameter Type Default Meaning
sourceIndicator Indicator<number | undefined> required The number stream.
period number 18 Length of each of the three EMAs.
  • Input: A number stream.
  • Value (getValue() after hasValue()): number | undefined
  • Warm-up: undefined until the triple EMA has two values (about 3 × period − 1 candles).
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new TRIX(candles.close, 18);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value === undefined) return;
  manager.debugLog('TRIX', value);
});

TrueStrengthIndex

Double-EMA-smoothed price change divided by double-EMA-smoothed absolute change.

new TrueStrengthIndex(candleIndicator: Indicator<Candle>, longLength: number = 25, shortLength: number = 13, signalLength: number = 13)
Parameter Type Default Meaning
candleIndicator Indicator<Candle> required The chart candle series.
longLength number 25 Long calculation length.
shortLength number 13 Short calculation length.
signalLength number 13 Length of the signal moving average.
  • Input: Chart candles.
  • Value (getValue() after hasValue()): TrueStrengthIndexValue
    • value: number | undefined
    • signal: number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars value: 37; signal: 49. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 396 candles to 1e-9. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new TrueStrengthIndex(candles);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  manager.debugLog('TrueStrengthIndex', value);
});

UlcerIndex

Root mean square of percentage drawdowns from the rolling maximum.

new UlcerIndex(sourceIndicator: Indicator<number | undefined>, length: number = 14)
Parameter Type Default Meaning
sourceIndicator Indicator<number | undefined> required The selected price source.
length number 14 Number of bars in the calculation window.
  • Input: A numeric price series.
  • Value (getValue() after hasValue()): number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars value: 26. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 44 candles to 1e-9. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new UlcerIndex(candles.close);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value === undefined) return;
  manager.debugLog('UlcerIndex', value);
});

UltimateOscillator

Buying pressure relative to true range over three weighted periods.

new UltimateOscillator(candleIndicator: Indicator<Candle>, fastLength: number = 7, middleLength: number = 14, slowLength: number = 28)
Parameter Type Default Meaning
candleIndicator Indicator<Candle> required The chart candle series.
fastLength number 7 Fast calculation length.
middleLength number 14 Middle calculation length.
slowLength number 28 Slow calculation length.
  • Input: Chart candles.
  • Value (getValue() after hasValue()): number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars value: 28. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 31 candles to 1e-9. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new UltimateOscillator(candles);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value === undefined) return;
  manager.debugLog('UltimateOscillator', value);
});

Vortex

Rolling cross-candle high/low distances divided by true range, including the first candle range.

new Vortex(candleIndicator: Indicator<Candle>, length: number = 14)
Parameter Type Default Meaning
candleIndicator Indicator<Candle> required The chart candle series.
length number 14 Number of bars in the calculation window.
  • Input: Chart candles.
  • Value (getValue() after hasValue()): VortexValue
    • positive: number | undefined
    • negative: number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars positive: 14; negative: 14. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 23 candles to 1e-9. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new Vortex(candles);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  manager.debugLog('Vortex', value);
});

WilliamsPercentR

Williams %R: 100 × (close − highest high) / (highest high − lowest low) over length, between −100 and 0.

new WilliamsPercentR(sourceIndicator: Indicator<Candle>, length: number = 14)
Parameter Type Default Meaning
sourceIndicator Indicator<Candle> required The candle series.
length number 14 The look-back length.
  • Input: The candle series.
  • Value (getValue() after hasValue()): number | undefined
  • Warm-up: undefined until length candles have been seen.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new WilliamsPercentR(candles, 14);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  if (value === undefined) return;
  manager.debugLog('%R', value);
});

WoodiesCCI

Two CCIs of close, with the preceding five-bar sign rule for histogram colors.

new WoodiesCCI(candleIndicator: Indicator<Candle>, turboLength: number = 6, length: number = 14)
Parameter Type Default Meaning
candleIndicator Indicator<Candle> required The chart candle series.
turboLength number 6 Close-based turbo CCI length (3 to 14).
length number 14 Close-based slow CCI length (7 to 20).
  • Input: Chart candles.
  • Value (getValue() after hasValue()): WoodiesCCIValue
    • turbo: number | undefined
    • value: number | undefined
    • histogram: number | undefined
    • colorState: number | undefined
  • Warm-up: Default plotted outputs first appear at zero-based bars turbo: 5; value: 13; histogram: 13. Restart convergence measured on BTCUSDT 1h/1D and ETHUSDT 4h, at default and changed settings: at most 21 candles to 1e-9. Smart Chart preloads 30 times the largest calculation length (DMI: at least 500 bars; Special K: at least 950), capped at 5000 bars: a longer setting is still drawn, but its first visible values can differ from a full-history run, or be missing when the indicator needs more valid candles than the chart loads. Agent constructor bounds are unchanged.
const symbol = 'BTC';
const candles = manager.getIntervalData(symbol, 60);
const indicator = new WoodiesCCI(candles);

manager.onIntervalCandle(symbol, 60, () => {
  if (!indicator.hasValue()) return;
  const value = indicator.getValue();
  manager.debugLog('WoodiesCCI', value);
});
Browse the documentation