Skip to content

DSL Technical Analysis API

The ta.* namespace contains common technical analysis helpers.

Moving Averages

ta.sma

ma = ta.sma(close, length)

Simple moving average.

ta.ema

ema = ta.ema(close, length)

Exponential moving average.

ta.rma

rma = ta.rma(close, length)

Wilder moving average.

Rolling Window

ta.sum

sum = ta.sum(volume, length)

Rolling sum.

ta.highest

highestHigh = ta.highest(high, length)

Highest value in a rolling window.

ta.lowest

lowestLow = ta.lowest(low, length)

Lowest value in a rolling window.

ta.stdev

dev = ta.stdev(close, length)

Rolling standard deviation.

Bollinger Bands

ta.bb_basis

basis = ta.bb_basis(close, length)

Bollinger basis.

ta.bb_upper

upper = ta.bb_upper(close, length, mult)

Bollinger upper band.

ta.bb_lower

lower = ta.bb_lower(close, length, mult)

Bollinger lower band.

Signals

ta.crossover

if ta.crossover(fast, slow) {
  signal = 1
}

Returns true when the first series crosses above the second series.

ta.crossunder

if ta.crossunder(fast, slow) {
  signal = -1
}

Returns true when the first series crosses below the second series.