QTrader
Menu

Technical indicators

Browse supported indicators and their inputs for trading strategies.

Indicator signatures, warm-up and examples

Worked examples: RSI threshold strategy · SMA crossover.

sma

indicator.sma(source, length)

Simple moving average of source over length bars.

Warm-up: length − 1 bars

Python expression

close > indicator.sma(close, 20)

Pine Script expression

close > ta.sma(close, 20)

ema

indicator.ema(source, length)

Exponential moving average, seeded with the SMA of the first length values.

Warm-up: 10 × length bars

Python expression

close > indicator.ema(close, 20)

Pine Script expression

close > ta.ema(close, 20)

rma

indicator.rma(source, length)

Wilder's moving average: seeded and na-handled like ema, but with a slower smoothing step.

Warm-up: 20 × length bars

Python expression

close > indicator.rma(close, 20)

Pine Script expression

close > ta.rma(close, 20)

wma

indicator.wma(source, length)

Weighted moving average: newer bars in the window carry linearly higher weight.

Warm-up: length − 1 bars

Python expression

close > indicator.wma(close, 20)

Pine Script expression

close > ta.wma(close, 20)

rsi

indicator.rsi(source, length)

Relative strength index (0–100), from the average of gains vs. losses over length bars.

Warm-up: 20 × length + 1 bars

Python expression

indicator.rsi(close, 14) < 30

Pine Script expression

ta.rsi(close, 14) < 30

highest

indicator.highest(source, length)

Highest value of source over the last length bars.

Warm-up: length − 1 bars

Python expression

close >= indicator.highest(high, 20)

Pine Script expression

close >= ta.highest(high, 20)

lowest

indicator.lowest(source, length)

Lowest value of source over the last length bars.

Warm-up: length − 1 bars

Python expression

close <= indicator.lowest(low, 20)

Pine Script expression

close <= ta.lowest(low, 20)

stdev

indicator.stdev(source, length)

Standard deviation of source over length bars (biased, population formula).

Warm-up: length − 1 bars

Python expression

indicator.stdev(close, 20) > 5

Pine Script expression

ta.stdev(close, 20) > 5

change

indicator.change(source, length=1)

Difference between source now and length bars back.

Warm-up: length bars

Python expression

indicator.change(close, 1) > 0

Pine Script expression

ta.change(close, 1) > 0

mom

indicator.mom(source, length)

Momentum: identical to change — the difference between source now and length bars back.

Warm-up: length bars

Python expression

indicator.mom(close, 10) > 0

Pine Script expression

ta.mom(close, 10) > 0

roc

indicator.roc(source, length)

Rate of change: percentage difference between source now and length bars back.

Warm-up: length bars

Python expression

indicator.roc(close, 10) > 0

Pine Script expression

ta.roc(close, 10) > 0

atr

indicator.atr(length)

Average True Range: Wilder's moving average of the true range (uses high, low and close).

Warm-up: 20 × length + 1 bars

Python expression

indicator.atr(14) > 100

Pine Script expression

ta.atr(14) > 100

vwma

indicator.vwma(source, length)

Volume-weighted moving average of source over length bars (uses volume).

Warm-up: length − 1 bars

Python expression

close > indicator.vwma(close, 20)

Pine Script expression

close > ta.vwma(close, 20)

cci

indicator.cci(source, length)

Commodity Channel Index: distance of source from its length-bar average, scaled by mean deviation.

Warm-up: length − 1 bars

Python expression

indicator.cci(close, 20) > 100

Pine Script expression

ta.cci(close, 20) > 100

macd

indicator.macd(source, fast_length, slow_length, signal_length)

Moving Average Convergence Divergence: the fast ema minus the slow ema, a signal line that's the ema of that difference, and their own difference as the histogram. Returns 3 values: unpack them, e.g. a, b, c = indicator.macd(...) in Python or [a, b, c] = ta.macd(...) in Pine.

Warm-up: 10 × max(fast_length, slow_length) + 10 × signal_length bars

Python expression

macd_line, signal_line, histogram = indicator.macd(close, 12, 26, 9)
indicator.crossover(macd_line, signal_line)

Pine Script expression

[macdLine, signalLine, histogram] = ta.macd(close, 12, 26, 9)
ta.crossover(macdLine, signalLine)

bb

indicator.bb(source, length, mult)

Bollinger Bands: the middle band is the SMA, the outer bands are the (biased) standard deviation scaled by mult around it. Returns 3 values: unpack them, e.g. a, b, c = indicator.bb(...) in Python or [a, b, c] = ta.bb(...) in Pine.

Warm-up: length − 1 bars

Python expression

middle, upper, lower = indicator.bb(close, 20, 2)
close > upper

Pine Script expression

[middle, upper, lower] = ta.bb(close, 20, 2)
close > upper

kc

indicator.kc(source, length, mult)

Keltner Channels: the middle line is the EMA, the outer bands are the EMA of the true range scaled by mult around it (uses high, low and close). Returns 3 values: unpack them, e.g. a, b, c = indicator.kc(...) in Python or [a, b, c] = ta.kc(...) in Pine.

Warm-up: 20 × length + 1 bars

Python expression

middle, upper, lower = indicator.kc(close, 20, 2)
close > upper

Pine Script expression

[middle, upper, lower] = ta.kc(close, 20, 2)
close > upper

dmi

indicator.dmi(di_length, adx_smoothing)

Directional Movement Index: +DI, -DI and ADX, from the smoothed directional movement and true range (uses high, low and close). Returns 3 values: unpack them, e.g. a, b, c = indicator.dmi(...) in Python or [a, b, c] = ta.dmi(...) in Pine.

Warm-up: 20 × (di_length + adx_smoothing) + 1 bars

Python expression

plus_di, minus_di, adx = indicator.dmi(14, 14)
adx > 25

Pine Script expression

[plusDi, minusDi, adx] = ta.dmi(14, 14)
adx > 25

supertrend

indicator.supertrend(factor, length)

Supertrend: a band that flips side and direction (1 down, -1 up) whenever price closes through it (uses high, low and close). Returns 2 values: unpack them, e.g. a, b = indicator.supertrend(...) in Python or [a, b] = ta.supertrend(...) in Pine.

Warm-up: 20 × length + 1 bars

Python expression

supertrend, direction = indicator.supertrend(3, 10)
direction < 0

Pine Script expression

[supertrend, direction] = ta.supertrend(3, 10)
direction < 0

stoch

indicator.stoch(source, high, low, length)

Stochastic Oscillator: where source sits within the length-bar high/low range, scaled to 0-100 (not clamped).

Warm-up: length − 1 bars

Python expression

indicator.stoch(close, high, low, 14) < 20

Pine Script expression

ta.stoch(close, high, low, 14) < 20

mfi

indicator.mfi(source, length)

Money Flow Index: a volume-weighted RSI-like oscillator (0–100) over length bars (uses volume).

Warm-up: length bars

Python expression

indicator.mfi(hlc3, 14) > 80

Pine Script expression

ta.mfi(hlc3, 14) > 80

hma

indicator.hma(source, length)

Hull moving average: a fast, smooth average -- wma(2 × wma(source, length / 2) − wma(source, length), √length).

Warm-up: length + √length − 2 bars

Python expression

close > indicator.hma(close, 21)

Pine Script expression

close > ta.hma(close, 21)

median

indicator.median(source, length)

Median of the last length values.

Warm-up: length − 1 bars

Python expression

close > indicator.median(close, 20)

Pine Script expression

close > ta.median(close, 20)

percentrank

indicator.percentrank(source, length)

Percent of the previous length values at or below the current one, 0–100.

Warm-up: length bars

Python expression

indicator.percentrank(close, 50) > 80

Pine Script expression

ta.percentrank(close, 50) > 80

linreg

indicator.linreg(source, length, offset=0)

Linear regression line over length bars, read offset bars back from its newest end.

Warm-up: length − 1 bars

Python expression

close > indicator.linreg(close, 50, 0)

Pine Script expression

close > ta.linreg(close, 50, 0)

cmo

indicator.cmo(source, length)

Chande Momentum Oscillator: 100 × (gains − losses) / (gains + losses) over length bars, −100..100.

Warm-up: length bars

Python expression

indicator.cmo(close, 14) > 50

Pine Script expression

ta.cmo(close, 14) > 50

wpr

indicator.wpr(length)

Williams %R: where the close sits under the length-bar high, −100..0 (uses high, low and close).

Warm-up: length − 1 bars

Python expression

indicator.wpr(14) < -80

Pine Script expression

ta.wpr(14) < -80

tr

indicator.tr(handle_na=0)

True range: the bar's range including a gap from the previous close; on the first bar na, or high − low with handle_na=1 (Pine: ta.tr, or ta.tr(true)).

Warm-up: 1 bar

Python expression

indicator.tr() > indicator.atr(14) * 2

Pine Script expression

ta.tr > ta.atr(14) * 2

obv

indicator.obv()

On-balance volume: the running total of volume, added on up closes and taken away on down closes (Pine: ta.obv).

Warm-up: 1 bar

Python expression

indicator.obv() > indicator.ema(indicator.obv(), 20)

Pine Script expression

ta.obv > ta.ema(ta.obv, 20)

accdist

indicator.accdist()

Accumulation/distribution: the running total of volume weighted by where the close sits in the bar's range (Pine: ta.accdist).

Warm-up: none

Python expression

indicator.accdist() > indicator.ema(indicator.accdist(), 20)

Pine Script expression

ta.accdist > ta.ema(ta.accdist, 20)

vwap

indicator.vwap(source)

Volume-weighted average price, restarting at each UTC day (Pine: ta.vwap is ta.vwap(hlc3)).

Warm-up: source's own

Python expression

close > indicator.vwap(hlc3)

Pine Script expression

close > ta.vwap

swma

indicator.swma(source)

Symmetrically weighted moving average over 4 bars (weights 1, 2, 2, 1).

Warm-up: 3 bars

Python expression

close > indicator.swma(close)

Pine Script expression

close > ta.swma(close)

alma

indicator.alma(source, length, offset=0.85, sigma=6)

Arnaud Legoux moving average: Gaussian weights centred at offset × (length − 1), width length / sigma.

Warm-up: length − 1 bars

Python expression

close > indicator.alma(close, 9, 0.85, 6)

Pine Script expression

close > ta.alma(close, 9, 0.85, 6)

tsi

indicator.tsi(source, short_length, long_length)

True strength index: double-smoothed momentum over double-smoothed absolute momentum, −1..1.

Warm-up: 1 + 10 × (short_length + long_length) bars

Python expression

indicator.tsi(close, 13, 25) > 0

Pine Script expression

ta.tsi(close, 13, 25) > 0

cog

indicator.cog(source, length)

Center of gravity: a front-weighted average position of source over length bars.

Warm-up: length − 1 bars

Python expression

indicator.cog(close, 10) > indicator.cog(close, 10)[-1]

Pine Script expression

ta.cog(close, 10) > ta.cog(close, 10)[1]

sar

indicator.sar(start=0.02, inc=0.02, max=0.2)

Parabolic SAR: a trailing stop that accelerates by inc up to max each new extreme (uses high and low).

Warm-up: 1 bar

Python expression

close > indicator.sar(0.02, 0.02, 0.2)

Pine Script expression

close > ta.sar(0.02, 0.02, 0.2)

Reload this page if interactive controls could not load.