least_squares_regressionLibrary   "least_squares_regression" 
least_squares_regression: Least squares regression algorithm to find the optimal price interval for a given time period
 basic_lsr(series, series, series)  basic_lsr: Basic least squares regression algorithm
  Parameters:
     series : int  t: time scale value array corresponding to price
     series : float  p: price scale value array corresponding to time
     series : int array_size: the length of regression array
  Returns: reg_slop, reg_intercept, reg_level, reg_stdev
 trend_line_lsr(series, series, series, string, series, series)  top_trend_line_lsr: Trend line fitting based on least square algorithm
  Parameters:
     series : int  t: time scale value array corresponding to price
     series : float  p: price scale value array corresponding to time
     series : int array_size: the length of regression array
     string : reg_type: regression type in 'top' and 'bottom'
     series : int max_iter: maximum fitting iterations
     series : int min_points: the threshold of regression point numbers
  Returns: reg_slop, reg_intercept, reg_level, reg_stdev, reg_point_num
Techindicator
simple_squares_regressionLibrary   "simple_squares_regression" 
simple_squares_regression: simple squares regression algorithm to find the optimal price interval for a given time period
 basic_ssr(series, series, series)  basic_ssr: Basic simple squares regression algorithm
  Parameters:
     series : float src: the regression source such as close
     series : int region_forward: number of candle lines at the right end of the regression region from the current candle line
     series : int region_len: the length of regression region
  Returns: left_loc, right_loc, reg_val, reg_std, reg_max_offset
 search_ssr(series, series, series, series)  search_ssr: simple squares regression region search algorithm
  Parameters:
     series : float src: the regression source such as close
     series : int max_forward: max number of candle lines at the right end of the regression region from the current candle line
     series : int region_lower: the lower length of regression region
     series : int region_upper: the upper length of regression region
  Returns: left_loc, right_loc, reg_val, reg_level, reg_std_err, reg_max_offset
on_balance_volumeLibrary   "on_balance_volume" 
on_balance_volume: custom on balance volume
 obv_diff(string, simple)  obv_diff: custom on balance volume diff version
  Parameters:
     string : type: the moving average type of on balance volume
     simple : int len: the moving average length of on balance volume
  Returns: obv_diff: custom on balance volume diff value
 obv_diff_norm(string, simple)  obv_diff_norm: custom normalized on balance volume diff version
  Parameters:
     string : type: the moving average type of on balance volume
     simple : int len: the moving average length of on balance volume
  Returns: obv_diff: custom normalized on balance volume diff value
moving_averageLibrary   "moving_average" 
moving_average: moving average variants
 variant(string, series, simple)  variant: moving average variants
  Parameters:
     string : type: type in  
     series : float src: the source series of moving average
     simple : int len: the length of moving average
  Returns: float: the moving average variant value
NormalizedOscillatorsLibrary   "NormalizedOscillators" 
Collection of some common Oscillators. All are zero-mean and normalized to fit in the -1..1 range. Some are modified, so that the internal smoothing function could be configurable (for example, to enable Hann Windowing, that John F. Ehlers uses frequently). Some are modified for other reasons (see comments in the code), but never without a reason. This collection is neither encyclopaedic, nor reference, however I try to find the most correct implementation. Suggestions are welcome.
 rsi2(upper, lower)  RSI - second step
  Parameters:
     upper : Upwards momentum
     lower : Downwards momentum
  Returns: Oscillator value
Modified by Ehlers from Wilder's implementation to have a zero mean (oscillator from -1 to +1)
Originally: 100.0 - (100.0 / (1.0 + upper / lower))
Ignoring the 100 scale factor, we get: upper / (upper + lower)
Multiplying by two and subtracting 1, we get: (2 * upper) / (upper + lower) - 1 =  (upper - lower) / (upper + lower)
 rms(src, len)  Root mean square (RMS)
  Parameters:
     src : Source series
     len : Lookback period
Based on by John F. Ehlers implementation
 ift(src)  Inverse Fisher Transform
  Parameters:
     src : Source series
  Returns: Normalized series
Based on by John F. Ehlers implementation
The input values have been multiplied by 2 (was "2*src", now "4*src") to force expansion - not compression
The inputs may be further modified, if needed
 stoch(src, len)  Stochastic
  Parameters:
     src : Source series
     len : Lookback period
  Returns: Oscillator series
 ssstoch(src, len)  Super Smooth Stochastic (part of MESA Stochastic) by John F. Ehlers
  Parameters:
     src : Source series
     len : Lookback period
  Returns: Oscillator series
Introduced in the January 2014 issue of Stocks and Commodities
This is not an implementation of MESA Stochastic, as it is based on Highpass filter not present in the function (but you can construct it)
This implementation is scaled by 0.95, so that Super Smoother does not exceed 1/-1
I do not know, if this the right way to fix this issue, but it works for now
 netKendall(src, len)  Noise Elimination Technology by John F. Ehlers
  Parameters:
     src : Source series
     len : Lookback period
  Returns: Oscillator series
Introduced in the December 2020 issue of Stocks and Commodities
Uses simplified Kendall correlation algorithm
Implementation by @QuantTherapy: 
 rsi(src, len, smooth)  RSI
  Parameters:
     src : Source series
     len : Lookback period
     smooth : Internal smoothing algorithm
  Returns: Oscillator series
 vrsi(src, len, smooth)  Volume-scaled RSI
  Parameters:
     src : Source series
     len : Lookback period
     smooth : Internal smoothing algorithm
  Returns: Oscillator series
This is my own version of RSI. It scales price movements by the proportion of RMS of volume
 mrsi(src, len, smooth)  Momentum RSI
  Parameters:
     src : Source series
     len : Lookback period
     smooth : Internal smoothing algorithm
  Returns: Oscillator series
Inspired by RocketRSI by John F. Ehlers (Stocks and Commodities, May 2018)
 rrsi(src, len, smooth)  Rocket RSI
  Parameters:
     src : Source series
     len : Lookback period
     smooth : Internal smoothing algorithm
  Returns: Oscillator series
Inspired by RocketRSI by John F. Ehlers (Stocks and Commodities, May 2018)
Does not include Fisher Transform of the original implementation, as the output must be normalized
Does not include momentum smoothing length configuration, so always assumes half the lookback length
 mfi(src, len, smooth)  Money Flow Index
  Parameters:
     src : Source series
     len : Lookback period
     smooth : Internal smoothing algorithm
  Returns: Oscillator series
 lrsi(src, in_gamma, len)  Laguerre RSI by John F. Ehlers
  Parameters:
     src : Source series
     in_gamma : Damping factor (default is -1 to generate from len)
     len : Lookback period (alternatively, if gamma is not set)
  Returns: Oscillator series
The original implementation is with gamma. As it is impossible to collect gamma in my system, where the only user input is length,
an alternative calculation is included, where gamma is set by dividing len by 30. Maybe different calculation would be better?
 fe(len)  Choppiness Index or Fractal Energy
  Parameters:
     len : Lookback period
  Returns: Oscillator series
The Choppiness Index (CHOP) was created by E. W. Dreiss
This indicator is sometimes called Fractal Energy
 er(src, len)  Efficiency ratio
  Parameters:
     src : Source series
     len : Lookback period
  Returns: Oscillator series
Based on Kaufman Adaptive Moving Average calculation
This is the correct Efficiency ratio calculation, and most other implementations are wrong:
the number of bar differences is 1 less than the length, otherwise we are adding the change outside of the measured range!
For reference, see Stocks and Commodities June 1995
 dmi(len, smooth)  Directional Movement Index
  Parameters:
     len : Lookback period
     smooth : Internal smoothing algorithm
  Returns: Oscillator series
Based on the original Tradingview algorithm
Modified with inspiration from John F. Ehlers DMH (but not implementing the DMH algorithm!)
Only ADX is returned
Rescaled to fit -1 to +1
Unlike most oscillators, there is no src parameter as DMI works directly with high and low values
 fdmi(len, smooth)  Fast Directional Movement Index
  Parameters:
     len : Lookback period
     smooth : Internal smoothing algorithm
  Returns: Oscillator series
Same as DMI, but without secondary smoothing. Can be smoothed later. Instead, +DM and -DM smoothing can be configured
 doOsc(type, src, len, smooth)  Execute a particular Oscillator from the list
  Parameters:
     type : Oscillator type to use
     src : Source series
     len : Lookback period
     smooth : Internal smoothing algorithm
  Returns: Oscillator series
Chande Momentum Oscillator (CMO) is RSI without smoothing. No idea, why some authors use different calculations
LRSI with Fractal Energy is a combo oscillator that uses Fractal Energy to tune LRSI gamma, as seen here: www.prorealcode.com
 doPostfilter(type, src, len)  Execute a particular Oscillator Postfilter from the list
  Parameters:
     type : Oscillator type to use
     src : Source series
     len : Lookback period
  Returns: Oscillator series
CommonFiltersLibrary   "CommonFilters" 
Collection of some common Filters and Moving Averages. This collection is not encyclopaedic, but to declutter my other scripts. Suggestions are welcome, though. Many filters here are based on the work of John F. Ehlers
 sma(src, len)  Simple Moving Average
  Parameters:
     src : Series to use
     len : Filtering length
  Returns: Filtered series
 ema(src, len)  Exponential Moving Average
  Parameters:
     src : Series to use
     len : Filtering length
  Returns: Filtered series
 rma(src, len)  Wilder's Smoothing (Running Moving Average)
  Parameters:
     src : Series to use
     len : Filtering length
  Returns: Filtered series
 hma(src, len)  Hull Moving Average
  Parameters:
     src : Series to use
     len : Filtering length
  Returns: Filtered series
 vwma(src, len)  Volume Weighted Moving Average
  Parameters:
     src : Series to use
     len : Filtering length
  Returns: Filtered series
 hp2(src)  Simple denoiser
  Parameters:
     src : Series to use
  Returns: Filtered series
 fir2(src)  Zero at 2 bar cycle period by John F. Ehlers
  Parameters:
     src : Series to use
  Returns: Filtered series
 fir3(src)  Zero at 3 bar cycle period by John F. Ehlers
  Parameters:
     src : Series to use
  Returns: Filtered series
 fir23(src)  Zero at 2 bar and 3 bar cycle periods by John F. Ehlers
  Parameters:
     src : Series to use
  Returns: Filtered series
 fir234(src)  Zero at 2, 3 and 4 bar cycle periods by John F. Ehlers
  Parameters:
     src : Series to use
  Returns: Filtered series
 hp(src, len)  High Pass Filter for cyclic components shorter than langth. Part of Roofing Filter by John F. Ehlers
  Parameters:
     src : Series to use
     len : Filtering length
  Returns: Filtered series
 supers2(src, len)  2-pole Super Smoother by John F. Ehlers
  Parameters:
     src : Series to use
     len : Filtering length
  Returns: Filtered series
 filt11(src, len)  Filt11 is a variant of 2-pole Super Smoother with error averaging for zero-lag response by John F. Ehlers
  Parameters:
     src : Series to use
     len : Filtering length
  Returns: Filtered series
 supers3(src, len)  3-pole Super Smoother by John F. Ehlers
  Parameters:
     src : Series to use
     len : Filtering length
  Returns: Filtered series
 hannFIR(src, len)  Hann Window Filter by John F. Ehlers
  Parameters:
     src : Series to use
     len : Filtering length
  Returns: Filtered series
 hammingFIR(src, len)  Hamming Window Filter (inspired by John F. Ehlers). Simplified implementation as Pedestal input parameter cannot be supplied, so I calculate it from the supplied length
  Parameters:
     src : Series to use
     len : Filtering length
  Returns: Filtered series
 triangleFIR(src, len)  Triangle Window Filter by John F. Ehlers
  Parameters:
     src : Series to use
     len : Filtering length
  Returns: Filtered series
 doPrefilter(type, src)  Execute a particular Prefilter from the list
  Parameters:
     type : Prefilter type to use
     src : Series to use
  Returns: Filtered series
 doMA(type, src, len)  Execute a particular MA from the list
  Parameters:
     type : MA type to use
     src : Series to use
     len : Filtering length
  Returns: Filtered series
WaddahAttarExplosionLibrary   "WaddahAttarExplosion" 
 wae(sensitivity, macdFastEMALength, macdSlowEMALength, bbChannelLength, bbStdevMultiplier, refHigh, refLow, refClose)  Returns the Waddah Attar Uptrend, Downtrend, Explosion Line and Dead zone
  Parameters:
     sensitivity : simple float multiplicator for trend line calculation from macd 
     macdFastEMALength : simple int length for macd fast line
     macdSlowEMALength : simple int length for macd slow line
     bbChannelLength : simple int length for calculating the bb channel (for std deviation)
     bbStdevMultiplier : simple float multiplier to increace bb std deviation
     refHigh : series float optional if you want to use another timeframe or symbol, pass it's 'high' series here
     refLow : series float optional if you want to use another timeframe or symbol, pass it's 'low' series here
     refClose : series float optional if you want to use another timeframe or symbol, pass it's 'close' series here
  Returns: 
ATRStopLossFinderLibrary   "ATRStopLossFinder" 
Average True Range Stop Loss Finder
credits to www.tradingview.com for the initial version
 stopLossFinder(length, smoothing, multiplier, refHigh, refLow, refClose)  Returns the stop losses for an entry on this candle, depending on the ATR
  Parameters:
     length : simple int optional to select the lookback amount of candles
     smoothing : string optional to select the averaging method, options= 
     multiplier : simple float optional if you want to tweak the speed the trend changes.
     refHigh : series float optional if you want to use another timeframe or symbol, pass it's 'high' series here
     refLow : series float optional if you want to use another timeframe or symbol, pass it's 'low' series here
     refClose : series float optional if you want to use another timeframe or symbol, pass it's 'close' series here
  Returns: series float stopLossLong, series float stopLossShort, series float atr
AbdulLibraryLibrary   "AbdulLibrary" 
The library consists of three sections:
 
   Technical Analysis Functions  -  A collection of tools commonly used by day traders 
   Trading Setup Filters Functions  -  A number of filters that help day traders to screen trading signals 
   Candlestick Pattern Detection Functions  -  To detect different candlestick patterns that are used in day trading setups 
 
Note that this would have been possible without the help of @ZenAndTheArtOfTrading as I build-up this library after completing his pine script mastery course so big thanks to him
 The content of the library are:- 
 fibLevels(preDayClose, preDayHigh, preDayLow)  Calculates Daily Pivot Point and Fibonacci Key Levels
  Parameters:
     preDayClose : The previous day candle close
     preDayHigh : The previous day candle high
     preDayLow : The previous day candle low
  Returns: Returns Daily Pivot Point and Fibonacci Key Levels as a tuple
 bullishFib(canHigh, canLow, fibLevel)  Calculates Fibonacci Levels in Bullish move
  Parameters:
     canHigh : The high of the move
     canLow : The low of the move
     fibLevel : The Fib level as % you want to calculate
  Returns: Returns The Fib level for the Bullish move
 bearishFib(canHigh, canLow, fibLevel)  Calculates Fibonacci Levels in Bearish move
  Parameters:
     canHigh : The high of the move
     canLow : The low of the move
     fibLevel : The Fib level as % you want to calculate
  Returns: Returns The Fib level for the Bearish move
 getCandleSize()  Calculates the size of candle (high - low) in points
  Returns: Returns candle size in points
 getCandleBodySize()  Calculates the size of candle (close - open) in points
  Returns: Returns candle body size in points
 getHighWickSize()  Calculates the high wick size of candle in points
  Returns: Returns The high wick size of candle in points
 getLowWickSize()  Calculates the low wick size of candle in points
  Returns: Returns The low wick size of candle in points
 getBodyPercentage()  Calculates the candle body size as % of overall candle size
  Returns: Returns The candle body size as % of overall candle size
 isSwingHigh(period)  Checks if the price has created new swing high over a period of time
  Parameters:
     period : The lookback time we want to check for swing high
  Returns: Returns True if the current candle or the previous candle is a swing high
 isSwingLow(period)  Checks if the price has created new swing low over a period of time
  Parameters:
     period : The lookback time we want to check for swing low
  Returns: Returns True if the current candle or the previous candle is a swing low
 isDojiSwingHigh(period)  Checks if a doji is a swing high over a period of time
  Parameters:
     period : The lookback time we want to check for swing high
  Returns: Returns True if the doji is a swing high
 isDojiSwingLow(period)  Checks if a doji is a swing low over a period of time
  Parameters:
     period : The lookback time we want to check for swing low
  Returns: Returns True if the doji is a swing low
 isBigBody(atrFilter, atr, candleBodySize, multiplier)  Checks if a candle has big body compared to ATR
  Parameters:
     atrFilter : Check if user wants to use ATR to filter candle-setup signals
     atr : The ATR value to be used to compare candle body size
     candleBodySize : The candle body size 
     multiplier : The multiplier to be used to compare candle body size
  Returns: Returns Boolean true if the candle setup is big
 isSmallBody(atrFilter, atr, candleBodySize, multiplier)  Checks if a candle has small body compared to ATR
  Parameters:
     atrFilter : Check if user wants to use ATR to filter candle-setup signals
     atr : The ATR value to be used to compare candle body size
     candleBodySize : The candle body size 
     multiplier : The multiplier to be used to compare candle body size
  Returns: Returns Boolean true if the candle setup is small
 isHammer(fibLevel, colorMatch)  Checks if a candle is a hammer based on user input parameters and candle conditions
  Parameters:
     fibLevel : Fib level to base candle body on
     colorMatch : Checks if user needs for the candel to be green
  Returns: Returns Boolean -  True if the candle setup is hammer
 isShootingStar(fibLevel, colorMatch)  Checks if a candle is a shooting star based on user input parameters and candle conditions
  Parameters:
     fibLevel : Fib level to base candle body on
     colorMatch : Checks if user needs for the candel to be red
  Returns: Returns Boolean -  True if the candle setup is star
 isBullEngCan(allowance, period)  Check if a candle is a bullish engulfing candle
  Parameters:
     allowance : How many points the candle open is allowed to be off (To allow for gaps)
     period : The lookback period for swing low check
  Returns: Boolean - True only if the candle is a bullish engulfing candle
 isBearEngCan(allowance, period)  Check if a candle is a bearish engulfing candle
  Parameters:
     allowance : How many points the candle open is allowed to be off (To allow for gaps)
     period : The lookback period for swing high check
  Returns: Boolean - True only if the candle is a bearish engulfing candle
 isBullDoji(maxSize, wickLimit, colorFilter)  Check if a candle is a bullish doji candle
  Parameters:
     maxSize : Maximum candle body size as % of total candle size to be considered as doji
     wickLimit : Maximum wick size of one wick compared to the other wick
     colorFilter : Checks if the doji is green
  Returns: Boolean - True if the candle is a bullish doji
 isBearDoji(maxSize, wickLimit, colorFilter)  Check if a candle is a bearish doji candle
  Parameters:
     maxSize : Maximum candle body size as % of total candle size to be considered as doji
     wickLimit : Maximum wick size of one wick compared to the other wick
     colorFilter : Checks if the doji is red
  Returns: Boolean - True if the candle is a bearish doji
 isBullOutBar()  Check if a candle is a bullish outside bar
  Returns: Boolean - True if the candle is a bullish outside bar
 isInsideBar()  Check if a candle is an inside bar
  Returns: Returns Boolean - True if a candle is an inside bar
PivotsLibrary   "Pivots" 
This Library focuses in functions related to pivot highs and lows and some of their applications (i.e. divergences, zigzag, harmonics, support and resistance...)
 pivots(srcH, srcL, length)  Delivers series of pivot highs, lows and zigzag.
  Parameters:
     srcH : Source series to look for pivot highs. Stricter applications might source from 'close' prices. Oscillators are also another possible source to look for pivot highs and lows. By default 'high'
     srcL : Source series to look for pivot lows. By default 'low'
     length : This value represents the minimum number of candles between pivots. The lower the number, the more detailed the pivot profile. The higher the number, the more relevant the pivots. By default 10
  Returns:  
 zigzagArray(pivotHigh, pivotLow)  Delivers a Zigzag series based on alternating pivots. Ocasionally this line could paint a few consecutive lows or highs without alternating. That happens because it's finding a few consecutive Higher Highs or Lower Lows. If to use lines entities instead of series, that could be easily avoided. But in this one, I'm more interested outputting series rather than painting/deleting line entities.
  Parameters:
     pivotHigh : Pivot high series
     pivotLow : Pivot low series
  Returns:  
 zigzagLine(srcH, srcL, colorLine, widthLine)  Delivers a Zigzag based on line entities.
  Parameters:
     srcH : Source series to look for pivot highs. Stricter applications might source from 'close' prices. Oscillators are also another possible source to look for pivot highs and lows. By default 'high'
     srcL : Source series to look for pivot lows. By default 'low'
     colorLine : Color of the Zigzag Line. By default Fuchsia
     widthLine : Width of the Zigzag Line. By default 4
  Returns: Zigzag printed on screen
 divergence(h2, l2, h1, l1, length)  Calculates divergences between 2 series
  Parameters:
     h2 : Series in which to locate divs: Highs
     l2 : Series in which to locate divs: Lows
     h1 : Series in which to locate pivots: Highs. By default high
     l1 : Series in which to locate pivots: Lows. By default low
     length : Length used to calculate Pivots: By default 10
  Returns: 
Common FunctionsLibrary   "CommonFunctions" 
This Library provides some handy functions commonly used in Pine Script.
 crosses(source1, offset1, source2, offset2)  Checks the existance of crosses between the series
  Parameters:
     source1 : First series
     offset1 : (Optional) Offset of First series. By default 0
     source2 : (Optional) Second series. By default 'close' price
     offset2 : (Optional) Offset of Second series. By default 0
  Returns:  
 marketState(source1, offset1, source2, offset2)  Determines Bullish/Bearish state according to the relative position between the series.
  Parameters:
     source1 : Active series used to determine bullish/bearish states.
     offset1 : (Optional) Offset of First series. By default 0.
     source2 : (Optional) Second series. By default 'close' price.
     offset2 : (Optional) Offset of Second series. By default 0.
  Returns:  
 histProfile(source)  Histogram profiling
  Parameters:
     source : Histogram series
  Returns:  
 srcSelect(showSrc1, src1, showSrc2, src2)  Selects the appropiate source. If multiple sources are activated simultaneously, the order within the switch clause prevails. The first one activated is the one being output.
  Parameters:
     showSrc1 : Boolean controlling the activation of Source #1.
     src1 : Source #1.
     showSrc2 : Boolean controlling the activation of Sources #2-10. By default 'false'.
     src2 : Sources #2-10. By default 'number'.
  Returns: Selected source.
MovingAveragesLibraryLibrary   "MovingAveragesLibrary" 
This is a library allowing one to select between many different Moving Average formulas to smooth out any float variable.
You can use this library to apply a Moving Average function to any series of data as long as your source is a float.
The default application would be for applying Moving Averages onto your chart. However, the scope of this library is beyond that. Any indicator or strategy you are building can benefit from this library.
You can apply different types of smoothing and moving average functions to your indicators, momentum oscillators, average true range calculations, support and resistance zones, envelope bands, channels, and anything you can think of to attempt to smooth out noise while finding a delicate balance against lag.
If you are developing an indicator, you can use the 'ave_func' to allow your users to select any Moving Average for any function or variable by creating an input string with the following structure:
var_name = input.string(, , )
Where the types of Moving Average you would like to be provided would be included in options.
Example:
i_ma_type = input.string(title = "Moving Average Type", defval = "Hull Moving Average", options = )
Where you would add after options the strings I have included for you at the top of the PineScript for your convenience.
Then for the output you desire, simply call 'ave_func' like so:
ma = ave_func(source, length, i_ma_type)
Now the plotted Moving Average will be the same as what you or your users select from the Input.
 ema(src, len)  Exponential Moving Average.
  Parameters:
     src : Series to use ('close' is used if no argument is supplied).
     len : Lookback length to use.
  Returns: Float value.
 sma(src, len)  Simple Moving Average.
  Parameters:
     src : Series to use ('close' is used if no argument is supplied).
     len : Lookback length to use.
  Returns: Float value.
 rma(src, len)  Relative Moving Average.
  Parameters:
     src : Series to use ('close' is used if no argument is supplied).
     len : Lookback length to use.
  Returns: Float value.
 wma(src, len)  Weighted Moving Average.
  Parameters:
     src : Series to use ('close' is used if no argument is supplied).
     len : Lookback length to use.
  Returns: Float value.
 dv2(len)  Donchian V2 function.
  Parameters:
     len : Lookback length to use.
  Returns: Open + Close / 2 for the selected length.
 ModFilt(src, len)  Modular Filter smoothing function.
  Parameters:
     src : Series to use ('close' is used if no argument is supplied).
     len : Lookback length to use.
  Returns: Float value.
 EDSMA(src, len)  Ehlers Dynamic Smoothed Moving Average.
  Parameters:
     src : Series to use ('close' is used if no argument is supplied).
     len : Lookback length to use.
  Returns: EDSMA smoothing.
 dema(x, t)  Double Exponential Moving Average.
  Parameters:
     x : Series to use ('close' is used if no argument is supplied).
     t : Lookback length to use.
  Returns: DEMA smoothing.
 tema(src, len)  Triple Exponential Moving Average.
  Parameters:
     src : Series to use ('close' is used if no argument is supplied).
     len : Lookback length to use.
  Returns: TEMA smoothing.
 smma(x, t)  Smoothed Moving Average.
  Parameters:
     x : Series to use ('close' is used if no argument is supplied).
     t : Lookback length to use.
  Returns: SMMA smoothing.
 vwma(x, t)  Volume Weighted Moving Average.
  Parameters:
     x : Series to use ('close' is used if no argument is supplied).
     t : Lookback length to use.
  Returns: VWMA smoothing.
 hullma(x, t)  Hull Moving Average.
  Parameters:
     x : Series to use ('close' is used if no argument is supplied).
     t : Lookback length to use.
  Returns: Hull smoothing.
 covwma(x, t)  Coefficient of Variation Weighted Moving Average.
  Parameters:
     x : Series to use ('close' is used if no argument is supplied).
     t : Lookback length to use.
  Returns: COVWMA smoothing.
 frama(x, t)  Fractal Reactive Moving Average.
  Parameters:
     x : Series to use ('close' is used if no argument is supplied).
     t : Lookback length to use.
  Returns: FRAMA smoothing.
 kama(x, t)  Kaufman's Adaptive Moving Average.
  Parameters:
     x : Series to use ('close' is used if no argument is supplied).
     t : Lookback length to use.
  Returns: KAMA smoothing.
 donchian(len)  Donchian Calculation.
  Parameters:
     len : Lookback length to use.
  Returns: Average of the highest price and the lowest price for the specified look-back period.
 tma(src, len)  Triangular Moving Average.
  Parameters:
     src : Series to use ('close' is used if no argument is supplied).
     len : Lookback length to use.
  Returns: TMA smoothing.
 VAMA(src, len)  Volatility Adjusted Moving Average.
  Parameters:
     src : Series to use ('close' is used if no argument is supplied).
     len : Lookback length to use.
  Returns: VAMA smoothing.
 Jurik(src, len)  Jurik Moving Average.
  Parameters:
     src : Series to use ('close' is used if no argument is supplied).
     len : Lookback length to use.
  Returns: JMA smoothing.
 MCG(src, len)  McGinley smoothing.
  Parameters:
     src : Series to use ('close' is used if no argument is supplied).
     len : Lookback length to use.
  Returns: McGinley smoothing.
 zlema(series, length)  Zero Lag Exponential Moving Average.
  Parameters:
     series : Series to use ('close' is used if no argument is supplied).
     length : Lookback length to use.
  Returns: ZLEMA smoothing.
 xema(src, len)  Optimized Exponential Moving Average.
  Parameters:
     src : Series to use ('close' is used if no argument is supplied).
     len : Lookback length to use.
  Returns: XEMA smoothing.
 EhlersSuperSmoother(src, lower)  Ehlers Super Smoother.
  Parameters:
     src : Series to use ('close' is used if no argument is supplied).
     lower : Smoothing value to use.
  Returns: Ehlers Super smoothing.
 EhlersEmaSmoother(sig, smoothK, smoothP)  Ehlers EMA Smoother.
  Parameters:
     sig : Series to use ('close' is used if no argument is supplied).
     smoothK : Lookback length to use.
     smoothP : Smothing value to use.
  Returns: Ehlers EMA smoothing.
 ave_func(in_src, in_len, in_type)  Returns the source after running it through a Moving Average function.
  Parameters:
     in_src : Series to use ('close' is used if no argument is supplied).
     in_len : Lookback period to be used for the Moving Average function. 
     in_type : Type of Moving Average function to use. Must have a string input to select the options from that MUST match the type-casing in the function below.
  Returns: The source as a float after running it through the Moving Average function.
adx: Configurable ADX (library) Library   "adx" 
Calculate ADX (and its constituent parts +DI, -DI, ATR), 
using different moving averages and periods.
 adx(atrMA, diMA, adxMA, atrLen, diLen, adxLen, h, l, c)  
  Parameters:
     atrMA : Moving Average used for calculating the Average True Range. 
Traditionally RMA, but using SMA here and in adxMA gives good results too.
     diMA : Moving Average used for calculating the Directional Index. 
Traditionally, RMA.
     adxMA : Moving Average used for calculating the Average Directional 
Index. Traditionally RMA, but using SMA here and in atrMA gives good results 
too.
     atrLen : Length of the Average True Range.
     diLen : Length of the Directional Index.
     adxLen : Length (smoothing) of the Average Directional Index.
     h : Candle's high.
     l : Candle's low.
     c : Candle's close.
  Returns: 
eHarmonicpatternsExtendedLibrary   "eHarmonicpatternsExtended" 
Library provides an alternative method to scan harmonic patterns. This is helpful in reducing iterations. Republishing as new library instead of existing eHarmonicpatterns because I need that copy for existing scripts.
 scan_xab(bcdRatio, err_min, err_max, patternArray)  Checks if bcd ratio is in range of any harmonic pattern
  Parameters:
     bcdRatio : AB/XA ratio
     err_min : minimum error threshold
     err_max : maximum error threshold
     patternArray : Array containing pattern check flags. Checks are made only if flags are true. Upon check flgs are overwritten.
 scan_abc_axc(abcRatio, axcRatio, err_min, err_max, patternArray)  Checks if abc or axc ratio is in range of any harmonic pattern
  Parameters:
     abcRatio : BC/AB ratio
     axcRatio : XC/AX ratio
     err_min : minimum error threshold
     err_max : maximum error threshold
     patternArray : Array containing pattern check flags. Checks are made only if flags are true. Upon check flgs are overwritten.
 scan_bcd(bcdRatio, err_min, err_max, patternArray)  Checks if bcd ratio is in range of any harmonic pattern
  Parameters:
     bcdRatio : CD/BC ratio
     err_min : minimum error threshold
     err_max : maximum error threshold
     patternArray : Array containing pattern check flags. Checks are made only if flags are true. Upon check flgs are overwritten.
 scan_xad_xcd(xadRatio, xcdRatio, err_min, err_max, patternArray)  Checks if xad or xcd ratio is in range of any harmonic pattern
  Parameters:
     xadRatio : AD/XA ratio
     xcdRatio : CD/XC ratio
     err_min : minimum error threshold
     err_max : maximum error threshold
     patternArray : Array containing pattern check flags. Checks are made only if flags are true. Upon check flgs are overwritten.
 isHarmonicPattern(x, a, b, c, d, flags, errorPercent)  Checks for harmonic patterns
  Parameters:
     x : X coordinate value
     a : A coordinate value
     b : B coordinate value
     c : C coordinate value
     d : D coordinate value
     flags : flags to check patterns. Send empty array to enable all 
     errorPercent : Error threshold
  Returns:   Array of boolean values which says whether valid pattern exist and array of corresponding pattern names
 isHarmonicProjection(x, a, b, c, flags, errorPercent)  Checks for harmonic pattern projection
  Parameters:
     x : X coordinate value
     a : A coordinate value
     b : B coordinate value
     c : C coordinate value
     flags : flags to check patterns. Send empty array to enable all 
     errorPercent : Error threshold
  Returns:   Array of boolean values which says whether valid pattern exist and array of corresponding pattern names.
 get_prz_range(x, a, b, c, patternArray, errorPercent, start_adj, end_adj)  Provides PRZ range based on BCD and XAD ranges
  Parameters:
     x : X coordinate value
     a : A coordinate value
     b : B coordinate value
     c : C coordinate value
     patternArray : Pattern flags for which PRZ range needs to be calculated
     errorPercent : Error threshold
     start_adj : - Adjustments for entry levels
     end_adj : - Adjustments for stop levels
  Returns:   Start and end of consolidated PRZ range
 get_prz_range_xad(x, a, b, c, patternArray, errorPercent, start_adj, end_adj)  Provides PRZ range based on XAD range only
  Parameters:
     x : X coordinate value
     a : A coordinate value
     b : B coordinate value
     c : C coordinate value
     patternArray : Pattern flags for which PRZ range needs to be calculated
     errorPercent : Error threshold
     start_adj : - Adjustments for entry levels
     end_adj : - Adjustments for stop levels
  Returns:   Start and end of consolidated PRZ range
Adaptive_LengthLibrary   "Adaptive_Length" 
This library contains functions to calculate Adaptive dynamic length which can be used in Moving Averages and other indicators.
Two Exponential Moving Averages (EMA) are plotted. Coloring in plot is derived from  Chikou   filter and Dynamic length of MA1 is adapted using Signal output from  Chikou   library.
 dynamic(para, adapt_Pct, minLength, maxLength)  Adaptive dynamic length based on boolean parameter
  Parameters:
     para : Boolean parameter; if true then length would decrease and would increase if its false
     adapt_Pct : Percentage adaption based on parameter
     minLength : Minimum allowable length
     maxLength : Maximum allowable length
  Returns: Adaptive Dynamic Length based on Boolean Parameter
 auto_alpha(src, a)  Adaptive length based on automatic alpha calculations from source input
  Parameters:
     src : Price source for alpha calculations 
     a : Input Alpha value
  Returns: Adaptive Length calculated from input price Source and Alpha
HA_CandlesLibrary   "HA_Candles" 
Heikin Ashi Candles
 HA_Close()  Heikin Ashi Modified Close
  Returns: Heikin Ashi Modified Close
 HA_Open()  Heikin Ashi Modified Open
  Returns: Heikin Ashi Modified Open
 HA_High()  Heikin Ashi Modified High
  Returns: Heikin Ashi Modified High
 HA_Low()  Heikin Ashi Modified Low
  Returns: Heikin Ashi Modified Low
 HA_Delta(Heikin)  Heikin Ashi Delta
  Parameters:
     Heikin : Ashi Close, Heikin Ashi Open
  Returns: Heikin Ashi Delta
RVSILibrary  "RVSI" 
This Library contains functions that calculate all types of " Relative Volume Strength Index (MZ  RVSI ) " depending upon unique volume oscillator. Achieved RVSI value can be used for divergence detection in volume or to adapt dynamic length in Moving Averages or other functions.
 rvsi_tfs(vol_src, vol_Len, rvsiLen, _open, _close)  Relative Volume Strength Index based on TFS Volume Oscillator
  Parameters:
     vol_src : Volume Source
     vol_Len : Volume Legth for TFS Volume Oscillato
     rvsiLen : Period of Relative Volume Strength Index
     _open : Ticker Open Value
     _close : Ticker Close Value
  Returns: Relative Volume Strength Index value based on TFS Volume Oscillator
 rvsi_obv(vol_src, rvsiLen, _close)  Relative Volume Strength Index based on On Balance Volume
  Parameters:
     vol_src : Volume Source to Calculate On Balance Volume
     rvsiLen : Period of Relative Volume Strength Index
     _close : Ticker Close Value
  Returns: Relative Volume Strength Index value based on On Balance Volume
 rvsi_kvo(vol_src, FastX, SlowX, rvsiLen, _close)  Relative Volume Strength Index based on Klinger Volume Oscillator
  Parameters:
     vol_src : Volume Source
     FastX : Volume Fast Length
     SlowX : Volume Slow Length
     rvsiLen : Period of Relative Volume Strength Index
     _close : Ticker Close Value
  Returns: Relative Volume Strength Index value based on Klinger Volume Oscillator
 rvsi_vzo(vol_src, zLen, rvsiLen, _close)  Relative Volume Strength Index based on Volume Zone Oscillator
  Parameters:
     vol_src : Volume Source
     zLen : Volume Legth for Volume Zone Oscillator
     rvsiLen : Period of Relative Volume Strength Index
     _close : Ticker Close Value
  Returns: Relative Volume Strength Index value based on Volume Zone Oscillator
 rvsi_cvo_obv(vol_src, ema1len, ema2len, rvsiLen)  Relative Volume Strength Index based on Cumulative Volume Oscillator with On Balance Volume as Calculations Source
  Parameters:
     vol_src : Volume Source
     ema1len : EMA Fast Length
     ema2len : EMA Slow Length
     rvsiLen : Period of Relative Volume Strength Index
  Returns: Relative Volume Strength Index value based on Cumulative Volume Oscillator with On Balance Volume as Calculations Source
 rvsi_cvo_pvt(vol_src, FastX, SlowX, rvsiLen)  Relative Volume Strength Index based on Cumulative Volume Oscillator with Price Volume Trend as Calculations Source
  Parameters:
     vol_src : Volume Source
     FastX : EMA Fast Length
     SlowX : EMA Slow Length
     rvsiLen : Period of Relative Volume Strength Index
  Returns: Relative Volume Strength Index value based on Cumulative Volume Oscillator with Price Volume Trend as Calculations Source
 rvsi_cvo_cvd(vol_src, FastX, SlowX, rvsiLen, _open, _close, _high, _low)  Relative Volume Strength Index based on Cumulative Volume Oscillator with Cumulative Volume Delta as Calculations Source
  Parameters:
     vol_src : Volume Source
     FastX : EMA Fast Length
     SlowX : EMA Slow Length
     rvsiLen : Period of Relative Volume Strength Index
     _open : Ticker Open Value
     _close : Ticker Close Value
     _high : Ticker High Value
     _low : Ticker Low Value
  Returns: Relative Volume Strength Index value based on Cumulative Volume Oscillator with Cumulative Volume Delta as Calculations Source
JohnEhlersFourierTransformLibrary   "JohnEhlersFourierTransform" 
Fourier Transform for Traders By John Ehlers, slightly modified to allow to inspect other than the 8-50 frequency spectrum.
reference:
www.mesasoftware.com
 high_pass_filter(source)  Detrended version of the data by High Pass Filtering with a 40 Period cutoff
  Parameters:
     source : float, data source.
  Returns: float.
 transformed_dft(source, start_frequency, end_frequency)  DFT by John Elhers.
  Parameters:
     source : float, data source.
     start_frequency : int, lower bound of the frequency window, must be a positive number >= 0, window must be less than or 30.
     end_frequency : int, upper bound of the frequency window, must be a positive number >= 0, window must be less than or 30.
  Returns: tuple with float, float array.
 db_to_rgb(db, transparency)  converts the frequency decibels to rgb.
  Parameters:
     db : float, decibels value.
     transparency : float, transparency value.
  Returns: color.
windowing_taAll Signals Are the Sum of Sines. When looking at real-world signals, you usually view them as a price changing over time. This is referred to as the time domain. Fourier’s theorem states that any waveform in the time domain can be represented by the weighted sum of sines and cosines. For example, take two sine waves, where one is three times as fast as the other–or the frequency is 1/3 the first signal. When you add them, you can see you get a different signal.
Although performing an FFT on a signal can provide great insight, it is important to know the  limitations of the FFT and how to improve the signal clarity using windowing. When you use the FFT to measure the frequency component of a signal, you are basing the analysis on a finite set of data. The actual FFT transform assumes that it is a finite data set, a continuous spectrum that is one period of a periodic signal. For the FFT, both the time domain and the frequency domain are circular topologies, so the two endpoints of the time waveform are interpreted as though they were connected together. When the measured signal is periodic and an integer number of periods fill the acquisition time interval, the FFT turns out fine as it  matches this assumption. However, many times, the measured signal isn’t an integer number of periods. Therefore, the finiteness of the measured signal may result in a truncated waveform with different characteristics from the original continuous-time signal, and the finiteness can introduce sharp transition changes into the measured signal. The sharp transitions are discontinuities.
When the number of periods in the acquisition is not an integer, the endpoints are  discontinuous. These artificial discontinuities show up in the FFT as high-frequency components not present in the original signal. These frequencies can be much higher than the Nyquist frequency and are aliased between 0 and half of your sampling rate. The spectrum you get by using a FFT, therefore, is not the actual spectrum of the original signal, but a smeared  version. It appears as if energy at one frequency leaks into other frequencies. This phenomenon is known as spectral leakage, which causes the fine spectral lines to spread into wider signals.
You can minimize the effects of performing an FFT over a noninteger number of cycles by using  a technique called windowing. Windowing reduces the amplitude of the discontinuities at the  boundaries of each finite sequence acquired by the digitizer. Windowing consists of multiplying  the time record by a finite-length window with an amplitude that varies smoothly and gradually  toward zero at the edges. This makes the endpoints of the waveform meet and, therefore,  results in a continuous waveform without sharp transitions. This technique is also referred to as applying a window.
Here is a windowing_ta library with J.F Ehlers Windowing functions proposed on Sep, 2021.
Library   "windowing_ta" 
 hann()  
 hamm()  
 fir_sma()  
 fir_triangle()  
TAExtLibrary   "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:  
 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:  
 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: 
historicalrangeLibrary   "historicalrange" 
Library provices a method to calculate historical percentile range of series.
 hpercentrank(source)  calculates historical percentrank of the source
  Parameters:
     source : Source for which historical percentrank needs to be calculated. Source should be ranging between 0-100. If using a source which can beyond 0-100, use short term percentrank to baseline them.
  Returns: pArray - percentrank array which contains how many instances of source occurred at different levels.
upperPercentile - percentile based on higher value
lowerPercentile - percentile based on lower value
median - median value of the source
max - max value of the source
 distancefromath(source)  returns stats on historical distance from ath in terms of percentage
  Parameters:
     source : for which stats are calculated
  Returns: percentile and related historical stats regarding distance from ath
 distancefromma(maType, length, source)  returns stats on historical distance from moving average in terms of percentage
  Parameters:
     maType : Moving Average Type : Can be sma, ema, hma, rma, wma, vwma, swma, highlow, linreg, median
     length : Moving Average Length
     source : for which stats are calculated
  Returns: percentile and related historical stats regarding distance from ath
 bpercentb(source, maType, length, multiplier, sticky)  returns percentrank and stats on historical bpercentb levels
  Parameters:
     source : Moving Average Source
     maType : Moving Average Type : Can be sma, ema, hma, rma, wma, vwma, swma, highlow, linreg, median
     length : Moving Average Length
     multiplier : Standard Deviation multiplier
     sticky : - sticky boundaries which will only change when value is outside boundary.
  Returns: percentile and related historical stats regarding Bollinger Percent B
 kpercentk(source, maType, length, multiplier, useTrueRange, sticky)  returns percentrank and stats on historical kpercentk levels
  Parameters:
     source : Moving Average Source
     maType : Moving Average Type : Can be sma, ema, hma, rma, wma, vwma, swma, highlow, linreg, median
     length : Moving Average Length
     multiplier : Standard Deviation multiplier
     useTrueRange : - if set to false, uses high-low.
     sticky : - sticky boundaries which will only change when value is outside boundary.
  Returns: percentile and related historical stats regarding Keltener Percent K
 dpercentd(useAlternateSource, alternateSource, length, sticky)  returns percentrank and stats on historical dpercentd levels
  Parameters:
     useAlternateSource : - Custom source is used only if useAlternateSource is set to true
     alternateSource : - Custom source
     length : - donchian channel length
     sticky : - sticky boundaries which will only change when value is outside boundary.
  Returns: percentile and related historical stats regarding Donchian Percent D
 oscillator(type, length, shortLength, longLength, source, highSource, lowSource, method, highlowLength, sticky)  oscillator - returns Choice of oscillator with custom overbought/oversold range
  Parameters:
     type : - oscillator type. Valid values : cci, cmo, cog, mfi, roc, rsi, stoch, tsi, wpr
     length : - Oscillator length - not used for TSI
     shortLength : - shortLength only used for TSI
     longLength : - longLength only used for TSI
     source : - custom source if required
     highSource : - custom high source for stochastic oscillator
     lowSource : - custom low source for stochastic oscillator
     method : - Valid values for method are : sma, ema, hma, rma, wma, vwma, swma, highlow, linreg, median
     highlowLength : - length on which highlow of the oscillator is calculated
     sticky : - overbought, oversold levels won't change unless crossed
  Returns: percentile and related historical stats regarding oscillator
ZxLibraryLibrary   "ZxLibrary" 
ZxLibrary is an easy with more than 130 Indicators and more than 60 Candlestick Patterns.
dc_taAdaptive technical indicators are importants in a non stationary market, the ability to adapt to a situation can boost the efficiency of your strategy. A lot of methods have been proposed to make technical indicators "smarters", the dominant cycle tuned indicators are one of them which are based on J.F.Ehlers theory. Here is a collections of algorithms to calculate dominant cycles. ENJOY!
Library   "dc_ta" 
 bton()  
 EhlersHoDyDC()  
 EhlersPhAcDC()  
 EhlersDuDiDC()  
 EhlersCycPer()  
 EhlersCycPer2()  
 EhlersBPZC()  
 EhlersAutoPer()  
 EhlersHoDyDCE()  
 EhlersPhAcDCE()  
 EhlersDuDiDCE()  
 EhlersDFTDC()  
 EhlersDFTDC2()  






















