PINE LIBRARY
Updated TAExt

Library "TAExt"
Indicator functions can be used in other indicators and strategies. This will be extended by time with indicators I use in my strategies and studies.
atrwo(length, stdev_length, stdev_mult) ATR without outliers
Parameters:
length: The length of the ATR
stdev_length: The length of the standard deviation, used for detecting outliers
stdev_mult: The multiplier of the standard deviation, used for detecting outliers
Returns: The ATR value
atrwma(src, period, type, atr_length, stdev_length, stdev_mult) ATR without outlier weighted moving average
Parameters:
src: The source of the moving average
period: The period of the moving average
type: The type of the moving average, possible values: SMA, EMA, RMA
atr_length: The length of the ATR
stdev_length: The length of the standard deviation, used for detecting outliers
stdev_mult: The multiplier of the standard deviation, used for detecting outliers
Returns: The moving average value
jma(src, period, phase, power) Jurik Moving Average
Parameters:
src: The source of the moving average
period: The period of the moving average calculation
phase: The phase of jurik MA calculation (-100..100)
power: The power of jurik MA calculation
Returns: The Jurik MA series
anyma(src, period, type, offset, sigma, phase, power) Moving Average by type
Parameters:
src: The source of the moving average
period: The period of the moving average calculation
type: The type of the moving average
offset: Used only by ALMA, it is the ALMA offset
sigma: Used only by ALMA, it is the ALMA sigma
phase: The phase of jurik MA calculation (-100..100)
power: The power of jurik MA calculation
Returns: The moving average series
wae(macd_src, macd_fast_length, macd_slow_length, macd_sensitivity, bb_base_src, bb_upper_src, bb_lower_src, bb_length, bb_mult, dead_zone_length, dead_zone_mult) Waddah Attar Explosion (WAE)
Parameters:
macd_src: The source series used by MACD
macd_fast_length: The fast MA length of the MACD
macd_slow_length: The slow MA length of the MACD
macd_sensitivity: The MACD diff multiplier
bb_base_src: The source used by stdev
bb_upper_src: The source used by the upper Bollinger Band
bb_lower_src: The source used by the lower Bollinger Band
bb_length: The lenth for Bollinger Bands
bb_mult: The multiplier for Bollinger Bands
dead_zone_length: The ATR length for dead zone calculation
dead_zone_mult: The ATR multiplier for dead zone
Returns: [float up, float down, float explosion, float dead_zone]
ssl(length, high_src, low_src) Semaphore Signal Level channel (SSL)
Parameters:
length: The length of the moving average
high_src: Source of the high moving average
low_src: Source of the low moving average
Returns: [ssl_up, ssl_down]
adx(atr_length, di_length, adx_length, high_src, low_src, atr_ma_type, di_ma_type, adx_ma_type) Average Directional Index + Direction Movement Index (ADX + DMI)
Parameters:
atr_length: The length of ATR
di_length: DI plus and minus smoothing length
adx_length: ADX smoothing length
high_src: Source of the high moving average
low_src: Source of the low moving average
atr_ma_type: MA type of the ATR calculation
di_ma_type: MA type of the DI calculation
adx_ma_type: MA type of the ADX calculation
Returns: [plus, minus, adx]
Indicator functions can be used in other indicators and strategies. This will be extended by time with indicators I use in my strategies and studies.
atrwo(length, stdev_length, stdev_mult) ATR without outliers
Parameters:
length: The length of the ATR
stdev_length: The length of the standard deviation, used for detecting outliers
stdev_mult: The multiplier of the standard deviation, used for detecting outliers
Returns: The ATR value
atrwma(src, period, type, atr_length, stdev_length, stdev_mult) ATR without outlier weighted moving average
Parameters:
src: The source of the moving average
period: The period of the moving average
type: The type of the moving average, possible values: SMA, EMA, RMA
atr_length: The length of the ATR
stdev_length: The length of the standard deviation, used for detecting outliers
stdev_mult: The multiplier of the standard deviation, used for detecting outliers
Returns: The moving average value
jma(src, period, phase, power) Jurik Moving Average
Parameters:
src: The source of the moving average
period: The period of the moving average calculation
phase: The phase of jurik MA calculation (-100..100)
power: The power of jurik MA calculation
Returns: The Jurik MA series
anyma(src, period, type, offset, sigma, phase, power) Moving Average by type
Parameters:
src: The source of the moving average
period: The period of the moving average calculation
type: The type of the moving average
offset: Used only by ALMA, it is the ALMA offset
sigma: Used only by ALMA, it is the ALMA sigma
phase: The phase of jurik MA calculation (-100..100)
power: The power of jurik MA calculation
Returns: The moving average series
wae(macd_src, macd_fast_length, macd_slow_length, macd_sensitivity, bb_base_src, bb_upper_src, bb_lower_src, bb_length, bb_mult, dead_zone_length, dead_zone_mult) Waddah Attar Explosion (WAE)
Parameters:
macd_src: The source series used by MACD
macd_fast_length: The fast MA length of the MACD
macd_slow_length: The slow MA length of the MACD
macd_sensitivity: The MACD diff multiplier
bb_base_src: The source used by stdev
bb_upper_src: The source used by the upper Bollinger Band
bb_lower_src: The source used by the lower Bollinger Band
bb_length: The lenth for Bollinger Bands
bb_mult: The multiplier for Bollinger Bands
dead_zone_length: The ATR length for dead zone calculation
dead_zone_mult: The ATR multiplier for dead zone
Returns: [float up, float down, float explosion, float dead_zone]
ssl(length, high_src, low_src) Semaphore Signal Level channel (SSL)
Parameters:
length: The length of the moving average
high_src: Source of the high moving average
low_src: Source of the low moving average
Returns: [ssl_up, ssl_down]
adx(atr_length, di_length, adx_length, high_src, low_src, atr_ma_type, di_ma_type, adx_ma_type) Average Directional Index + Direction Movement Index (ADX + DMI)
Parameters:
atr_length: The length of ATR
di_length: DI plus and minus smoothing length
adx_length: ADX smoothing length
high_src: Source of the high moving average
low_src: Source of the low moving average
atr_ma_type: MA type of the ATR calculation
di_ma_type: MA type of the DI calculation
adx_ma_type: MA type of the ADX calculation
Returns: [plus, minus, adx]
Release Notes
v2Updated:
ssl(length, src, high_src, low_src) Semaphore Signal Level channel (SSL)
Parameters:
length: The length of the moving average
src: Source of compare
high_src: Source of the high moving average
low_src: Source of the low moving average
Returns: [ssl_up, ssl_down]
Release Notes
v3- Added SWMA to moving averages
- Choppiness index functions, one with ATRWO and one with STDev
Added:
chop(length, atr_length, stdev_length, stdev_mult) Choppiness Index (CHOP) using ATRWO
Parameters:
length: The sum and highest/lowest length
atr_length: The length of the ATR
stdev_length: The length of the standard deviation, used for detecting outliers
stdev_mult: The multiplier of the standard deviation, used for detecting outliers
Returns: The choppiness value
chop_stdev(length, src, stdev_length) Choppiness Index (CHOP) using stdev instead of ATR
Parameters:
length: The sum and highest/lowest length
src: The source of the stdev
stdev_length: The length of the stdev calculation
Returns: The choppiness value
Release Notes
v4- Ability to use different moving averages for ATR
- SSMA and DONCHIAN support for anyma function
- Keltner Channels function with trend detection
Added:
kc(length, atr_length, mult, base_src, upper_src, lower_src, base_ma_type, upper_ma_type, lower_ma_type, stdev_length, stdev_mult) Keltner Channels (KC)
Parameters:
length: The length of moving averages
atr_length: The ATR length, the ATR is used to shift the upper and lower bands
mult: The ATR multiplier
base_src: Source of the base line
upper_src: Source of the upper line
lower_src: Source of the lower line
base_ma_type: The MA type of the base line
upper_ma_type: The MA type of the upper line
lower_ma_type: The MA type of the lower line
stdev_length: The length of the standard deviation, used for detecting outliers
stdev_mult: The multiplier of the standard deviation, used for detecting outliers
@retrurns [base, lower, upper]
kc_trend(base, upper, lower, lookback) Keltner Channel Trend
Parameters:
base: The base value returned by kc function
upper: The upper value returned by kc function
lower: The lower value returned by kc function
lookback: Howmany timestaps to look back to determine the trend
Returns: [uptrend, downtrend, base_uptrend, lower_uptrend, upper_uptrend]
Updated:
jma(src, length, phase, power) Jurik Moving Average
Parameters:
src: The source of the moving average
length: The length of the moving average calculation
phase: The phase of jurik MA calculation (-100..100)
power: The power of jurik MA calculation
Returns: The Jurik MA series
atrwo(length, stdev_length, stdev_mult, ma_type) ATR without outliers
Parameters:
length: The length of the ATR smoothing
stdev_length: The length of the standard deviation, used for detecting outliers
stdev_mult: The multiplier of the standard deviation, used for detecting outliers
ma_type: The moving average type used for smoothing
Returns: The ATR value
atrwma(src, length, type, atr_length, stdev_length, stdev_mult) ATR without outlier weighted moving average
Parameters:
src: The source of the moving average
length: The length of the moving average
type: The type of the moving average, possible values: SMA, EMA, RMA
atr_length: The length of the ATR
stdev_length: The length of the standard deviation, used for detecting outliers
stdev_mult: The multiplier of the standard deviation, used for detecting outliers
Returns: The moving average series
anyma(src, length, type, offset, sigma, phase, power) Moving Average by type
Parameters:
src: The source of the moving average
length: The length of the moving average calculation
type: The type of the moving average
offset: Used only by ALMA, it is the ALMA offset
sigma: Used only by ALMA, it is the ALMA sigma
phase: The phase of jurik MA calculation (-100..100)
power: The power of jurik MA calculation
Returns: The moving average series
Release Notes
v5- Supertrend indicator (based on Keltner Channel)s, and also very flexible
- Smoothed Heiken Ashi which can use before and after smoothing moving average
Added:
supertrend(upper, lower, compare_src, returns) Supertrend, calculated from above "kc" (Keltner Channel Function)
Parameters:
upper: The upper value returned by kc function
lower: The lower value returned by kc function
compare_src: Source of the base line
returns: [supertrend, direction]
heiken_ashi(smooth_length, smooth_ma_type, after_smooth_length, after_smooth_ma_type, src_open, src_high, src_low, src_close) Heiken Ashi (Smoothed) Candle
Parameters:
smooth_length: Smooth length before heiken ashi calculation
smooth_ma_type: Type of smoothing MA before heiken ashi calculation
after_smooth_length: Smooth length after
after_smooth_ma_type: Smooth MA type after
src_open: Sourve of open
src_high: Source of high
src_low: Source of low
src_close: Source of close
Returns: [open, high, low, close]
Release Notes
v6- Fixed start of supertrend
- Added ATRWO to ADX
- Added ATR MA type parameter to chop
Updated:
adx(atr_length, di_length, adx_length, high_src, low_src, atr_ma_type, di_ma_type, adx_ma_type, atr_stdev_length, atr_stdev_mult) Average Directional Index + Direction Movement Index (ADX + DMI)
Parameters:
atr_length: The length of ATR
di_length: DI plus and minus smoothing length
adx_length: ADX smoothing length
high_src: Source of the high moving average
low_src: Source of the low moving average
atr_ma_type: MA type of the ATR calculation
di_ma_type: MA type of the DI calculation
adx_ma_type: MA type of the ADX calculation
atr_stdev_length: The length of the standard deviation, used for detecting outliers
atr_stdev_mult: The multiplier of the standard deviation, used for detecting outliers
Returns: [plus, minus, adx]
chop(length, atr_length, stdev_length, stdev_mult, ma_type) Choppiness Index (CHOP) using ATRWO
Parameters:
length: The sum and highest/lowest length
atr_length: The length of the ATR
stdev_length: The length of the standard deviation, used for detecting outliers
stdev_mult: The multiplier of the standard deviation, used for detecting outliers
ma_type: The MA type of ATR
Returns: The choppiness value
Release Notes
v7Fixed: DEMA and TEMA, now they have the same results as TradingView ones
Added:
slope_per_atr(src, lookback, atr_length, stdev_length, stdev_mult, atr_ma_type) Slope per ATR, it is a slope, that can be used across multiple assets
Parameters:
src: The Source of slope
lookback: How many timestaps to look back
atr_length: The length of the TR smoothing
stdev_length: The length of the standard deviation, used for detecting outliers
stdev_mult: The multiplier of the standard deviation, used for detecting outliers
atr_ma_type: The moving average type used for smoothing
Returns: The slope value
angle(src, lookback, atr_length, stdev_length, stdev_mult, atr_ma_type) Angle of Slope per ATR
Parameters:
src: The Source of slope
lookback: How many timestaps to look back
atr_length: The length of the TR smoothing
stdev_length: The length of the standard deviation, used for detecting outliers
stdev_mult: The multiplier of the standard deviation, used for detecting outliers
atr_ma_type: The moving average type used for smoothing
Returns: The slope value
Release Notes
v8Fix: anyma DONCHAIN uses src
Release Notes
v9Added:
macd(fast_src, slow_src, fast_ma_type, slow_ma_type, fast_length, slow_length, signal_ma_type, signal_length) Moving Average Convergence Divergence (MACD)
Parameters:
fast_src: The source series used by MACD fast
slow_src: The source series used by MACD slow
fast_ma_type: The MA type for the MACD
slow_ma_type: The MA type for the MACD
fast_length: The fast MA length of the MACD
slow_length: The slow MA length of the MACD
signal_ma_type: The MA type for the MACD signal
signal_length: The signal MA length of the MACD
Release Notes
v10Added:
swinghl(use_ha_candle)
Calculate recent swing high and low from Heiken Ashi candle reverse points
Parameters:
use_ha_candle: If true, use HA candle open/close to swing high/low instead of normal high/low
Fixed:
- JMA warming period
Pine library
In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in publications is governed by House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Pine library
In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in publications is governed by House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.