Skip to content
ChartDeck ChartScript docs Account Open the terminal

ta

Technical analysis (streaming, same maths as the built-in studies).

#Functions

#ta.almafunction

Arnaud Legoux moving average.

ta.alma(source: float, length: simple int, offset: simple float, sigma: simple float, { floor?: simple bool = false }): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.
offsetsimple floatWhere the weights peak (0 = oldest, 1 = newest).
sigmasimple floatThe Gaussian width.
floorsimple booldefault falseRound the offset down.

Returns float.

Example

ChartScriptFragmentOpen in editor
const a = ta.alma(close, 9, 0.85, 6)

Since ChartScript 1

#ta.atrfunction

Average true range (RMA of the true range).

ta.atr(length: simple int): float
ParameterTypeDescription
lengthsimple intNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const a = ta.atr(14)

Since ChartScript 1

#ta.barssincefunction

Bars since the condition was last true (na before the first time).

ta.barssince(condition: bool): int
ParameterTypeDescription
conditionboolThe condition.

Returns int.

Example

ChartScriptFragmentOpen in editor
const n = ta.barssince(close > open)

Since ChartScript 1

#ta.bbfunction

Bollinger Bands: [middle, upper, lower].

ta.bb(source: float, length: simple int, mult: simple float): tuple<float,float,float>
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.
multsimple floatThe multiplier of the standard deviation or range.

Returns tuple<float,float,float>.

Example

ChartScriptFragmentOpen in editor
const [mid, up, lo] = ta.bb(close, 20, 2)

Since ChartScript 1

#ta.bbwfunction

Bollinger Band width.

ta.bbw(source: float, length: simple int, mult: simple float): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.
multsimple floatThe multiplier of the standard deviation or range.

Returns float.

Example

ChartScriptFragmentOpen in editor
const w = ta.bbw(close, 20, 2)

Since ChartScript 1

#ta.ccifunction

Commodity channel index.

ta.cci(source: float, length: simple int): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const c = ta.cci(hlc3, 20)

Since ChartScript 1

#ta.changefunction

source minus source[length] (for bool: true when it changed).

ta.change(source: num, { length?: int = 1 }): num
ta.change(source: bool, { length?: int = 1 }): bool
ParameterTypeDescription
sourcenumThe series to read.
lengthintdefault 1Number of bars.

Returns num.

Example

ChartScriptFragmentOpen in editor
const d = ta.change(close)

Since ChartScript 1

#ta.cmofunction

Chande momentum oscillator.

ta.cmo(source: float, length: simple int): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const c = ta.cmo(close, 9)

Since ChartScript 1

#ta.cogfunction

Center of gravity: -sum(source[i] * (i + 1)) / sum(source[i]) over length bars.

ta.cog(source: float, length: simple int): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const c = ta.cog(close, 10)

Since ChartScript 1

#ta.correlationfunction

Correlation coefficient of two series.

ta.correlation(source1: float, source2: float, length: simple int): float
ParameterTypeDescription
source1floatThe first series.
source2floatThe second series.
lengthsimple intNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const c = ta.correlation(close, volume, 20)

Since ChartScript 1

#ta.crossfunction

true when the two series cross in either direction on this bar.

ta.cross(source1: float, source2: float): bool
ParameterTypeDescription
source1floatThe first series.
source2floatThe second series.

Returns bool.

Example

ChartScriptFragmentOpen in editor
const x = ta.cross(close, ta.sma(close, 50))

Since ChartScript 1

#ta.crossoverfunction

true when source1 crosses above source2 on this bar.

ta.crossover(source1: float, source2: float): bool
ParameterTypeDescription
source1floatThe first series.
source2floatThe second series.

Returns bool.

Example

ChartScriptFragmentOpen in editor
const up = ta.crossover(ta.ema(close, 9), ta.ema(close, 21))

Since ChartScript 1

#ta.crossunderfunction

true when source1 crosses below source2 on this bar.

ta.crossunder(source1: float, source2: float): bool
ParameterTypeDescription
source1floatThe first series.
source2floatThe second series.

Returns bool.

Example

ChartScriptFragmentOpen in editor
const dn = ta.crossunder(close, ta.sma(close, 50))

Since ChartScript 1

#ta.cumfunction

The running total.

ta.cum(source: float): float
ParameterTypeDescription
sourcefloatThe series to read.

Returns float.

Example

ChartScriptFragmentOpen in editor
const c = ta.cum(volume)

Since ChartScript 1

#ta.demafunction

Double EMA (ChartDeck extra).

ta.dema(source: float, length: simple int): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const d = ta.dema(close, 21)

Since ChartScript 1

#ta.devfunction

Mean absolute deviation from the SMA.

ta.dev(source: float, length: simple int): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const d = ta.dev(close, 20)

Since ChartScript 1

#ta.dmifunction

Directional movement: [+DI, -DI, ADX].

ta.dmi(diLength: simple int, adxSmoothing: simple int): tuple<float,float,float>
ParameterTypeDescription
diLengthsimple intThe DI length.
adxSmoothingsimple intThe ADX smoothing length.

Returns tuple<float,float,float>.

Example

ChartScriptFragmentOpen in editor
const [plus, minus, adx] = ta.dmi(14, 14)

Since ChartScript 1

#ta.emafunction

Exponential moving average, seeded with the SMA of the first length values ({ seed: "first" } seeds with the first value).

ta.ema(source: float, length: int, { seed?: simple string = "sma" }): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthintNumber of bars.
seedsimple stringdefault "sma""sma" (default, as the built-in EMA study) or "first".

Returns float.

Example

ChartScriptFragmentOpen in editor
const e = ta.ema(close, 21)

Since ChartScript 1

#ta.fallingfunction

true when the source fell on each of the last length bars.

ta.falling(source: float, length: simple int): bool
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.

Returns bool.

Example

ChartScriptFragmentOpen in editor
const f = ta.falling(close, 3)

Since ChartScript 1

#ta.heikin_ashifunction

Heikin-Ashi candle values (ChartDeck extra): [open, high, low, close].

ta.heikin_ashi(): tuple<float,float,float,float>

Returns tuple<float,float,float,float>.

Example

ChartScriptFragmentOpen in editor
const [hao, hah, hal, hac] = ta.heikin_ashi()

Since ChartScript 1

#ta.highestfunction

The highest value over length bars (source defaults to high).

ta.highest(source?: float = high, length: int): float
ParameterTypeDescription
sourcefloatdefault highThe series to read.
lengthintNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const hh = ta.highest(high, 20)

Since ChartScript 1

#ta.highestbarsfunction

Offset (0 or negative) to the highest value over length bars.

ta.highestbars(source?: float = high, length: simple int): int
ParameterTypeDescription
sourcefloatdefault highThe series to read.
lengthsimple intNumber of bars.

Returns int.

Example

ChartScriptFragmentOpen in editor
const o = ta.highestbars(high, 20)

Since ChartScript 1

#ta.hmafunction

Hull moving average.

ta.hma(source: float, length: simple int): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const h = ta.hma(close, 21)

Since ChartScript 1

#ta.kamafunction

Kaufman adaptive moving average (ChartDeck extra).

ta.kama(source: float, length: simple int, { fastLength?: simple int = 2, slowLength?: simple int = 30 }): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.
fastLengthsimple intdefault 2The fast length.
slowLengthsimple intdefault 30The slow length.

Returns float.

Example

ChartScriptFragmentOpen in editor
const k = ta.kama(close, 10)

Since ChartScript 1

#ta.kcfunction

Keltner Channels: [middle, upper, lower].

ta.kc(source: float, length: simple int, mult: simple float, { useTrueRange?: simple bool = true }): tuple<float,float,float>
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.
multsimple floatThe multiplier of the standard deviation or range.
useTrueRangesimple booldefault truetrue: the true range; false: high - low.

Returns tuple<float,float,float>.

Example

ChartScriptFragmentOpen in editor
const [mid, up, lo] = ta.kc(close, 20, 1.5)

Since ChartScript 1

#ta.kcwfunction

Keltner Channel width.

ta.kcw(source: float, length: simple int, mult: simple float, { useTrueRange?: simple bool = true }): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.
multsimple floatThe multiplier of the standard deviation or range.
useTrueRangesimple booldefault truetrue: the true range; false: high - low.

Returns float.

Example

ChartScriptFragmentOpen in editor
const w = ta.kcw(close, 20, 1.5)

Since ChartScript 1

#ta.linregfunction

Linear regression value at offset bars back from the end of the line.

ta.linreg(source: float, length: simple int, offset: simple int): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.
offsetsimple intShift the output this many bars to the right (negative: left).

Returns float.

Example

ChartScriptFragmentOpen in editor
const l = ta.linreg(close, 20, 0)

Since ChartScript 1

#ta.lowestfunction

The lowest value over length bars (source defaults to low).

ta.lowest(source?: float = low, length: int): float
ParameterTypeDescription
sourcefloatdefault lowThe series to read.
lengthintNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const ll = ta.lowest(low, 20)

Since ChartScript 1

#ta.lowestbarsfunction

Offset (0 or negative) to the lowest value over length bars.

ta.lowestbars(source?: float = low, length: simple int): int
ParameterTypeDescription
sourcefloatdefault lowThe series to read.
lengthsimple intNumber of bars.

Returns int.

Example

ChartScriptFragmentOpen in editor
const o = ta.lowestbars(low, 20)

Since ChartScript 1

#ta.mafunction

A moving average of one of the 11 ChartDeck types (ChartDeck extra).

ta.ma(type: simple string, source: float, length: simple int): float
ParameterTypeDescription
typesimple stringThe moving-average type (one of the 11 ChartDeck types).
sourcefloatThe series to read.
lengthsimple intNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const m = ta.ma("hma", close, 21)

Since ChartScript 1

#ta.macdfunction

MACD: [macd line, signal, histogram].

ta.macd(source: float, fastlen: simple int, slowlen: simple int, siglen: simple int): tuple<float,float,float>
ParameterTypeDescription
sourcefloatThe series to read.
fastlensimple intFast length.
slowlensimple intSlow length.
siglensimple intSignal length.

Returns tuple<float,float,float>.

Example

ChartScriptFragmentOpen in editor
const [m, s, h] = ta.macd(close, 12, 26, 9)

Since ChartScript 1

#ta.maxfunction

The highest value of the source over all bars so far.

ta.max(source: float): float
ParameterTypeDescription
sourcefloatThe series to read.

Returns float.

Example

ChartScriptFragmentOpen in editor
const m = ta.max(high)

Since ChartScript 1

#ta.medianfunction

Median over length bars.

ta.median(source: float, length: simple int): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const m = ta.median(close, 20)

Since ChartScript 1

#ta.mfifunction

Money flow index.

ta.mfi(source: float, length: simple int): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const m = ta.mfi(hlc3, 14)

Since ChartScript 1

#ta.minfunction

The lowest value of the source over all bars so far.

ta.min(source: float): float
ParameterTypeDescription
sourcefloatThe series to read.

Returns float.

Example

ChartScriptFragmentOpen in editor
const m = ta.min(low)

Since ChartScript 1

#ta.modefunction

The most frequent value over length bars (the smallest on a tie).

ta.mode(source: float, length: simple int): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const m = ta.mode(close, 20)

Since ChartScript 1

#ta.momfunction

Momentum: source - source[length].

ta.mom(source: float, length: simple int): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const m = ta.mom(close, 10)

Since ChartScript 1

#ta.percentile_linear_interpolationfunction

Percentile by linear interpolation.

ta.percentile_linear_interpolation(source: float, length: simple int, percentage: simple float): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.
percentagesimple floatA percentage from 0 to 100.

Returns float.

Example

ChartScriptFragmentOpen in editor
const p = ta.percentile_linear_interpolation(close, 50, 90)

Since ChartScript 1

#ta.percentile_nearest_rankfunction

Percentile by the nearest-rank method.

ta.percentile_nearest_rank(source: float, length: simple int, percentage: simple float): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.
percentagesimple floatA percentage from 0 to 100.

Returns float.

Example

ChartScriptFragmentOpen in editor
const p = ta.percentile_nearest_rank(close, 50, 90)

Since ChartScript 1

#ta.percentrankfunction

Percent of the previous length values that are at or below the current one.

ta.percentrank(source: float, length: simple int): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const p = ta.percentrank(close, 50)

Since ChartScript 1

#ta.pivot_point_levelsfunction

Pivot point levels [P, R1, S1, R2, S2, R3, S3, R4, S4, R5, S5] from the previous period (a new period starts where anchor is true); levels a type does not define are na.

ta.pivot_point_levels(type: simple string, anchor: bool, { developing?: simple bool = false }): array<float>
ParameterTypeDescription
typesimple string"Traditional", "Fibonacci", "Woodie", "Classic", "DM" or "Camarilla".
anchorboolRestart the calculation on bars where this is true.
developingsimple booldefault falsetrue: from the period so far instead of the previous one.

Returns array<float>.

Example

ChartScriptFragmentOpen in editor
const lv = ta.pivot_point_levels("Traditional", timeframe.change("1D"))

Since ChartScript 1

#ta.pivothighfunction

The pivot high price, reported rightbars bars after the pivot (else na).

ta.pivothigh(source?: float = high, leftbars: simple int, rightbars: simple int): float
ParameterTypeDescription
sourcefloatdefault highThe series to read.
leftbarssimple intBars to the left that must be lower (higher).
rightbarssimple intBars to the right that must be lower (higher); the pivot is reported this many bars late.

Returns float.

Example

ChartScriptFragmentOpen in editor
const ph = ta.pivothigh(high, 5, 5)

Since ChartScript 1

#ta.pivotlowfunction

The pivot low price, reported rightbars bars after the pivot (else na).

ta.pivotlow(source?: float = low, leftbars: simple int, rightbars: simple int): float
ParameterTypeDescription
sourcefloatdefault lowThe series to read.
leftbarssimple intBars to the left that must be lower (higher).
rightbarssimple intBars to the right that must be lower (higher); the pivot is reported this many bars late.

Returns float.

Example

ChartScriptFragmentOpen in editor
const pl = ta.pivotlow(low, 5, 5)

Since ChartScript 1

#ta.rangefunction

Highest minus lowest over length bars.

ta.range(source: float, length: simple int): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const r = ta.range(close, 20)

Since ChartScript 1

#ta.rcifunction

Rank correlation index (Spearman, in percent): how closely the last length values rise with time.

ta.rci(source: float, length: simple int): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const r = ta.rci(close, 10)

Since ChartScript 1

#ta.risingfunction

true when the source rose on each of the last length bars.

ta.rising(source: float, length: simple int): bool
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.

Returns bool.

Example

ChartScriptFragmentOpen in editor
const r = ta.rising(close, 3)

Since ChartScript 1

#ta.rmafunction

Wilder's moving average (RMA), seeded with the SMA.

ta.rma(source: float, length: int): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthintNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const r = ta.rma(close, 14)

Since ChartScript 1

#ta.rocfunction

Rate of change in percent.

ta.roc(source: float, length: int): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthintNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const r = ta.roc(close, 10)

Since ChartScript 1

#ta.rsifunction

Relative strength index (Wilder).

ta.rsi(source: float, length: simple int): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const r = ta.rsi(close, 14)

Since ChartScript 1

#ta.sarfunction

Parabolic SAR.

ta.sar(start: simple float, inc: simple float, max: simple float): float
ParameterTypeDescription
startsimple floatThe start acceleration.
incsimple floatThe increment.
maxsimple floatThe largest value.

Returns float.

Example

ChartScriptFragmentOpen in editor
const s = ta.sar(0.02, 0.02, 0.2)

Since ChartScript 1

#ta.smafunction

Simple moving average.

ta.sma(source: float, length: int): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthintNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const m = ta.sma(close, 20)

Since ChartScript 1

#ta.squeezefunction

Squeeze momentum (ChartDeck extra): [momentum, state] with state 1 = squeeze on, -1 = released, 0 = neither.

ta.squeeze({ bbLength?: simple int = 20, bbMult?: simple float = 2, kcLength?: simple int = 20, kcMult?: simple float = 1.5 }): tuple<float,int>
ParameterTypeDescription
bbLengthsimple intdefault 20Bollinger length.
bbMultsimple floatdefault 2Bollinger multiplier.
kcLengthsimple intdefault 20Keltner length.
kcMultsimple floatdefault 1.5Keltner multiplier.

Returns tuple<float,int>.

Example

ChartScriptFragmentOpen in editor
const [mom, sqz] = ta.squeeze()

Since ChartScript 1

#ta.stdevfunction

Standard deviation over length bars.

ta.stdev(source: float, length: int, { biased?: simple bool = true }): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthintNumber of bars.
biasedsimple booldefault truetrue: divide by n; false: divide by n - 1.

Returns float.

Example

ChartScriptFragmentOpen in editor
const s = ta.stdev(close, 20)

Since ChartScript 1

#ta.stochfunction

Raw stochastic %K.

ta.stoch(source: float, high: float, low: float, length: simple int): float
ParameterTypeDescription
sourcefloatThe series to read.
highfloatThe high value.
lowfloatThe low value.
lengthsimple intNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const k = ta.stoch(close, high, low, 14)

Since ChartScript 1

#ta.supertrendfunction

Supertrend: [line, direction] (direction -1 = up trend, 1 = down trend).

ta.supertrend(factor: simple float, atrPeriod: simple int): tuple<float,int>
ParameterTypeDescription
factorsimple floatThe ATR multiplier.
atrPeriodsimple intThe ATR length.

Returns tuple<float,int>.

Example

ChartScriptFragmentOpen in editor
const [st, dir] = ta.supertrend(3, 10)

Since ChartScript 1

#ta.swmafunction

Symmetrically weighted moving average over 4 bars.

ta.swma(source: float): float
ParameterTypeDescription
sourcefloatThe series to read.

Returns float.

Example

ChartScriptFragmentOpen in editor
const s = ta.swma(close)

Since ChartScript 1

#ta.temafunction

Triple EMA (ChartDeck extra).

ta.tema(source: float, length: simple int): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const t = ta.tema(close, 21)

Since ChartScript 1

#ta.trfunction

The true range: max(high - low, |high - close[1]|, |low - close[1]|). The true range; { handle_na: true } uses high - low on the first bar.

ta.tr({ handle_na?: simple bool = false }): float
ParameterTypeDescription
handle_nasimple booldefault falsetrue: use high - low on the first bar instead of na.

Returns float.

Example

ChartScriptFragmentOpen in editor
const t = ta.tr(true)

Since ChartScript 1

#ta.tsifunction

True strength index.

ta.tsi(source: float, short_length: simple int, long_length: simple int): float
ParameterTypeDescription
sourcefloatThe series to read.
short_lengthsimple intThe short length.
long_lengthsimple intThe long length.

Returns float.

Example

ChartScriptFragmentOpen in editor
const t = ta.tsi(close, 13, 25)

Since ChartScript 1

#ta.valuewhenfunction

The source value on the bar where the condition was true (occurrence 0 = the latest).

ta.valuewhen(condition: bool, source: T, occurrence: simple int): T
ParameterTypeDescription
conditionboolThe condition.
sourceTThe series to read.
occurrencesimple intWhich occurrence: 0 = the latest.

Returns T.

Example

ChartScriptFragmentOpen in editor
const v = ta.valuewhen(close > open, close, 0)

Since ChartScript 1

#ta.variancefunction

Variance over length bars.

ta.variance(source: float, length: simple int, { biased?: simple bool = true }): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.
biasedsimple booldefault truetrue: divide by n; false: divide by n - 1.

Returns float.

Example

ChartScriptFragmentOpen in editor
const v = ta.variance(close, 20)

Since ChartScript 1

#ta.vwapfunction

The volume-weighted average price of hlc3, restarting each UTC day. Volume-weighted average price (restarts each UTC day, or where anchor is true); with stdev_mult: [vwap, upper, lower].

ta.vwap(source: float): float
ta.vwap(source: float, anchor: bool): float
ta.vwap(source: float, anchor: bool, stdev_mult: simple float): tuple<float,float,float>
ParameterTypeDescription
sourcefloatThe series to read.
anchorboolRestart the calculation on bars where this is true.
stdev_multsimple floatThe band width in standard deviations.

Returns float.

Example

ChartScriptFragmentOpen in editor
const v = ta.vwap(hlc3)

Since ChartScript 1

#ta.vwmafunction

Volume-weighted moving average.

ta.vwma(source: float, length: simple int): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const v = ta.vwma(close, 20)

Since ChartScript 1

#ta.wavetrendfunction

WaveTrend oscillator (ChartDeck extra): [wt1, wt2].

ta.wavetrend({ channelLength?: simple int = 10, averageLength?: simple int = 21, signalLength?: simple int = 4 }): tuple<float,float>
ParameterTypeDescription
channelLengthsimple intdefault 10The channel length.
averageLengthsimple intdefault 21The average length.
signalLengthsimple intdefault 4The signal length.

Returns tuple<float,float>.

Example

ChartScriptFragmentOpen in editor
const [wt1, wt2] = ta.wavetrend()

Since ChartScript 1

#ta.wmafunction

Linearly weighted moving average.

ta.wma(source: float, length: int): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthintNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const w = ta.wma(close, 10)

Since ChartScript 1

#ta.wprfunction

Williams %R.

ta.wpr(length: simple int): float
ParameterTypeDescription
lengthsimple intNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const w = ta.wpr(14)

Since ChartScript 1

#ta.zlemafunction

Zero-lag EMA (ChartDeck extra).

ta.zlema(source: float, length: simple int): float
ParameterTypeDescription
sourcefloatThe series to read.
lengthsimple intNumber of bars.

Returns float.

Example

ChartScriptFragmentOpen in editor
const z = ta.zlema(close, 21)

Since ChartScript 1

#Variables

#ta.accdistvariable

Accumulation/distribution: the running total of ((close - low) - (high - close)) / (high - low) * volume.

ta.accdist: float

Type series float.

Example

ChartScriptFragmentOpen in editor
const v = ta.accdist

Since ChartScript 1

#ta.iiivariable

Intraday intensity index: (2 * close - high - low) / ((high - low) * volume).

ta.iii: float

Type series float.

Example

ChartScriptFragmentOpen in editor
const v = ta.iii

Since ChartScript 1

#ta.nvivariable

Negative volume index (starts at 1; moves with the close only on bars whose volume fell).

ta.nvi: float

Type series float.

Example

ChartScriptFragmentOpen in editor
const v = ta.nvi

Since ChartScript 1

#ta.obvvariable

On-balance volume.

ta.obv: float

Type series float.

Example

ChartScriptFragmentOpen in editor
const v = ta.obv

Since ChartScript 1

#ta.pvivariable

Positive volume index (starts at 1; moves with the close only on bars whose volume rose).

ta.pvi: float

Type series float.

Example

ChartScriptFragmentOpen in editor
const v = ta.pvi

Since ChartScript 1

#ta.pvtvariable

Price-volume trend: the running total of the close change in percent of the previous close times volume.

ta.pvt: float

Type series float.

Example

ChartScriptFragmentOpen in editor
const v = ta.pvt

Since ChartScript 1

#ta.trvariable

The true range: max(high - low, |high - close[1]|, |low - close[1]|). The true range; { handle_na: true } uses high - low on the first bar.

ta.tr({ handle_na?: simple bool = false }): float

Type series float.

Example

ChartScriptFragmentOpen in editor
const v = ta.tr

Since ChartScript 1

#ta.vwapvariable

The volume-weighted average price of hlc3, restarting each UTC day. Volume-weighted average price (restarts each UTC day, or where anchor is true); with stdev_mult: [vwap, upper, lower].

ta.vwap(source: float): float
ta.vwap(source: float, anchor: bool): float
ta.vwap(source: float, anchor: bool, stdev_mult: simple float): tuple<float,float,float>

Type series float.

Example

ChartScriptFragmentOpen in editor
const v = ta.vwap

Since ChartScript 1

#ta.wadvariable

Williams accumulation/distribution (running total).

ta.wad: float

Type series float.

Example

ChartScriptFragmentOpen in editor
const v = ta.wad

Since ChartScript 1

#ta.wvadvariable

Williams variable accumulation/distribution: (close - open) / (high - low) * volume.

ta.wvad: float

Type series float.

Example

ChartScriptFragmentOpen in editor
const v = ta.wvad

Since ChartScript 1

#Not available yet

#ta.fvgfunction

Not available yet.

ta.fvg (later version).

Since ChartScript 1

#ta.swingsfunction

Not available yet.

ta.swings (later version).

Since ChartScript 1

The ChartScript documentation is in English for now; translations will follow.