PINE LIBRARY

aprox

Updated
Library "aprox"
It's a library of the aproximations of a price or Series float it uses Fourier transform and
Euler's Theoreum for Homogenus White noice operations. Calling functions without source value it automatically take close as the default source value.

Copy this indicator to see how each approximations interact between each other.
https://www.tradingview.com/x/PWkSg4Qo/






DFT3(xval, _dir)
  Parameters:
    xval (float)
    _dir (int)



DFT2(xval, _dir)
  Parameters:
    xval (float)
    _dir (int)


FFT(xval)
  FFT: Fast Fourier Transform
  Parameters:
    xval (float)
  Returns: Aproxiated source value



DTF32(xval)
  DTF32: Combined Discrete Fourier Transforms
  Parameters:
    xval (float)
  Returns: Aproxiated source value



whitenoise(indic_, _devided, minEmaLength, maxEmaLength, src)
  whitenoise: Ehler's Universal Oscillator with White Noise, without extra aproximated src
  Parameters:
    indic_ (float)
    _devided (int)
    minEmaLength (int)
    maxEmaLength (int)
    src (float)
  Returns: Smoothed indicator value



whitenoise(indic_, dft1, _devided, minEmaLength, maxEmaLength, src)
  whitenoise: Ehler's Universal Oscillator with White Noise and DFT1
  Parameters:
    indic_ (float)
    dft1 (float)
    _devided (int)
    minEmaLength (int)
    maxEmaLength (int)
    src (float)
  Returns: Smoothed indicator value



smooth(dft1, indic__, _devided, minEmaLength, maxEmaLength, src)
  smooth: Smoothing source value with help of indicator series and aproximated source value
  Parameters:
    dft1 (float)
    indic__ (float)
    _devided (int)
    minEmaLength (int)
    maxEmaLength (int)
    src (float)
  Returns: Smoothed source series



smooth(indic__, _devided, minEmaLength, maxEmaLength, src)
  smooth: Smoothing source value with help of indicator series
  Parameters:
    indic__ (float)
    _devided (int)
    minEmaLength (int)
    maxEmaLength (int)
    src (float)
  Returns: Smoothed source series



vzo_ema(src, len)
  vzo_ema: Volume Zone Oscillator with EMA smoothing
  Parameters:
    src (float)
    len (simple int)
  Returns: VZO value

vzo_sma(src, len)
  vzo_sma: Volume Zone Oscillator with SMA smoothing
  Parameters:
    src (float)
    len (int)
  Returns: VZO value

vzo_wma(src, len)
  vzo_wma: Volume Zone Oscillator with WMA smoothing
  Parameters:
    src (float)
    len (int)
  Returns: VZO value

alma2(series, windowsize, offset, sigma)
  alma2: Arnaud Legoux Moving Average 2 accepts sigma as series float
  Parameters:
    series (float)
    windowsize (int)
    offset (float)
    sigma (float)
  Returns: ALMA value

Wavelet(src, len, offset, sigma)
  Wavelet: Wavelet Transform
  Parameters:
    src (float)
    len (int)
    offset (simple float)
    sigma (simple float)
  Returns: Wavelet-transformed series



Wavelet_std(src, len, offset, mag)
  Wavelet_std: Wavelet Transform with Standard Deviation
  Parameters:
    src (float)
    len (int)
    offset (float)
    mag (int)
  Returns: Wavelet-transformed series

Release Notes
v2

Added:
DFT32(xval)
  DFT32 Combined Discrete Fourier Transforms of DFT3 and DTF2 it aproximates last point by first
aproximating last 3 ponts and than using last 2 points of the previus.
  Parameters:
    xval (float): Array of input values
  Returns: Aproxiated source value

Updated:
DFT3(xval, _dir)
  DFT3 Discrete Fourier Transform with last 3 points
  Parameters:
    xval (float)
    _dir (int): Direction parameter
  Returns: Aproxiated source value

DFT2(xval, _dir)
  DFT2 Discrete Fourier Transform with last 2 points
  Parameters:
    xval (float)
    _dir (int): Direction parameter
  Returns: Aproxiated source value

FFT(xval)
  FFT Fast Fourier Transform once. It aproximates usig last 3 points.
  Parameters:
    xval (float): Array of input values
  Returns: Aproxiated source value

whitenoise(indic_, dft1, _devided, minEmaLength, maxEmaLength, src)
  whitenoise Ehler's Universal Oscillator with White Noise and DFT1.
It uses src and sproxiated src (dft1) to clearly define white noice.
It uses dinamic EMA to aproximate indicator and thus reducing noise.
  Parameters:
    indic_ (float): Input series for the indicator values to be smoothed
    dft1 (float): Aproximated src value for white noice calculation
    _devided (int): Divisor for oscillator calculations
    minEmaLength (int): Minimum EMA length
    maxEmaLength (int): Maximum EMA length
    src (float): Source series
  Returns: Smoothed indicator value

smooth(indic__, _devided, minEmaLength, maxEmaLength, src)
  smooth Smoothing source value with help of indicator series
It uses dinamic EMA to aproximate src and thus reducing noise.
  Parameters:
    indic__ (float): Optional input for indicator to help smooth dft1 (default is FFT)
    _devided (int): Divisor for smoothing calculations
    minEmaLength (int): Minimum EMA length
    maxEmaLength (int): Maximum EMA length
    src (float): Source series
  Returns: Smoothed src series

vzo_ema(src, len)
  vzo_ema Volume Zone Oscillator with EMA smoothing
  Parameters:
    src (float): Source series
    len (simple int): Length parameter for EMA
  Returns: VZO value

vzo_sma(src, len)
  vzo_sma Volume Zone Oscillator with SMA smoothing
  Parameters:
    src (float): Source series
    len (int): Length parameter for SMA
  Returns: VZO value

vzo_wma(src, len)
  vzo_wma Volume Zone Oscillator with WMA smoothing
  Parameters:
    src (float): Source series
    len (int): Length parameter for WMA
  Returns: VZO value

alma2(series, windowsize, offset, sigma)
  alma2 Arnaud Legoux Moving Average 2 accepts sigma as series float
  Parameters:
    series (float): Input series
    windowsize (int): Size of the moving average window
    offset (float): Offset parameter
    sigma (float): Sigma parameter
  Returns: ALMA value

Wavelet(src, len, offset, sigma)
  Wavelet Wavelet Transform
  Parameters:
    src (float): Source series
    len (int): Length parameter for ALMA
    offset (simple float)
    sigma (simple float)
  Returns: Wavelet-transformed series

Wavelet_std(src, len, offset, mag)
  Wavelet_std Wavelet Transform with Standard Deviation
  Parameters:
    src (float): Source series
    len (int): Length parameter for ALMA
    offset (float): Offset parameter for ALMA
    mag (int): Magnitude parameter for standard deviation
  Returns: Wavelet-transformed series

Removed:
DTF32(xval)
  DTF32: Combined Discrete Fourier Transforms
Release Notes
v3

Added:
DTF32(xval)
  DFT32: Combined Discrete Fourier Transforms of DFT3 and DTF2 it aproximates last point by first
aproximating last 3 ponts and than using last 2 points of the previus.
  Parameters:
    xval (float): Array of input values
  Returns: Aproxiated source value

Updated:
DFT3(xval, _dir)
  DFT3: Discrete Fourier Transform with last 3 points
  Parameters:
    xval (float)
    _dir (int): Direction parameter
  Returns: Aproxiated source value

DFT2(xval, _dir)
  DFT2: Discrete Fourier Transform with last 2 points
  Parameters:
    xval (float)
    _dir (int): Direction parameter
  Returns: Aproxiated source value

FFT(xval)
  FFT: Fast Fourier Transform once. It aproximates usig last 3 points.
  Parameters:
    xval (float): Array of input values
  Returns: Aproxiated source value

DFT32(xval)
  DFT32: Combined Discrete Fourier Transforms of DFT3 and DTF2 it aproximates last point by first
aproximating last 3 ponts and than using last 2 points of the previus.
  Parameters:
    xval (float): Array of input values
  Returns: Aproxiated source value

whitenoise(indic_, dft1, _devided, minEmaLength, maxEmaLength, src)
  whitenoise: Ehler's Universal Oscillator with White Noise and DFT1.
It uses src and sproxiated src (dft1) to clearly define white noice.
It uses dinamic EMA to aproximate indicator and thus reducing noise.
  Parameters:
    indic_ (float): Input series for the indicator values to be smoothed
    dft1 (float): Aproximated src value for white noice calculation
    _devided (int): Divisor for oscillator calculations
    minEmaLength (int): Minimum EMA length
    maxEmaLength (int): Maximum EMA length
    src (float): Source series
  Returns: Smoothed indicator value

smooth(indic__, _devided, minEmaLength, maxEmaLength, src)
  smooth: Smoothing source value with help of indicator series
It uses dinamic EMA to aproximate src and thus reducing noise.
  Parameters:
    indic__ (float): Optional input for indicator to help smooth dft1 (default is FFT)
    _devided (int): Divisor for smoothing calculations
    minEmaLength (int): Minimum EMA length
    maxEmaLength (int): Maximum EMA length
    src (float): Source series
  Returns: Smoothed src series

vzo_ema(src, len)
  vzo_ema: Volume Zone Oscillator with EMA smoothing
  Parameters:
    src (float): Source series
    len (simple int): Length parameter for EMA
  Returns: VZO value

vzo_wma(src, len)
  vzo_wma: Volume Zone Oscillator with WMA smoothing
  Parameters:
    src (float): Source series
    len (int): Length parameter for WMA
  Returns: VZO value

alma2(series, windowsize, offset, sigma)
  alma2: Arnaud Legoux Moving Average 2 accepts sigma as series float
  Parameters:
    series (float): Input series
    windowsize (int): Size of the moving average window
    offset (float): Offset parameter
    sigma (float): Sigma parameter
  Returns: ALMA value

Wavelet(src, len, offset, sigma)
  Wavelet Wavelet Transform: aproxiates srt using Discrete wavelet transform.
  Parameters:
    src (float): Source series
    len (int): Length parameter for ALMA
    offset (simple float)
    sigma (simple float)
  Returns: Wavelet-transformed series

Wavelet_std(src, len, offset, mag)
  Wavelet_std: aproxiates srt using Discrete wavelet transform with standard deviation as a magnitude.
  Parameters:
    src (float): Source series
    len (int): Length parameter for ALMA
    offset (float): Offset parameter for ALMA
    mag (int): Magnitude parameter for standard deviation
  Returns: Wavelet-transformed series
Market GeometryMATH

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 a publication is governed by House rules.

Disclaimer