PINE LIBRARY
已更新 MathTransform

Library "MathTransform"
Auxiliary functions for transforming data using mathematical and statistical methods
scaler_zscore(x, lookback_window)
Calculates Z-Score normalization of a series.
Parameters:
x (float): : floating point series to normalize
lookback_window (int): : lookback period for calculating mean and standard deviation
Returns: Z-Score normalized series
scaler_min_max(x, lookback_window, min_val, max_val, empiric_min, empiric_max, empiric_mid)
Performs Min-Max scaling of a series within a given window, user-defined bounds, and optional midpoint
Parameters:
x (float): : floating point series to transform
lookback_window (int): : int : optional lookback window size to consider for scaling.
min_val (float): : float : minimum value of the scaled range. Default is 0.0.
max_val (float): : float : maximum value of the scaled range. Default is 1.0.
empiric_min (float): : float : user-defined minimum value of the input data. This means that the output could exceed the `min_val` bound if there is data in `x` lesser than `empiric_min`. If na, it's calculated from `x` and `lookback_window`.
empiric_max (float): : float : user-defined maximum value of the input data. This means that the output could exceed the `max_val` bound if there is data in `x` greater than `empiric_max`. If na, it's calculated from `x` and `lookback_window`.
empiric_mid (float): : float : user-defined midpoint value of the input data. If na, it's calculated from `empiric_min` and `empiric_max`.
Returns: rescaled series
log(x, base)
Applies logarithmic transformation to a value, base can be user-defined.
Parameters:
x (float): : floating point value to transform
base (float): : logarithmic base, must be greater than 0
Returns: logarithm of the value to the given base, if x <= 0, returns logarithm of 1 to the given base
exp(x, base)
Applies exponential transformation to a value, base can be user-defined.
Parameters:
x (float): : floating point value to transform
base (float): : base of the exponentiation, must be greater than 0
Returns: the result of raising the base to the power of the value
power(x, exponent)
Applies power transformation to a value, exponent can be user-defined.
Parameters:
x (float): : floating point value to transform
exponent (float): : exponent for the transformation
Returns: the value raised to the given exponent, preserving the sign of the original value
tanh(x, scale)
The hyperbolic tangent is the ratio of the hyperbolic sine and hyperbolic cosine. It limits an output to a range of −1 to 1.
Parameters:
x (float): : floating point series
scale (float)
sigmoid(x, scale, offset)
Applies the sigmoid function to a series.
Parameters:
x (float): : floating point series to transform
scale (float): : scaling factor for the sigmoid function
offset (float): : offset for the sigmoid function
Returns: transformed series using the sigmoid function
sigmoid_double(x, scale, offset)
Applies a double sigmoid function to a series, handling positive and negative values differently.
Parameters:
x (float): : floating point series to transform
scale (float): : scaling factor for the sigmoid function
offset (float): : offset for the sigmoid function
Returns: transformed series using the double sigmoid function
logistic_decay(a, b, c, t)
Calculates logistic decay based on given parameters.
Parameters:
a (float): : parameter affecting the steepness of the curve
b (float): : parameter affecting the direction of the decay
c (float): : the upper bound of the function's output
t (float): : time variable
Returns: value of the logistic decay function at time t
Auxiliary functions for transforming data using mathematical and statistical methods
scaler_zscore(x, lookback_window)
Calculates Z-Score normalization of a series.
Parameters:
x (float): : floating point series to normalize
lookback_window (int): : lookback period for calculating mean and standard deviation
Returns: Z-Score normalized series
scaler_min_max(x, lookback_window, min_val, max_val, empiric_min, empiric_max, empiric_mid)
Performs Min-Max scaling of a series within a given window, user-defined bounds, and optional midpoint
Parameters:
x (float): : floating point series to transform
lookback_window (int): : int : optional lookback window size to consider for scaling.
min_val (float): : float : minimum value of the scaled range. Default is 0.0.
max_val (float): : float : maximum value of the scaled range. Default is 1.0.
empiric_min (float): : float : user-defined minimum value of the input data. This means that the output could exceed the `min_val` bound if there is data in `x` lesser than `empiric_min`. If na, it's calculated from `x` and `lookback_window`.
empiric_max (float): : float : user-defined maximum value of the input data. This means that the output could exceed the `max_val` bound if there is data in `x` greater than `empiric_max`. If na, it's calculated from `x` and `lookback_window`.
empiric_mid (float): : float : user-defined midpoint value of the input data. If na, it's calculated from `empiric_min` and `empiric_max`.
Returns: rescaled series
log(x, base)
Applies logarithmic transformation to a value, base can be user-defined.
Parameters:
x (float): : floating point value to transform
base (float): : logarithmic base, must be greater than 0
Returns: logarithm of the value to the given base, if x <= 0, returns logarithm of 1 to the given base
exp(x, base)
Applies exponential transformation to a value, base can be user-defined.
Parameters:
x (float): : floating point value to transform
base (float): : base of the exponentiation, must be greater than 0
Returns: the result of raising the base to the power of the value
power(x, exponent)
Applies power transformation to a value, exponent can be user-defined.
Parameters:
x (float): : floating point value to transform
exponent (float): : exponent for the transformation
Returns: the value raised to the given exponent, preserving the sign of the original value
tanh(x, scale)
The hyperbolic tangent is the ratio of the hyperbolic sine and hyperbolic cosine. It limits an output to a range of −1 to 1.
Parameters:
x (float): : floating point series
scale (float)
sigmoid(x, scale, offset)
Applies the sigmoid function to a series.
Parameters:
x (float): : floating point series to transform
scale (float): : scaling factor for the sigmoid function
offset (float): : offset for the sigmoid function
Returns: transformed series using the sigmoid function
sigmoid_double(x, scale, offset)
Applies a double sigmoid function to a series, handling positive and negative values differently.
Parameters:
x (float): : floating point series to transform
scale (float): : scaling factor for the sigmoid function
offset (float): : offset for the sigmoid function
Returns: transformed series using the double sigmoid function
logistic_decay(a, b, c, t)
Calculates logistic decay based on given parameters.
Parameters:
a (float): : parameter affecting the steepness of the curve
b (float): : parameter affecting the direction of the decay
c (float): : the upper bound of the function's output
t (float): : time variable
Returns: value of the logistic decay function at time t
版本注释
v2Added:
scaler_robust(x, lookback_window)
Performs robust scaling of a series within a given window
sinh(x, scale)
The hyperbolic sine (sinh) is defined as the half-difference of the exponential function of its argument.
cosh(x, scale)
The hyperbolic cosine (cosh) is defined as the half-sum of the exponential function of its argument.
Updated:
tanh(x, scale)
The Inversie Fisher Transform, or hyperbolic tangent (tanh), is the ratio of the hyperbolic sine and hyperbolic cosine.
版本注释
v3Updated:
- most docstrings for better readability
Added:
- `root_mean_square()` transformation
- `box_cox()` transformation - EXPERIMENTAL
版本注释
Added:- Logarithmic Interpolation Scaler
- Root Mean Square (RMS)
- Mean Squared Error (MSE)
- Root Mean Squared Error (RMSE)
- Mean Absolute Error (MAE)
- Root Mean Squared Logarithmic Error (RMSLE)
- Huber Loss
- Quantile Loss (Pinball Loss)
版本注释
This is a major update bringing new features, performance boosts, and a full migration to Pine Script v6.- The library is now fully compatible with the latest Pine Script version.
- New Utility Functions: A powerful new suite of functions has been added for data manipulation and filtering:
clamp, lerp, smooth_step, remap, snr_db, and deadband. - All error metrics and the RMS function now include an enabled parameter. This allows you to disable heavy calculations conditionally, significantly improving script performance.
- Includes an improved EMA initialisation for greater accuracy and adds useful mathematical constants like PI, E, and PHI.
Pine脚本库
本着真正的TradingView精神,作者将此Pine代码发布为开源库,以便我们社区的其他Pine程序员可以重复使用它。向作者致敬!您可以私密或在其他开源出版物中使用此库,但在出版物中重复使用此代码受网站规则约束。
🌸 ---- GoemonYae Trading System (GYTS) ---- 🌸
🌐 Website: goemonyae.com
📖 Documentation: goemonyae.com/docs
💬 Discord server (including YaeBot): discord.gg/ef6Tu4kha3
👔 personal LinkedIn: linkedin.com/in/arthur-nazarian
🌐 Website: goemonyae.com
📖 Documentation: goemonyae.com/docs
💬 Discord server (including YaeBot): discord.gg/ef6Tu4kha3
👔 personal LinkedIn: linkedin.com/in/arthur-nazarian
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
Pine脚本库
本着真正的TradingView精神,作者将此Pine代码发布为开源库,以便我们社区的其他Pine程序员可以重复使用它。向作者致敬!您可以私密或在其他开源出版物中使用此库,但在出版物中重复使用此代码受网站规则约束。
🌸 ---- GoemonYae Trading System (GYTS) ---- 🌸
🌐 Website: goemonyae.com
📖 Documentation: goemonyae.com/docs
💬 Discord server (including YaeBot): discord.gg/ef6Tu4kha3
👔 personal LinkedIn: linkedin.com/in/arthur-nazarian
🌐 Website: goemonyae.com
📖 Documentation: goemonyae.com/docs
💬 Discord server (including YaeBot): discord.gg/ef6Tu4kha3
👔 personal LinkedIn: linkedin.com/in/arthur-nazarian
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。