djmad

Mad_MATH

djmad Mis à jour   
Library "MAD_MATH"
This is a mathematical library where I store useful kernels, filters and selectors for the different types of computations.

This library also contains opensource code from other scripters.
Future extensions are very likely, there are some functions I would like to add, but I have to wait for approvals so i can include them.


Ehlers_EMA(_src, _length)
  Calculates the Ehlers Exponential Moving Average (Ehlers_EMA)
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The length for the Ehlers EMA
  Returns: The Ehlers EMA value

Ehlers_Gaussian(_src, _length)
  Calculates the Ehlers Gaussian Filter
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The length for the Ehlers Gaussian Filter
  Returns: The Ehlers Gaussian Filter value

Ehlers_supersmoother(_src, _length)
  Calculates the Ehlers Supersmoother
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The length for the Ehlers Supersmoother
  Returns: The Ehlers Supersmoother value

Ehlers_SMA_fast(_src, _length)
  Calculates the Ehlers Simple Moving Average (SMA) Fast
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The length for the Ehlers SMA Fast
  Returns: The Ehlers SMA Fast value

Ehlers_EMA_fast(_src, _length)
  Calculates the Ehlers Exponential Moving Average (EMA) Fast
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The length for the Ehlers EMA Fast
  Returns: The Ehlers EMA Fast value

Ehlers_RSI_fast(_src, _length)
  Calculates the Ehlers Relative Strength Index (RSI) Fast
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The length for the Ehlers RSI Fast
  Returns: The Ehlers RSI Fast value

Ehlers_Band_Pass_Filter(_src, _length)
  Calculates the Ehlers BandPass Filter
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The length for the Ehlers BandPass Filter
  Returns: The Ehlers BandPass Filter value

Ehlers_Butterworth(_src, _length)
  Calculates the Ehlers Butterworth Filter
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The length for the Ehlers Butterworth Filter
  Returns: The Ehlers Butterworth Filter value

Ehlers_Two_Pole_Gaussian_Filter(_src, _length)
  Calculates the Ehlers Two-Pole Gaussian Filter
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The length for the Ehlers Two-Pole Gaussian Filter
  Returns: The Ehlers Two-Pole Gaussian Filter value

Ehlers_Two_Pole_Butterworth_Filter(_src, _length)
  Calculates the Ehlers Two-Pole Butterworth Filter
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The length for the Ehlers Two-Pole Butterworth Filter
  Returns: The Ehlers Two-Pole Butterworth Filter value

Ehlers_Band_Stop_Filter(_src, _length)
  Calculates the Ehlers Band Stop Filter
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The length for the Ehlers Band Stop Filter
  Returns: The Ehlers Band Stop Filter value

Ehlers_Smoother(_src)
  Calculates the Ehlers Smoother
  Parameters:
    _src (float): The source series for calculation
  Returns: The Ehlers Smoother value

Ehlers_High_Pass_Filter(_src, _length)
  Calculates the Ehlers High Pass Filter
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The length for the Ehlers High Pass Filter
  Returns: The Ehlers High Pass Filter value

Ehlers_2_Pole_High_Pass_Filter(_src, _length)
  Calculates the Ehlers Two-Pole High Pass Filter
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The length for the Ehlers Two-Pole High Pass Filter
  Returns: The Ehlers Two-Pole High Pass Filter value

pr(_src, _length)
  pr Calculates the percentage rank (PR) of a value within a range.
  Parameters:
    _src (float): The source value for which the percentage rank is calculated. It represents the value to be ranked within the range.
    _length (simple int): The _length of the range over which the percentage rank is calculated. It determines the number of bars considered for the calculation.
  Returns: The percentage rank (PR) of the source value within the range, adjusted by adding 50 to the result.

smma(_src, _length)
  Calculates the SMMA (Smoothed Moving Average)
  Parameters:
    _src (float): The source series for calculation
    _length (simple int)
  Returns: The SMMA value

hullma(_src, _length)
  Calculates the Hull Moving Average (HullMA)
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The _length of the HullMA
  Returns: The HullMA value

tma(_src, _length)
  Calculates the Triple Moving Average (TMA)
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The _length of the TMA
  Returns: The TMA value

dema(_src, _length)
  Calculates the Double Exponential Moving Average (DEMA)
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The _length of the DEMA
  Returns: The DEMA value

tema(_src, _length)
  Calculates the Triple Exponential Moving Average (TEMA)
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The _length of the TEMA
  Returns: The TEMA value

w2ma(_src, _length)
  Calculates the Normalized Double Moving Average (N2MA)
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The _length of the N2MA
  Returns: The N2MA value

wma(_src, _length)
  Calculates the Normalized Moving Average (NMA)
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The _length of the NMA
  Returns: The NMA value

nma(_open, _close, _length)
  Calculates the Normalized Moving Average (NMA)
  Parameters:
    _open (float): The open price series
    _close (float): The close price series
    _length (simple int): The _length for finding the highest and lowest values
  Returns: The NMA value

lma(_src, _length)
  Parameters:
    _src (float)
    _length (simple int)

zero_lag(_src, _length, gamma1, zl)
  Calculates the Zero Lag Moving Average (ZeroLag)
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The length for the moving average
    gamma1 (simple int): The coefficient for calculating 'd'
    zl (simple bool): Boolean flag for applying Zero Lag
  Returns: An array containing the ZeroLag Moving Average and a boolean flag indicating if it's flat
copyright HPotter, thanks for that great function

chebyshevI(src, len, ripple)
  Calculates the Chebyshev Type I Filter
  Parameters:
    src (float): The source series for calculation
    len (int): The length of the filter
    ripple (float): The ripple factor for the filter
  Returns: The output of the Chebyshev Type I Filter
math from Pafnuti Lwowitsch Tschebyschow (1821–1894)
Thanks peacefulLizard50262 for the find and translation

chebyshevII(src, len, ripple)
  Calculates the Chebyshev Type II Filter
  Parameters:
    src (float): The source series for calculation
    len (int): The length of the filter
    ripple (float): The ripple factor for the filter
  Returns: The output of the Chebyshev Type II Filter
math from Pafnuti Lwowitsch Tschebyschow (1821–1894)
Thanks peacefulLizard50262 for the find

wavetrend(_src, _n1, _n2)
  Calculates the WaveTrend indicator
  Parameters:
    _src (float): The source series for calculation
    _n1 (simple int): The period for the first EMA calculation
    _n2 (simple int): The period for the second EMA calculation
  Returns: The WaveTrend value

f_getma(_type, _src, _length, ripple)
  Calculates various types of moving averages
  Parameters:
    _type (simple string): The type of indicator to calculate
    _src (float): The source series for calculation
    _length (simple int): The length for the moving average or indicator
    ripple (simple float)
  Returns: The calculated moving average or indicator value

f_getfilter(_type, _src, _length)
  Calculates various types of filters
  Parameters:
    _type (simple string): The type of indicator to calculate
    _src (float): The source series for calculation
    _length (simple int): The length for the moving average or indicator
  Returns: The filtered value

f_getoszillator(_type, _src, _length)
  Calculates various types of Deviations and other indicators
  Parameters:
    _type (simple string): The type of indicator to calculate
    _src (float): The source series for calculation
    _length (simple int): The length for the moving average or indicator
  Returns: The calculated moving average or indicator value
Notes de version:
v2
Changed the Strings for calling the Switches to Clearnames

Added:
Ehlers_Supersmoother(_src, _length)
  Calculates the Ehlers Supersmoother
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The length for the Ehlers Supersmoother
  Returns: The Ehlers Supersmoother value

ChebyshevI(src, len, ripple)
  Calculates the Chebyshev Type I Filter
  Parameters:
    src (float): The source series for calculation
    len (int): The length of the filter
    ripple (float): The ripple factor for the filter
  Returns: The output of the Chebyshev Type I Filter
math from Pafnuti Lwowitsch Tschebyschow (1821–1894)
Thanks peacefulLizard50262 for the find and translation

ChebyshevII(src, len, ripple)
  Calculates the Chebyshev Type II Filter
  Parameters:
    src (float): The source series for calculation
    len (int): The length of the filter
    ripple (float): The ripple factor for the filter
  Returns: The output of the Chebyshev Type II Filter
math from Pafnuti Lwowitsch Tschebyschow (1821–1894)
Thanks peacefulLizard50262 for the find

Removed:
Ehlers_supersmoother(_src, _length)
  Calculates the Ehlers Supersmoother

zero_lag(_src, _length, gamma1, zl)
  Calculates the Zero Lag Moving Average (ZeroLag)
  removed because of wrong information

chebyshevI(src, len, ripple)
  Calculates the Chebyshev Type I Filter

chebyshevII(src, len, ripple)
  Calculates the Chebyshev Type II Filter
Notes de version:
Added alexgrovers ARMA A2RMA
Cleanup
Default Values


v3

Added:
Ehlers_Two_Pole_High_Pass_Filter(_src, _length)
  Calculates the Ehlers Two-Pole High Pass Filter
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The length for the Ehlers Two-Pole High Pass Filter
  Returns: The Ehlers Two-Pole High Pass Filter value

PR(_src, _length)
  PR Calculates the percentage rank (PR) of a value within a range.
  Parameters:
    _src (float): The source value for which the percentage rank is calculated. It rePResents the value to be ranked within the range.
    _length (simple int): The _length of the range over which the percentage rank is calculated. It determines the number of bars considered for the calculation.
  Returns: The percentage rank (PR) of the source value within the range, adjusted by adding 50 to the result.

SMMA(_src, _length)
  Calculates the SMMA (Smoothed Moving Average)
  Parameters:
    _src (float): The source series for calculation
    _length (simple int)
  Returns: The SMMA value

HULLMA(_src, _length)
  Calculates the Hull Moving Average (HULLMA)
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The _length of the HULLMA
  Returns: The HULLMA value

TMA(_src, _length)
  Calculates the Triple Moving Average (TMA)
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The _length of the TMA
  Returns: The TMA value

DEMA(_src, _length)
  Calculates the Double Exponential Moving Average (DEMA)
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The _length of the DEMA
  Returns: The DEMA value

TEMA(_src, _length)
  Calculates the Triple Exponential Moving Average (TEMA)
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The _length of the TEMA
  Returns: The TEMA value

W2MA(_src, _length)
  Calculates the Normalized Double Moving Average (N2MA)
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The _length of the N2MA
  Returns: The N2MA value

A2RMA(_src, _length, _gamma)
  Parameters:
    _src (float): Source float input used for the calculation
    _length (simple int): Integer value rePResenting the length of the period
    _gamma (simple float): Integer value rePResenting a factor for the calculation
  Returns: the value of the adaptive moving average

ARMA(_src, _length, _gamma, _zerolag)
  Calculates the Autonomous Recursive Moving Average (ARMA)
  Parameters:
    _src (float): The source series for calculation
    _length (simple int): The length for the ARMA
    _gamma (simple float): The parameter for ARMA calculation
    _zerolag (simple bool): Boolean flag indicating whether to use zero lag
  Returns: An array containing the ARMA value and a flag indicating flatness

f_getall(_type, _src, _length, _gamma, _ripple, _zerolag)
  Calculates various types of Deviations and other indicators
  Parameters:
    _type (simple string): The type of indicator to calculate
    _src (float): The source series for calculation
    _length (simple int): The length for the moving average or indicator
    _gamma (simple float)
    _ripple (simple float)
    _zerolag (simple bool)
  Returns: The calculated moving average or indicator value

Updated:
nma(_open, _close, _length)
  Calculates the Normalized Moving Average (NMA)
  Parameters:
    _open (float): The open PRice series
    _close (float): The close PRice series
    _length (simple int): The _length for finding the highest and lowest values
  Returns: The NMA value

ChebyshevI(_src, _length, _ripple)
  Calculates the Chebyshev Type I Filter
  Parameters:
    _src (float)
    _length (int)
    _ripple (float)
  Returns: The output of the Chebyshev Type I Filter
math from Pafnuti Lwowitsch Tschebyschow (1821–1894)
Thanks peacefulLizard50262 for the find and translation

ChebyshevII(_src, _length, _ripple)
  Calculates the Chebyshev Type II Filter
  Parameters:
    _src (float)
    _length (int)
    _ripple (float)
  Returns: The output of the Chebyshev Type II Filter
math from Pafnuti Lwowitsch Tschebyschow (1821–1894)
Thanks peacefulLizard50262 for the find

f_getma(_type, _src, _length, _gamma, _ripple, _zerolag)
  Calculates various types of moving averages
  Parameters:
    _type (simple string): The type of indicator to calculate
    _src (float): The source series for calculation
    _length (simple int): The length for the moving average or indicator
    _gamma (simple float)
    _ripple (simple float)
    _zerolag (simple bool)
  Returns: The calculated moving average or indicator value

Removed:
Ehlers_2_Pole_High_Pass_Filter(_src, _length)
  Calculates the Ehlers Two-Pole High Pass Filter

pr(_src, _length)
  pr Calculates the percentage rank (PR) of a value within a range.

smma(_src, _length)
  Calculates the SMMA (Smoothed Moving Average)

hullma(_src, _length)
  Calculates the Hull Moving Average (HullMA)

tma(_src, _length)
  Calculates the Triple Moving Average (TMA)

dema(_src, _length)
  Calculates the Double Exponential Moving Average (DEMA)

tema(_src, _length)
  Calculates the Triple Exponential Moving Average (TEMA)

w2ma(_src, _length)
  Calculates the Normalized Double Moving Average (N2MA)

f_getfilter(_type, _src, _length)
  Calculates various types of filters

Trader & coder. TA & NFTs.
bitblockwizard.com more at bitblockart.com
Bibliothèque Pine

Dans le véritable esprit de TradingView, l'auteur a publié ce code Pine en tant que bibliothèque open-source afin que d'autres programmeurs Pine de notre communauté puissent le réutiliser. Bravo à l'auteur ! Vous pouvez utiliser cette bibliothèque à titre privé ou dans d'autres publications open-source, mais la réutilisation de ce code dans une publication est régie par notre Règlement.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.

Vous voulez utiliser cette bibliothèque?

Copiez le texte dans le presse-papiers et collez-le dans votre script.