Ta

ta.alma

Definition: Arnaud Legoux Moving Average. It uses Gaussian distribution as weights for moving average.

Syntax:

ta.alma(series, length, offset, sigma) β†’ series float
ta.alma(series, length, offset, sigma, floor) β†’ series float

Returns: Arnaud Legoux Moving Average.

Arguments:

Name
Type
Description

series

series int/float

Series of values to process.

length

series int

Number of bars (length).

offset

simple int/float

Controls tradeoff between smoothness (closer to 1) and responsiveness (closer to 0).

sigma

simple int/float

Changes the smoothness of ALMA. The larger sigma, the smoother ALMA.

floor

simple bool (optional)

An optional parameter. Specifies whether the offset calculation is floored before ALMA is calculated. Default value is false.


ta.atr

Definition: Function atr (average true range) returns the RMA of true range. True range is max(high - low, abs(high - close[1]), abs(low - close[1])).

Syntax:

ta.atr(length) β†’ series float

Returns: Average true range.

Arguments:

Name
Type
Description

length

simple int

Length (number of bars back).

Example (Pine Script):

//@version=5
indicator("ta.atr")
plot(ta.atr(14))

// The same on Pine
pine_atr(length) =>
    trueRange = na(high[1])? high-low : math.max(math.max(high - low, math.abs(high - close[1])), math.abs(low - close[1]))
    // True range can also be calculated with ta.tr(true)
    ta.rma(trueRange, length)

plot(pine_atr(14))

ta.barssince

Definition: Counts the number of bars since the last time the condition was true.

Syntax:

ta.barssince(condition) β†’ series int

Returns: Number of bars since condition was true.

Arguments:

Name
Type
Description

condition

condition

The condition to check.

Example (Pine Script):

//@version=5
indicator("ta.barssince")
// Get number of bars since last color.green bar
plot(ta.barssince(close >= open))

ta.bb

Definition: Bollinger Bands. A Bollinger Band is a technical analysis tool defined by a set of lines plotted two standard deviations (positively and negatively) away from a simple moving average (SMA) of the security's price, but can be adjusted to user preferences.

Syntax:

ta.bb(series, length, mult) β†’ [series float, series float, series float]

Returns: Bollinger Bands.

Arguments:

Name
Type
Description

series

series int/float

Series of values to process.

length

series int

Number of bars (length).

mult

simple int/float

Standard deviation factor.

Example (Pine Script):

//@version=5
indicator("ta.bb")

[middle, upper, lower] = ta.bb(close, 5, 4)
plot(middle, color=color.yellow)
plot(upper, color=color.yellow)
plot(lower, color=color.yellow)

// The same on Pine
f_bb(src, length, mult) =>
    float basis = ta.sma(src, length)
    float dev = mult * ta.stdev(src, length)
    [basis, basis + dev, basis - dev]

[pineMiddle, pineUpper, pineLower] = f_bb(close, 5, 4)

plot(pineMiddle)
plot(pineUpper)
plot(pineLower)

ta.bbw

Definition: Bollinger Bands Width. The Bollinger Band Width is the difference between the upper and the lower Bollinger Bands divided by the middle band.

Syntax:

ta.bbw(series, length, mult) β†’ series float

Returns: Bollinger Bands Width.

Arguments:

Name
Type
Description

series

series int/float

Series of values to process.

length

series int

Number of bars (length).

mult

simple int/float

Standard deviation factor.

Example (Pine Script):

//@version=5
indicator("ta.bbw")

plot(ta.bbw(close, 5, 4), color=color.yellow)

// The same on Pine
f_bbw(src, length, mult) =>
    float basis = ta.sma(src, length)
    float dev = mult * ta.stdev(src, length)
    ((basis + dev) - (basis - dev)) / basis

plot(f_bbw(close, 5, 4))

ta.cci

Definition: The CCI (commodity channel index) is calculated as the difference between the typical price of a commodity and its simple moving average, divided by the mean absolute deviation of the typical price. The index is scaled by an inverse factor of 0.015 to provide more readable numbers.

Syntax:

ta.cci(source, length) β†’ series float

Returns: Commodity channel index of source for length bars back.

Arguments:

Name
Type
Description

source

series int/float

Series of values to process.

length

series int

Number of bars (length).


ta.change

Definition: Compares the current source value to its value length bars ago and returns the difference.

Syntax:

ta.change(source) β†’ series float
ta.change(source) β†’ series bool
ta.change(source) β†’ series int
ta.change(source, length) β†’ series float
ta.change(source, length) β†’ series bool
ta.change(source, length) β†’ series int

Returns: The difference between the values when they are numerical. When a 'bool' source is used, returns true when the current source is different from the previous source.

Arguments:

Name
Type
Description

source

series int/float/bool

Source series.

length

series int (optional)

How far the past source value is offset from the current one, in bars. Optional. The default is 1.

Example (Pine Script):

//@version=5
indicator('Day and Direction Change', overlay=true)
dailyBarTime = time('1D')
isNewDay = ta.change(dailyBarTime)
bgcolor(isNewDay ? color.new(color.green, 80) : na)

isGreenBar = close >= open
colorChange = ta.change(isGreenBar)
plotshape(colorChange, 'Direction Change')

ta.cmo

Definition: Chande Momentum Oscillator. Calculates the difference between the sum of recent gains and the sum of recent losses and then divides the result by the sum of all price movement over the same period.

Syntax:

ta.cmo(series, length) β†’ series float

Returns: Chande Momentum Oscillator.

Arguments:

Name
Type
Description

series

series int/float

Series of values to process.

length

series int

Number of bars (length).

Example (Pine Script):

pineCopy code//@version=5
indicator("ta.cmo")
plot(ta.cmo(close, 5), color=color.yellow)

// The same on Pine
f_cmo(src, length) =>
    float mom = ta.change(src)
    float sm1 = math.sum((mom >= 0) ? mom : 0.0, length)
    float sm2 = math.sum((mom >= 0) ? 0.0 : -mom, length)
    100 * (sm1 - sm2) / (sm1 + sm2)

plot(f_cmo(close, 5))

ta.cog

Definition: The cog (center of gravity) is an indicator based on statistics and the Fibonacci golden ratio.

Syntax:

ta.cog(source, length) β†’ series float

Returns: Center of Gravity.

Arguments:

Name
Type
Description

source

series int/float

Series of values to process.

length

series int

Number of bars (length).

Example (Pine Script):

//@version=5
indicator("ta.cog", overlay=true)
plot(ta.cog(close, 10))

// The same on Pine
pine_cog(source, length) =>
    sum = math.sum(source, length)
    num = 0.0
    for i = 0 to length - 1
        price = source[i]
        num := num + price * (i + 1)
    -num / sum

plot(pine_cog(close, 10))

ta.correlation

Definition: Correlation coefficient. Describes the degree to which two series tend to deviate from their ta.sma values.

Syntax:

ta.correlation(source1, source2, length) β†’ series float

Returns: Correlation coefficient.

Arguments:

Name
Type
Description

source1

series int/float

Source series.

source2

series int/float

Target series.

length

series int

Length (number of bars back).


ta.cross

Definition: Checks if two series have crossed each other.

Syntax:

ta.cross(source1, source2) β†’ series bool

Returns: True if two series have crossed each other, otherwise false.

Arguments:

Name
Type
Description

source1

series int/float

First data series.

source2

series int/float

Second data series.


ta.crossover

Definition: Checks if the source1 series has crossed over the source2 series.

Syntax:

ta.crossover(source1, source2) β†’ series bool

Returns: True if source1 crossed over source2, otherwise false.

Arguments:

Name
Type
Description

source1

series int/float

First data series.

source2

series int/float

Second data series.


ta.crossunder

Definition: Checks if the source1 series has crossed under the source2 series.

Syntax:

ta.crossunder(source1, source2) β†’ series bool

Returns: True if source1 crossed under source2, otherwise false.

Arguments:

Name
Type
Description

source1

series int/float

First data series.

source2

series int/float

Second data series.


ta.cum

Definition: Cumulative (total) sum of source. In other words, it's the sum of all elements of source.

Syntax:

ta.cum(source) β†’ series float

Returns: Total sum series.

Arguments:

Name
Type
Description

source

series int/float

Source used for the calculation.


ta.dev

Definition: Measure of difference between the series and its ta.sma.

Syntax:

ta.dev(source, length) β†’ series float

Returns: Deviation of source for length bars back.

Arguments:

Name
Type
Description

source

series int/float

Series of values to process.

length

series int

Number of bars (length).

Example (Pine Script):

//@version=5
indicator("ta.dev")
plot(ta.dev(close, 10))

// The same on Pine
pine_dev(source, length) =>
    mean = ta.sma(source, length)
    sum = 0.0
    for i = 0 to length - 1
        val = source[i]
        sum := sum + math.abs(val - mean)
    dev = sum/length
plot(pine_dev(close, 10))

ta.dmi

Definition: The dmi function returns the directional movement index.

Syntax:

ta.dmi(diLength, adxSmoothing) β†’ [series float, series float, series float]

Returns: Tuple of three DMI series: Positive Directional Movement (+DI), Negative Directional Movement (-DI), and Average Directional Movement Index (ADX).

Arguments:

Name
Type
Description

diLength

simple int

DI Period.

adxSmoothing

simple int

ADX Smoothing Period.

Example (Pine Script):

//@version=5
indicator(title="Directional Movement Index", shorttitle="DMI", format=format.price, precision=4)
len = input.int(17, minval=1, title="DI Length")
lensig = input.int(14, title="ADX Smoothing", minval=1, maxval=50)
[diplus, diminus, adx] = ta.dmi(len, lensig)
plot(adx, color=color.red, title="ADX")
plot(diplus, color=color.blue, title="+DI")
plot(diminus, color=color.orange, title="-DI")

ta.ema

Definition: The ema function returns the exponentially weighted moving average. In ema weighting factors decrease exponentially. It calculates by using a formula: EMA = alpha * source + (1 - alpha) * EMA[1], where alpha = 2 / (length + 1).

Syntax:

ta.ema(source, length) β†’ series float

Returns: Exponential moving average of source with alpha = 2 / (length + 1).

Arguments:

Name
Type
Description

source

series int/float

Series of values to process.

length

simple int

Number of bars (length).

Example (Pine Script):

//@version=5
indicator("ta.ema")
plot(ta.ema(close, 15))

// The same on Pine
pine_ema(src, length) =>
    alpha = 2 / (length + 1)
    sum = 0.0
    sum := na(sum[1]) ? src : alpha * src + (1 - alpha) * nz(sum[1])
plot(pine_ema(close, 15))

ta.falling

Definition: Test if the source series is now falling for length bars long.

Syntax:

ta.falling(source, length) β†’ series bool

Returns: True if the current source value is less than any previous source value for length bars back, false otherwise.

Arguments:

Name
Type
Description

source

series int/float

Series of values to process.

length

series int

Number of bars (length).


ta.highest

Definition: Highest value for a given number of bars back.

Syntax:

ta.highest(source, length) β†’ series float
ta.highest(length) β†’ series float

Returns: Highest value in the series.

Arguments:

Name
Type
Description

source

series int/float

Series of values to process.

length

series int

Number of bars (length).

Remarks:

  • Two args version: source is a series and length is the number of bars back.

  • One arg version: length is the number of bars back. Algorithm uses high as a source series.


ta.highestbars

Definition: Highest value offset for a given number of bars back.

Syntax:

ta.highestbars(source, length) β†’ series int
ta.highestbars(length) β†’ series int

Returns: Offset to the highest bar.

Arguments:

Name
Type
Description

source

series int/float

Series of values to process.

length

series int

Number of bars (length).


ta.hma

Definition: The hma function returns the Hull Moving Average.

Syntax:

ta.hma(source, length) β†’ series float

Returns: Hull moving average of 'source' for 'length' bars back.

Arguments:

Name
Type
Description

source

series int/float

Series of values to process.

length

simple int

Number of bars.


ta.kc

Definition: Keltner Channels. Keltner channel is a technical analysis indicator showing a central moving average line plus channel lines at a distance above and below.

Syntax:

ta.kc(series, length, mult) β†’ [series float, series float, series float]
ta.kc(series, length, mult, useTrueRange) β†’ [series float, series float, series float]

Returns: Keltner Channels.

Arguments:

Name
Type
Description

series

series int/float

Series of values to process.

length

series int

Number of bars (length).

mult

series int/float

Standard deviation factor.

useTrueRange

series bool

An optional parameter. Specifies if True Range is used; default is true. If the value is false, the range will be calculated with the expression (high - low).


ta.kcw

Definition: Keltner Channels Width. The Keltner Channels Width is the difference between the upper and the lower Keltner Channels divided by the middle channel.

Syntax:

ta.kcw(series, length, mult) β†’ series float
ta.kcw(series, length, mult, useTrueRange) β†’ series float

Returns: Keltner Channels Width.

Arguments:

Name
Type
Description

series

series int/float

Series of values to process.

length

simple int

Number of bars (length).

mult

simple int/float

Standard deviation factor.

useTrueRange

simple bool

An optional parameter. Specifies if True Range is used; default is true. If the value is false, the range will be calculated with the expression (high - low).


ta.linreg

Definition: Linear regression curve. A line that best fits the prices specified over a user-defined time period. It is calculated using the least squares method.

Syntax:

ta.linreg(source, length, offset) β†’ series float

Returns: Linear regression curve.

Arguments:

Name
Type
Description

source

series int/float

Source series.

length

series int

Number of bars (length).

offset

simple int

Offset.


ta.lowest

Definition: Lowest value for a given number of bars back.

Syntax:

ta.lowest(source, length) β†’ series float
ta.lowest(length) β†’ series float

Returns: Lowest value in the series.

Arguments:

Name
Type
Description

source

series int/float

Series of values to process.

length

series int

Number of bars (length).

Remarks:

  • Two args version: source is a series and length is the number of bars back.

  • One arg version: length is the number of bars back. Algorithm uses low as a source series.


ta.lowestbars

Definition: Lowest value offset for a given number of bars back.

Syntax:

ta.lowestbars(source, length) β†’ series int
ta.lowestbars(length) β†’ series int

Returns: Offset to the lowest bar.

Arguments:

Name
Type
Description

source

series int/float

Series of values to process.

length

series int

Number of bars (length).


ta.macd

Definition: Moving average convergence/divergence. It is supposed to reveal changes in the strength, direction, momentum, and duration of a trend in a stock's price.

Syntax:

ta.macd(source, fastlen, slowlen, siglen) β†’ [series float, series float, series float]

Returns: Tuple of three MACD series: MACD line, signal line, and histogram line.

Arguments:

Name
Type
Description

source

series int/float

Series of values to process.

fastlen

simple int

Fast Length parameter.

slowlen

simple int

Slow Length parameter.

siglen

simple int

Signal Length parameter.


ta.max

Definition: Returns the all-time high value of source from the beginning of the chart up to the current bar.

Syntax:

ta.max(source) β†’ series float

Returns: The all-time high value in the series.

Arguments:

Name
Type
Description

source

series int/float

Source used for the calculation.


ta.median

Definition: Returns the median of the series.

Syntax:

ta.median(source, length) β†’ series float
ta.median(source, length) β†’ series int

Returns: The median of the series.

Arguments:

Name
Type
Description

source

series int/float

Series of values to process.

length

series int

Number of bars (length).


ta.mfi

Definition: Money Flow Index. The Money Flow Index (MFI) is a technical oscillator that uses price and volume for identifying overbought or oversold conditions in an asset.

Syntax:

ta.mfi(series, length) β†’ series float

Returns: Money Flow Index.

Arguments:

Name
Type
Description

series

series int/float

Series of values to process.

length

series int

Number of bars (length).


ta.min

Definition: Returns the all-time low value of source from the beginning of the chart up to the current bar.

Syntax:

ta.min(source) β†’ series float

Returns: The all-time low value in the series.

Arguments:

Name
Type
Description

source

series int/float

Source used for the calculation.


ta.mode

Definition: Returns the mode of the series. If there are several values with the same frequency, it returns the smallest value.

Syntax:

bashCopy codeta.mode(source, length) β†’ series float
ta.mode(source, length) β†’ series int

Returns: The most frequently occurring value from the source. If none exists, returns the smallest value instead.

Arguments:

Name
Type
Description

source

series int/float

Series of values to process.

length

series int

Number of bars (length).


ta.mom

Definition: Momentum of source price and source price length bars ago. This is simply a difference: source - source[length].

Syntax:

ta.mom(source, length) β†’ series float

Returns: Momentum of source price and source price length bars ago.

Arguments:

Name
Type
Description

source

series int/float

Series of values to process.

length

series int

Offset from the current bar to the previous bar.


ta.percentile_linear_interpolation

Definition: Calculates percentile using the method of linear interpolation between the two nearest ranks.

Syntax:

ta.percentile_linear_interpolation(source, length, percentage) β†’ series float

Returns: P-th percentile of source series for length bars back.

Arguments:

Name
Type
Description

source

series int/float

Series of values to process (source).

length

series int

Number of bars back (length).

percentage

simple int/float

Percentage, a number from the range 0..100.


ta.percentile_nearest_rank

Definition: Calculates percentile using the method of Nearest Rank.

Syntax:

ta.percentile_nearest_rank(source, length, percentage) β†’ series float

Returns: P-th percentile of source series for length bars back.

Arguments:

Name
Type
Description

source

series int/float

Series of values to process (source).

length

series int

Number of bars back (length).

percentage

simple int/float

Percentage, a number from the range 0..100.


ta.percentrank

Definition: Percent rank is the percents of how many previous values were less than or equal to the current value of the given series.

Syntax:

ta.percentrank(source, length) β†’ series float

Returns: Percent rank of source for length bars back.

Arguments:

Name
Type
Description

source

series int/float

Series of values to process.

length

series int

Number of bars back (length).


ta.psar

Definition: Parabolic SAR (parabolic stop and reverse) is a method devised by J. Welles Wilder, Jr., to find potential reversals in the market price direction of traded goods.

Syntax:

ta.psar(start, inc, max) β†’ series float

Returns: Parabolic SAR.

Arguments:

Name
Type
Description

start

simple int/float

Start.

inc

simple int/float

Increment.

max

simple int/float

Maximum.


ta.pvt

Definition: Price-volume trend indicator (PVT) shows the relationship between price and volume and is designed to confirm price trends.

Syntax:

ta.pvt(close, volume) β†’ series float

Returns: Price-volume trend indicator.

Arguments:

Name
Type
Description

close

series int/float

Close price series.

volume

series int/float

Volume series.


ta.rma

Definition: Moving average used in RSI. It is the exponentially weighted moving average with alpha = 1 / length.

Syntax:

ta.rma(source, length) β†’ series float

Returns: Exponential moving average of source with alpha = 1 / length.

Arguments:

Name
Type
Description

source

series int/float

Series of values to process.

length

simple int

Number of bars (length).


ta.roc

Definition: Calculates the percentage of change (rate of change) between the current value of source and its value length bars ago.

Syntax:

ta.roc(source, length) β†’ series float

Returns: The rate of change of source for length bars back.

Arguments:

Name
Type
Description

source

series int/float

Series of values to process.

length

series int

Number of bars (length).


ta.rsi

Definition: Relative strength index. It is calculated using the ta.rma() of upward and downward changes of source over the last length bars.

Syntax:

ta.rsi(source, length) β†’ series float

Returns: Relative strength index.

Arguments:

Name
Type
Description

source

series int/float

Series of values to process.

length

simple int

Number of bars (length).


ta.sar

Definition: Parabolic SAR (parabolic stop and reverse) is a method devised by J. Welles Wilder, Jr., to find potential reversals in the market price direction of traded goods.

Syntax:

ta.sar(start, inc, max) β†’ series float

Returns: Parabolic SAR.

Arguments:

Name
Type
Description

start

simple int/float

Start.

inc

simple int/float

Increment.

max

simple int/float

Maximum.


ta.sma

Definition: The sma function returns the moving average, that is the sum of the last length values of source, divided by length.

Syntax:

ta.sma(source, length) β†’ series float

Returns: Simple moving average of source for length bars back.

Arguments:

Name
Type
Description

source

series int/float

Series of values to process.

length

series int

Number of bars (length).


ta.stdev

Definition: Standard deviation.

Syntax:

ta.stdev(source, length, biased) β†’ series float

Returns: Standard deviation.

Arguments:

Name
Type
Description

source

series int/float

Series of values to process.

length

series int

Number of bars (length).

biased

series bool

Determines which estimate should be used. Optional. The default is true.

ta.stoch

Definition: Stochastic. It is calculated by a formula: 100 * (close - lowest(low, length)) / (highest(high, length) - lowest(low, length)).

Syntax:

ta.stoch(source, high, low, length) β†’ series float

Returns: Stochastic.

Arguments:

Name
Type
Description

source

series int/float

Source series.

high

series int/float

Series of high.

low

series int/float

Series of low.

length

series int

Length (number of bars back).


ta.supertrend

Definition: The Supertrend Indicator. The Supertrend is a trend following indicator.

Syntax:

ta.supertrend(factor, atrPeriod) β†’ [series float, series float]

Returns: Tuple of two supertrend series: supertrend line and direction of trend. Possible values are 1 (down direction) and -1 (up direction).

Arguments:

Name
Type
Description

factor

series int/float

The multiplier by which the ATR will get multiplied.

atrPeriod

simple int

Length of ATR.


ta.swma

Definition: Symmetrically weighted moving average with fixed length: 4. Weights: [1/6, 2/6, 2/6, 1/6].

Syntax:

ta.swma(source) β†’ series float

Returns: Symmetrically weighted moving average.

Arguments:

Name
Type
Description

source

series int/float

Source series.


ta.tr

Definition: True range. It is math.max(high - low, math.abs(high - close[1]), math.abs(low - close[1]).

Syntax:

ta.tr(handle_na) β†’ series float

Returns: True range.

Arguments:

Name
Type
Description

handle_na

simple bool

How NaN values are handled. If true, and the previous day's close is NaN, then tr would be calculated as the current day's high - low. Otherwise (if false), tr would return NaN in such cases. Also note that ta.atr uses ta.tr(true).


ta.tsi

Definition: True strength index. It uses moving averages of the underlying momentum of a financial instrument.

Syntax:

ta.tsi(source, short_length, long_length) β†’ series float

Returns: True strength index. A value in the range [-1, 1].

Arguments:

Name
Type
Description

source

series int/float

Source series.

short_length

simple int

Short length.

long_length

simple int

Long length.


ta.valuewhen

Definition: Returns the value of the source series on the bar where the condition was true on the nth most recent occurrence.

Syntax:

ta.valuewhen(condition, source, occurrence) β†’ series float
ta.valuewhen(condition, source, occurrence) β†’ series int
ta.valuewhen(condition, source, occurrence) β†’ series bool
ta.valuewhen(condition, source, occurrence) β†’ series color

Returns: The value of the source series on the bar where the condition was true on the nth most recent occurrence.

Arguments:

Name
Type
Description

condition

series bool

The condition to search for.

source

series int/float/bool/color

The value to be returned from the bar where the condition is met.

occurrence

simple int

The occurrence of the condition. The numbering starts from 0 and goes back in time, so '0' is the most recent occurrence of condition, '1' is the second most recent, and so forth. Must be an integer >= 0.


ta.variance

Definition: Variance is the expectation of the squared deviation of a series from its mean (ta.sma), and it informally measures how far a set of numbers are spread out from their mean.

Syntax:

ta.variance(source, length, biased) β†’ series float

Returns: Variance of source for length bars back.

Arguments:

Name
Type
Description

source

series int/float

Series of values to process.

length

series int

Number of bars (length).

biased

series bool

Determines which estimate should be used. Optional. The default is true.


ta.vwap

Definition: Volume weighted average price.

Syntax:

ta.vwap(source) β†’ series float
ta.vwap(source, anchor) β†’ series float
ta.vwap(source, anchor, stdev_mult) β†’ [series float, series float, series float]

Returns: A VWAP series or a tuple [vwap, upper_band, lower_band] if stdev_mult is specified.

Arguments:

Name
Type
Description

source

series int/float

Source used for the VWAP calculation.

anchor

series bool

The condition that triggers the reset of VWAP calculations. When true, calculations reset; when false, calculations proceed using the values accumulated since the previous reset. Optional. The default is equivalent to passing timeframe.change with '1D' as its argument.

stdev_mult

series int/float

If specified, the function will calculate the standard deviation bands based on the main VWAP series and return a [vwap, upper_band, lower_band] tuple. The upper_band/lower_band values are calculated using the VWAP to which the standard deviation multiplied by this argument is added/subtracted. Optional. The default is na, in which case the function returns a single value, not a tuple.


ta.vwma

Definition: The vwma function returns volume-weighted moving average of source for length bars back. It is the same as: sma(source * volume, length) / sma(volume, length).

Syntax:

ta.vwma(source, length) β†’ series float

Returns: Volume-weighted moving average of source for length bars back.

Arguments:

Name
Type
Description

source

series int/float

Series of values to process.

length

series int

Number of bars (length).


ta.wma

Definition: The wma function returns weighted moving average of source for length bars back. In wma, weighting factors decrease in arithmetical progression.

Syntax:

ta.wma(source, length) β†’ series float

Returns: Weighted moving average of source for length bars back.

Arguments:

Name
Type
Description

source

series int/float

Series of values to process.

length

series int

Number of bars (length).


ta.wpr

Definition: Williams %R. The oscillator shows the current closing price in relation to the high and low of the past 'length' bars.

Syntax:

ta.wpr(length) β†’ series float

Returns: Williams %R.

Arguments:

Name
Type
Description

length

series int

Number of bars.

Last updated