GoemonYae

Kernels

GoemonYae Zaktualizowano   
©2024, GoemonYae; copied from @jdehorty's "KernelFunctions" on 2024-03-09 to ensure future dependency compatibility. Will also add more functions to this script.


Library "KernelFunctions"
This library provides non-repainting kernel functions for Nadaraya-Watson estimator implementations. This allows for easy substition/comparison of different kernel functions for one another in indicators. Furthermore, kernels can easily be combined with other kernels to create newer, more customized kernels.

rationalQuadratic(_src, _lookback, _relativeWeight, startAtBar)
  Rational Quadratic Kernel - An infinite sum of Gaussian Kernels of different length scales.
  Parameters:
    _src (float): <float series> The source series.
    _lookback (simple int): <simple int> The number of bars used for the estimation. This is a sliding value that represents the most recent historical bars.
    _relativeWeight (simple float): <simple float> Relative weighting of time frames. Smaller values resut in a more stretched out curve and larger values will result in a more wiggly curve. As this value approaches zero, the longer time frames will exert more influence on the estimation. As this value approaches infinity, the behavior of the Rational Quadratic Kernel will become identical to the Gaussian kernel.
    startAtBar (simple int)
  Returns: yhat <float series> The estimated values according to the Rational Quadratic Kernel.

gaussian(_src, _lookback, startAtBar)
  Gaussian Kernel - A weighted average of the source series. The weights are determined by the Radial Basis Function (RBF).
  Parameters:
    _src (float): <float series> The source series.
    _lookback (simple int): <simple int> The number of bars used for the estimation. This is a sliding value that represents the most recent historical bars.
    startAtBar (simple int)
  Returns: yhat <float series> The estimated values according to the Gaussian Kernel.

periodic(_src, _lookback, _period, startAtBar)
  Periodic Kernel - The periodic kernel (derived by David Mackay) allows one to model functions which repeat themselves exactly.
  Parameters:
    _src (float): <float series> The source series.
    _lookback (simple int): <simple int> The number of bars used for the estimation. This is a sliding value that represents the most recent historical bars.
    _period (simple int): <simple int> The distance between repititions of the function.
    startAtBar (simple int)
  Returns: yhat <float series> The estimated values according to the Periodic Kernel.

locallyPeriodic(_src, _lookback, _period, startAtBar)
  Locally Periodic Kernel - The locally periodic kernel is a periodic function that slowly varies with time. It is the product of the Periodic Kernel and the Gaussian Kernel.
  Parameters:
    _src (float): <float series> The source series.
    _lookback (simple int): <simple int> The number of bars used for the estimation. This is a sliding value that represents the most recent historical bars.
    _period (simple int): <simple int> The distance between repititions of the function.
    startAtBar (simple int)
  Returns: yhat <float series> The estimated values according to the Locally Periodic Kernel.
Informacje o Wersji:
v2

Added:
exponential(_src, _lookback, startAtBar)
  Exponential Kernel - A weighted average of the source series with exponential decay.
  Parameters:
    _src (float): The source series.
    _lookback (simple int): The number of bars used for the estimation. This is a sliding value that represents the most recent historical bars.
    startAtBar (simple int)
  Returns: yhat The estimated values according to the Exponential Kernel.

linear(_src, _lookback, _startAtBar)
  Linear Weighting Kernel - Applies a linearly decreasing weight to past values.
  Parameters:
    _src (float): The source series.
    _lookback (simple int): The number of bars used for the estimation.
    _startAtBar (simple int): Starting bar index for the calculation to mitigate volatility.
  Returns: yhat The weighted average of the past values with linearly decreasing weights.

sigmoid(_src, _lookback, _alpha, _c, startAtBar)
  Sigmoid Kernel - Models non-linear phenomena with an S-shaped curve, similar to neural network activation functions.
  Parameters:
    _src (float): The source series.
    _lookback (simple int): The number of bars used for the estimation. This is a sliding value that represents the most recent historical bars.
    _alpha (simple float): The slope parameter of the sigmoid function, controlling the steepness of the curve.
    _c (simple float): The intercept parameter of the sigmoid function, adjusting the midpoint of the S-shaped curve relative to the lookback window.
    startAtBar (simple int)
  Returns: yhat The estimated values according to the Sigmoid Kernel.

🌸 ----- GoemonYae Trading System (GYTS) ----- 🌸
💬 Discord Server: discord.gg/ssSn4aAXdn
👔 personal LinkedIn: www.linkedin.com/in/arthur-nazarian
Biblioteka Pine

Działając zgodnie z prawdziwym duchem TradingView, autor opublikował ten kod Pine jako bibliotekę o otwartym kodzie źródłowym, aby inni programiści Pine z naszej społeczności mogli go ponownie wykorzystać. Brawa dla niego! Możesz korzystać z tej biblioteki prywatnie lub w innych publikacjach typu open source, ale ponowne wykorzystanie tego kodu w publikacji podlega Regulaminowi.

Wyłączenie odpowiedzialności

Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.

Chcesz skorzystać z tej biblioteki?

Skopiuj poniższy wiersz i wklej go w swoim skrypcie.