Merge branch 'dev'

This commit is contained in:
Miha Kralj
2026-03-13 13:47:10 -07:00
404 changed files with 2754 additions and 1763 deletions
+2 -4
View File
@@ -13,9 +13,7 @@
| **PineScript** | [huber.pine](huber.pine) |
- Huber Loss is a hybrid loss function that combines the best properties of Mean Squared Error (MSE) and Mean Absolute Error (MAE).
- Parameterized by `period`, `delta` (default 1.345).
- Output range: $\geq 0$.
- Requires 1 bar of warmup before first valid output (IsHot = true).
- **Similar:** [PseudoHuber](../pseudohuber/PseudoHuber.md), [MAE](../mae/Mae.md) | **Trading note:** Huber loss; robust to outliers — quadratic for small errors, linear for large. Used in ML-based trading models.
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
Huber Loss is a hybrid loss function that combines the best properties of Mean Squared Error (MSE) and Mean Absolute Error (MAE). For small errors, it behaves quadratically like MSE; for large errors, it behaves linearly like MAE.
@@ -188,4 +186,4 @@ huber.Update(110, 100); // Returns ~12.546
* [MAE](../mae/Mae.md) - Mean Absolute Error (linear everywhere)
* [MSE](../mse/Mse.md) - Mean Squared Error (quadratic everywhere)
* [RMSE](../rmse/Rmse.md) - Root Mean Squared Error
* [RMSE](../rmse/Rmse.md) - Root Mean Squared Error
+2 -4
View File
@@ -13,9 +13,7 @@
| **PineScript** | [logcosh.pine](logcosh.pine) |
- Log-Cosh Loss combines the best properties of L1 (absolute) and L2 (squared) error metrics through the logarithm of the hyperbolic cosine function.
- Parameterized by `period`.
- Output range: $\geq 0$.
- Requires 1 bar of warmup before first valid output (IsHot = true).
- **Similar:** [Huber](../huber/Huber.md), [MSE](../mse/Mse.md) | **Trading note:** Log-cosh loss; smooth approximation to MAE. Twice differentiable; preferred for gradient-based optimization.
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
Log-Cosh Loss combines the best properties of L1 (absolute) and L2 (squared) error metrics through the logarithm of the hyperbolic cosine function. It provides smooth gradients everywhere while remaining robust to outliers.
@@ -184,4 +182,4 @@ For large errors, Log-Cosh grows approximately linearly (like L1), avoiding the
* [MAE](../mae/Mae.md) - Mean Absolute Error (pure L1)
* [MSE](../mse/Mse.md) - Mean Squared Error (pure L2)
* [Huber](../huber/Huber.md) - Huber Loss (piecewise L1/L2)
* [PseudoHuber](../pseudohuber/PseudoHuber.md) - Smooth Huber approximation
* [PseudoHuber](../pseudohuber/PseudoHuber.md) - Smooth Huber approximation
+2 -4
View File
@@ -13,9 +13,7 @@
| **PineScript** | [maape.pine](maape.pine) |
- Mean Arctangent Absolute Percentage Error (MAAPE) transforms percentage errors through the arctangent function, naturally bounding the metric betwe...
- Parameterized by `period`.
- Output range: $\geq 0$.
- Requires 1 bar of warmup before first valid output (IsHot = true).
- **Similar:** [MAPE](../mape/Mape.md), [SMAPE](../smape/Smape.md) | **Trading note:** Mean Arctangent Absolute Percentage Error; bounded and symmetric, handles zero values unlike MAPE.
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
Mean Arctangent Absolute Percentage Error (MAAPE) transforms percentage errors through the arctangent function, naturally bounding the metric between 0 and π/2. This eliminates the unbounded nature of MAPE while preserving its scale-independence.
@@ -178,4 +176,4 @@ The arctangent compression means that the difference between 100% and 1000% erro
* [MAPE](../mape/Mape.md) - Mean Absolute Percentage Error (unbounded)
* [SMAPE](../smape/Smape.md) - Symmetric MAPE (different bounding approach)
* [LogCosh](../logcosh/LogCosh.md) - Log-Cosh Loss (similar compression philosophy)
* [LogCosh](../logcosh/LogCosh.md) - Log-Cosh Loss (similar compression philosophy)
+2 -4
View File
@@ -13,9 +13,7 @@
| **PineScript** | [mae.pine](mae.pine) |
- Mean Absolute Error (MAE) measures the average magnitude of errors in a set of predictions, without considering their direction.
- Parameterized by `period`.
- Output range: $\geq 0$.
- Requires 1 bar of warmup before first valid output (IsHot = true).
- **Similar:** [MSE](../mse/Mse.md), [MdAE](../mdae/Mdae.md) | **Trading note:** Mean Absolute Error; simple, interpretable forecast accuracy metric. Same units as input.
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
Mean Absolute Error (MAE) measures the average magnitude of errors in a set of predictions, without considering their direction. It represents the average of the absolute differences between actual and predicted values.
@@ -160,4 +158,4 @@ Batch SIMD: 4x-8x speedup for large windows. ~3-5 cy/bar amortized in vectorized
* [MSE](../mse/Mse.md) - Mean Squared Error
* [RMSE](../rmse/Rmse.md) - Root Mean Squared Error
* [MAPE](../mape/Mape.md) - Mean Absolute Percentage Error
* [MAPE](../mape/Mape.md) - Mean Absolute Percentage Error
+2 -4
View File
@@ -13,9 +13,7 @@
| **PineScript** | [mapd.pine](mapd.pine) |
- Mean Absolute Percentage Deviation (MAPD) measures the average absolute percentage difference between actual and predicted values, using the predic...
- Parameterized by `period`.
- Output range: $\geq 0$.
- Requires 1 bar of warmup before first valid output (IsHot = true).
- **Similar:** [MAPE](../mape/Mape.md), [WMAPE](../wmape/Wmape.md) | **Trading note:** Mean Absolute Percentage Deviation; total absolute error divided by total actual values.
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
Mean Absolute Percentage Deviation (MAPD) measures the average absolute percentage difference between actual and predicted values, using the predicted value as the denominator. This is the key difference from MAPE, which uses the actual value.
@@ -176,4 +174,4 @@ mapd.Update(200, 100); // |200-100|/100 = 100%
* [MAPE](../mape/Mape.md) - Mean Absolute Percentage Error (divides by actual)
* [SMAPE](../smape/Smape.md) - Symmetric Mean Absolute Percentage Error
* [MPE](../mpe/Mpe.md) - Mean Percentage Error (signed)
* [MAE](../mae/Mae.md) - Mean Absolute Error (same units)
* [MAE](../mae/Mae.md) - Mean Absolute Error (same units)
+2 -4
View File
@@ -13,9 +13,7 @@
| **PineScript** | [mape.pine](mape.pine) |
- Mean Absolute Percentage Error (MAPE) measures the average absolute percentage difference between actual and predicted values.
- Parameterized by `period`.
- Output range: $\geq 0$.
- Requires 1 bar of warmup before first valid output (IsHot = true).
- **Similar:** [SMAPE](../smape/Smape.md), [MAAPE](../maape/Maape.md) | **Trading note:** Mean Absolute Percentage Error; scale-independent accuracy. Undefined when actuals are zero.
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
Mean Absolute Percentage Error (MAPE) measures the average absolute percentage difference between actual and predicted values. It expresses accuracy as a percentage, making it scale-independent and easy to interpret.
@@ -192,4 +190,4 @@ Same absolute error (50), but over-prediction shows higher MAPE.
* [MAPD](../mapd/Mapd.md) - Mean Absolute Percentage Deviation (divides by predicted)
* [SMAPE](../smape/Smape.md) - Symmetric Mean Absolute Percentage Error
* [MPE](../mpe/Mpe.md) - Mean Percentage Error (signed)
* [MAE](../mae/Mae.md) - Mean Absolute Error (same units)
* [MAE](../mae/Mae.md) - Mean Absolute Error (same units)
+2 -4
View File
@@ -13,9 +13,7 @@
| **PineScript** | [mase.pine](mase.pine) |
- Mean Absolute Scaled Error (MASE) normalizes forecast errors by the average error of a naive "random walk" forecast (using the previous value as th...
- Parameterized by `period`.
- Output range: $\geq 0$.
- Requires `period + 1` bars of warmup before first valid output (IsHot = true).
- **Similar:** [MAE](../mae/Mae.md), [RAE](../rae/Rae.md) | **Trading note:** Mean Absolute Scaled Error; compares forecast to naïve random-walk baseline. <1 = better than naïve.
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
Mean Absolute Scaled Error (MASE) normalizes forecast errors by the average error of a naive "random walk" forecast (using the previous value as the prediction). This makes MASE scale-independent and interpretable across different time series.
@@ -135,4 +133,4 @@ MASE is particularly valuable when:
* Comparing forecasts across different series
* Evaluating against a natural baseline (naive forecast)
* Working with data that includes zeros
* Needing symmetric treatment of over/under predictions
* Needing symmetric treatment of over/under predictions
+2 -4
View File
@@ -13,9 +13,7 @@
| **PineScript** | [mdae.pine](mdae.pine) |
- Median Absolute Error (MdAE) measures the middle value of all absolute errors.
- Parameterized by `period`.
- Output range: $\geq 0$.
- Requires `period` bars of warmup before first valid output (IsHot = true).
- **Similar:** [MAE](../mae/Mae.md), [MdAPE](../mdape/Mdape.md) | **Trading note:** Median Absolute Error; robust central-tendency error metric, resistant to outliers.
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
Median Absolute Error (MdAE) measures the middle value of all absolute errors. Unlike MAE which averages errors, MdAE finds the median, providing exceptional robustness against outliers and extreme values.
@@ -167,4 +165,4 @@ Batch SIMD: 4x-8x speedup for large windows. ~3-5 cy/bar amortized in vectorized
* [MAE](../mae/Mae.md) - Mean Absolute Error (uses mean)
* [MdAPE](../mdape/Mdape.md) - Median Absolute Percentage Error
* [Huber](../huber/Huber.md) - Huber Loss (robust but differentiable)
* [Huber](../huber/Huber.md) - Huber Loss (robust but differentiable)
+2 -4
View File
@@ -13,9 +13,7 @@
| **PineScript** | [mdape.pine](mdape.pine) |
- Median Absolute Percentage Error (MdAPE) combines the scale-independence of percentage errors with the robustness of median statistics.
- Parameterized by `period`.
- Output range: $\geq 0$.
- Requires `period` bars of warmup before first valid output (IsHot = true).
- **Similar:** [MAPE](../mape/Mape.md), [MdAE](../mdae/Mdae.md) | **Trading note:** Median Absolute Percentage Error; robust version of MAPE for skewed error distributions.
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
Median Absolute Percentage Error (MdAPE) combines the scale-independence of percentage errors with the robustness of median statistics. It provides a measure of typical relative prediction accuracy that remains stable even when some predictions are dramatically wrong.
@@ -164,4 +162,4 @@ Batch SIMD: 4x-8x speedup for large windows. ~3-5 cy/bar amortized in vectorized
* [MAPE](../mape/Mape.md) - Mean Absolute Percentage Error (uses mean)
* [MdAE](../mdae/Mdae.md) - Median Absolute Error (non-percentage)
* [SMAPE](../smape/Smape.md) - Symmetric MAPE (different normalization)
* [SMAPE](../smape/Smape.md) - Symmetric MAPE (different normalization)
+2 -4
View File
@@ -13,9 +13,7 @@
| **PineScript** | [me.pine](me.pine) |
- Mean Error (ME), also known as Mean Bias Error, measures the average error between actual and predicted values while preserving the sign.
- Parameterized by `period`.
- Output range: $\geq 0$.
- Requires 1 bar of warmup before first valid output (IsHot = true).
- **Similar:** [MAE](../mae/Mae.md), [MPE](../mpe/Mpe.md) | **Trading note:** Mean Error (bias); positive = systematic overprediction, negative = underprediction.
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
Mean Error (ME), also known as Mean Bias Error, measures the average error between actual and predicted values while preserving the sign. Unlike MAE, ME reveals systematic bias in predictions: whether a model consistently over-predicts or under-predicts.
@@ -179,4 +177,4 @@ Always use ME alongside MAE or MSE to get a complete picture.
* [MAE](../mae/Mae.md) - Mean Absolute Error (magnitude only)
* [MSE](../mse/Mse.md) - Mean Squared Error
* [MPE](../mpe/Mpe.md) - Mean Percentage Error (relative bias)
* [MPE](../mpe/Mpe.md) - Mean Percentage Error (relative bias)
+2 -4
View File
@@ -13,9 +13,7 @@
| **PineScript** | [mpe.pine](mpe.pine) |
- Mean Percentage Error measures the average percentage difference between actual and predicted values while preserving the sign.
- Parameterized by `period`.
- Output range: $\geq 0$.
- Requires 1 bar of warmup before first valid output (IsHot = true).
- **Similar:** [ME](../me/Me.md), [MAPE](../mape/Mape.md) | **Trading note:** Mean Percentage Error; reveals directional bias as percentage. Positive/negative cancellation is a feature.
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
Mean Percentage Error measures the average percentage difference between actual and predicted values while preserving the sign. Unlike MAPE, which takes absolute values, MPE reveals systematic bias in predictions—whether a model consistently over-predicts or under-predicts.
@@ -176,4 +174,4 @@ Unlike MAPE (bounded at 0% to ∞), MPE can range from -∞ to +100%:
* [MAPE](../mape/Mape.md) - Unsigned percentage error for magnitude
* [ME](../me/Me.md) - Signed absolute error for absolute bias
* [MAE](../mae/Mae.md) - Unsigned absolute error for magnitude
* [MAE](../mae/Mae.md) - Unsigned absolute error for magnitude
+2 -4
View File
@@ -13,9 +13,7 @@
| **PineScript** | [mrae.pine](mrae.pine) |
- Mean Relative Absolute Error (MRAE) measures the average magnitude of errors relative to the actual values.
- Parameterized by `period`.
- Output range: $\geq 0$.
- Requires 1 bar of warmup before first valid output (IsHot = true).
- **Similar:** [RAE](../rae/Rae.md), [MASE](../mase/Mase.md) | **Trading note:** Mean Relative Absolute Error; ratio of errors to benchmark errors. Scale-free comparison metric.
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
Mean Relative Absolute Error (MRAE) measures the average magnitude of errors relative to the actual values. This normalization makes the metric scale-independent and easier to interpret across different datasets.
@@ -161,4 +159,4 @@ Batch SIMD: 4x-8x speedup for large windows. ~3-5 cy/bar amortized in vectorized
* [MAE](../mae/Mae.md) - Mean Absolute Error (non-relative)
* [MAPE](../mape/Mape.md) - Mean Absolute Percentage Error
* [SMAPE](../smape/Smape.md) - Symmetric Mean Absolute Percentage Error
* [SMAPE](../smape/Smape.md) - Symmetric Mean Absolute Percentage Error
+2 -4
View File
@@ -13,9 +13,7 @@
| **PineScript** | [mse.pine](mse.pine) |
- Mean Squared Error (MSE) measures the average of the squares of the errors between actual and predicted values.
- Parameterized by `period`.
- Output range: $\geq 0$.
- Requires 1 bar of warmup before first valid output (IsHot = true).
- **Similar:** [RMSE](../rmse/Rmse.md), [MAE](../mae/Mae.md) | **Trading note:** Mean Squared Error; penalizes large errors quadratically. Standard loss function in regression.
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
Mean Squared Error (MSE) measures the average of the squares of the errors between actual and predicted values. By squaring errors, MSE penalizes large deviations more heavily than small ones.
@@ -147,4 +145,4 @@ RMSE has the advantage of being in the same units as the original data.
* [MAE](../mae/Mae.md) - Mean Absolute Error (robust to outliers)
* [RMSE](../rmse/Rmse.md) - Root Mean Squared Error (same units as data)
* [Huber](../huber/Huber.md) - Combines MSE and MAE benefits
* [Huber](../huber/Huber.md) - Combines MSE and MAE benefits
+2 -4
View File
@@ -13,9 +13,7 @@
| **PineScript** | [msle.pine](msle.pine) |
- Mean Squared Logarithmic Error transforms both actual and predicted values through logarithms before computing squared error.
- Parameterized by `period`.
- Output range: $\geq 0$.
- Requires 1 bar of warmup before first valid output (IsHot = true).
- **Similar:** [RMSLE](../rmsle/Rmsle.md), [MSE](../mse/Mse.md) | **Trading note:** Mean Squared Log Error; penalizes under-prediction more than over-prediction. Good for growth rates.
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
Mean Squared Logarithmic Error transforms both actual and predicted values through logarithms before computing squared error. This compression makes MSLE robust to outliers and particularly suited for data with exponential growth patterns or wide dynamic ranges.
@@ -205,4 +203,4 @@ Near zero, small absolute differences create large MSLE:
* [RMSLE](../rmsle/Rmsle.md) - Root of MSLE for interpretable units
* [MSE](../mse/Mse.md) - Linear-scale squared error
* [MAPE](../mape/Mape.md) - Percentage-based comparison
* [MAPE](../mape/Mape.md) - Percentage-based comparison
+2 -4
View File
@@ -13,9 +13,7 @@
| **PineScript** | [pseudohuber.pine](pseudohuber.pine) |
- Pseudo-Huber Loss (also called Charbonnier Loss) is a smooth approximation to the Huber loss function.
- Parameterized by `period`, `delta` (default 1.0).
- Output range: $\geq 0$.
- Requires `period` bars of warmup before first valid output (IsHot = true).
- **Similar:** [Huber](../huber/Huber.md), [LogCosh](../logcosh/LogCosh.md) | **Trading note:** Smooth approximation to Huber loss; continuously differentiable with tunable delta parameter.
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
Pseudo-Huber Loss (also called Charbonnier Loss) is a smooth approximation to the Huber loss function. Unlike Huber which has a piecewise definition with a kink at δ, Pseudo-Huber is continuously differentiable everywhere, making it ideal for gradient-based optimization.
@@ -191,4 +189,4 @@ Pseudo-Huber produces slightly smaller values but follows the same qualitative b
* [Huber](../huber/Huber.md) - Huber Loss (piecewise, with kink)
* [LogCosh](../logcosh/LogCosh.md) - Log-Cosh Loss (different smooth approximation)
* [MAE](../mae/Mae.md) - Mean Absolute Error (pure L1)
* [MSE](../mse/Mse.md) - Mean Squared Error (pure L2)
* [MSE](../mse/Mse.md) - Mean Squared Error (pure L2)
+2 -4
View File
@@ -13,9 +13,7 @@
| **PineScript** | [quantileloss.pine](quantileloss.pine) |
- Quantile Loss (also called Pinball Loss) measures prediction accuracy with asymmetric penalties for over-prediction versus under-prediction.
- Parameterized by `period`, `quantile` (default 0.5).
- Output range: $\geq 0$.
- Requires 1 bar of warmup before first valid output (IsHot = true).
- **Similar:** [MAE](../mae/Mae.md), [Huber](../huber/Huber.md) | **Trading note:** Asymmetric loss for quantile regression; set tau to penalize over/under-prediction differently.
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
Quantile Loss (also called Pinball Loss) measures prediction accuracy with asymmetric penalties for over-prediction versus under-prediction. It's essential for probabilistic forecasting where different quantiles of the distribution matter.
@@ -178,4 +176,4 @@ With τ=0.9, under-predictions are penalized 9x more than over-predictions.
* [MAE](../mae/Mae.md) - Mean Absolute Error (equivalent to τ=0.5 × 2)
* [Huber](../huber/Huber.md) - Huber Loss (robust symmetric)
* [MAPE](../mape/Mape.md) - Mean Absolute Percentage Error
* [MAPE](../mape/Mape.md) - Mean Absolute Percentage Error
+2 -4
View File
@@ -13,9 +13,7 @@
| **PineScript** | [rae.pine](rae.pine) |
- Relative Absolute Error (RAE) measures the total absolute error of predictions relative to the total absolute error of a simple baseline predictor ...
- Parameterized by `period`.
- Output range: $\geq 0$.
- Requires `period` bars of warmup before first valid output (IsHot = true).
- **Similar:** [MASE](../mase/Mase.md), [MRAE](../mrae/Mrae.md) | **Trading note:** Relative Absolute Error; total absolute error relative to naïve model. <1 = outperforms naïve.
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
Relative Absolute Error (RAE) measures the total absolute error of predictions relative to the total absolute error of a simple baseline predictor that always predicts the mean of actual values. This provides a normalized performance metric.
@@ -136,4 +134,4 @@ RAE is preferable when:
* You want robustness to outliers (absolute vs squared errors)
* You need a ratio interpretation (< 1 is good, > 1 is bad)
* The mean predictor is a relevant baseline for your domain
* The mean predictor is a relevant baseline for your domain
+2 -4
View File
@@ -13,9 +13,7 @@
| **PineScript** | [rmse.pine](rmse.pine) |
- Root Mean Squared Error (RMSE) is the square root of MSE, providing an error metric in the same units as the original data while retaining sensitiv...
- Parameterized by `period`.
- Output range: $\geq 0$.
- Requires 1 bar of warmup before first valid output (IsHot = true).
- **Similar:** [MSE](../mse/Mse.md), [MAE](../mae/Mae.md) | **Trading note:** Root Mean Squared Error; same units as input, emphasizes large deviations. Most common accuracy metric.
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
Root Mean Squared Error (RMSE) is the square root of MSE, providing an error metric in the same units as the original data while retaining sensitivity to large errors.
@@ -76,4 +74,4 @@ Batch SIMD: 4x-8x speedup for large windows. ~3-5 cy/bar amortized in vectorized
## Related Indicators
* [MSE](../mse/Mse.md) - Mean Squared Error
* [MAE](../mae/Mae.md) - Mean Absolute Error
* [MAE](../mae/Mae.md) - Mean Absolute Error
+2 -4
View File
@@ -13,9 +13,7 @@
| **PineScript** | [rmsle.pine](rmsle.pine) |
- Root Mean Squared Logarithmic Error is the square root of MSLE, providing an error metric in log-scale units.
- Parameterized by `period`.
- Output range: $\geq 0$.
- Requires `period` bars of warmup before first valid output (IsHot = true).
- **Similar:** [MSLE](../msle/Msle.md), [RMSE](../rmse/Rmse.md) | **Trading note:** Root Mean Squared Log Error; measures relative error magnitude. Useful for price ratios.
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
Root Mean Squared Logarithmic Error is the square root of MSLE, providing an error metric in log-scale units. This makes RMSLE more interpretable than MSLE while retaining all its benefits for data spanning multiple orders of magnitude.
@@ -225,4 +223,4 @@ Small absolute values near zero can produce large RMSLE:
* [MSLE](../msle/Msle.md) - Squared version without root
* [RMSE](../rmse/Rmse.md) - Linear-scale root mean squared error
* [MAPE](../mape/Mape.md) - Percentage error without log transform
* [MAPE](../mape/Mape.md) - Percentage error without log transform
+2 -4
View File
@@ -13,9 +13,7 @@
| **PineScript** | [rse.pine](rse.pine) |
- Relative Squared Error (RSE) measures the total squared error of predictions relative to the total squared error of a simple baseline predictor tha...
- Parameterized by `period`.
- Output range: $\geq 0$.
- Requires `period` bars of warmup before first valid output (IsHot = true).
- **Similar:** [RMSE](../rmse/Rmse.md), [Rsquared](../rsquared/Rsquared.md) | **Trading note:** Relative Squared Error; normalized by variance of actuals. >1 = worse than mean prediction.
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
Relative Squared Error (RSE) measures the total squared error of predictions relative to the total squared error of a simple baseline predictor that always predicts the mean. RSE is directly related to the coefficient of determination (R²).
@@ -140,4 +138,4 @@ Rse.Batch(actualSpan, predictedSpan, outputSpan, 14);
| **Outlier sensitivity** | High | Low |
| **Related to** | R² | — |
| **Baseline** | Mean predictor | Mean predictor |
| **Interpretation** | 1 - R² | Better/worse than mean |
| **Interpretation** | 1 - R² | Better/worse than mean |
+2 -4
View File
@@ -13,9 +13,7 @@
| **PineScript** | [rsquared.pine](rsquared.pine) |
- The Coefficient of Determination (R²) measures the proportion of variance in the actual values that is predictable from the predicted values.
- Parameterized by `period`.
- Output range: $(-\infty, 1]$.
- Requires `period` bars of warmup before first valid output (IsHot = true).
- **Similar:** [RSE](../rse/Rse.md), [Correlation](../../statistics/correlation/Correlation.md) | **Trading note:** R-squared (coefficient of determination); 1.0 = perfect fit, 0 = no better than mean.
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
The Coefficient of Determination (R²) measures the proportion of variance in the actual values that is predictable from the predicted values. R² ranges from negative infinity to 1, where 1 indicates perfect predictions.
@@ -149,4 +147,4 @@ Rsquared.Batch(actualSpan, predictedSpan, outputSpan, 14);
* **Use R²** when you want an intuitive measure of model quality (0-1 scale for good models)
* **Use RSE** when you want to compare error magnitudes directly
* **Use both** to get complementary perspectives on model performance
* **Use both** to get complementary perspectives on model performance
+2 -4
View File
@@ -13,9 +13,7 @@
| **PineScript** | [smape.pine](smape.pine) |
- Symmetric Mean Absolute Percentage Error addresses a fundamental asymmetry in MAPE: the fact that over-predictions and under-predictions of the sam...
- Parameterized by `period`.
- Output range: $\geq 0$.
- Requires `period` bars of warmup before first valid output (IsHot = true).
- **Similar:** [MAPE](../mape/Mape.md), [MAAPE](../maape/Maape.md) | **Trading note:** Symmetric MAPE; bounded 0200%, handles zeros better than MAPE. Common in forecasting competitions.
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
Symmetric Mean Absolute Percentage Error addresses a fundamental asymmetry in MAPE: the fact that over-predictions and under-predictions of the same magnitude receive different penalties. SMAPE uses the average of actual and predicted values in the denominator, creating a metric that treats both directions equally.
@@ -182,4 +180,4 @@ This scales to 0-100% but is mathematically equivalent to the 0-200% version. Qu
* [MAPE](../mape/Mape.md) - Asymmetric percentage error
* [MPE](../mpe/Mpe.md) - Signed percentage error for bias
* [MAE](../mae/Mae.md) - Absolute error without scaling
* [MAE](../mae/Mae.md) - Absolute error without scaling
+2 -4
View File
@@ -13,9 +13,7 @@
| **PineScript** | [theilu.pine](theilu.pine) |
- Theil's U Statistic measures forecast accuracy relative to a naive no-change forecast.
- Parameterized by `period`.
- Output range: $\geq 0$.
- Requires `period` bars of warmup before first valid output (IsHot = true).
- **Similar:** [MASE](../mase/Mase.md), [Rsquared](../rsquared/Rsquared.md) | **Trading note:** Theil's U statistic; <1 = forecast beats naïve, >1 = worse than naïve random walk.
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
Theil's U Statistic measures forecast accuracy relative to a naive no-change forecast. A value below 1 indicates the model outperforms simply predicting that tomorrow equals today; above 1 means you'd be better off not forecasting at all.
@@ -171,4 +169,4 @@ Batch MSE accumulation vectorizable; final ratio is scalar. ~8 cy/bar for square
* [RMSE](../rmse/Rmse.md) - Root Mean Squared Error (absolute, not relative)
* [MASE](../mase/Mase.md) - Mean Absolute Scaled Error (similar concept)
* [R-Squared](../rsquared/RSquared.md) - Coefficient of Determination
* [R-Squared](../rsquared/RSquared.md) - Coefficient of Determination
+2 -4
View File
@@ -13,9 +13,7 @@
| **PineScript** | [tukeybiweight.pine](tukeybiweight.pine) |
- Tukey's Biweight (also called Bisquare) is a redescending M-estimator that completely ignores errors beyond a threshold.
- Parameterized by `period`, `c` (default defaultc).
- Output range: $\geq 0$.
- Requires `period` bars of warmup before first valid output (IsHot = true).
- **Similar:** [Huber](../huber/Huber.md), [PseudoHuber](../pseudohuber/PseudoHuber.md) | **Trading note:** Tukey's biweight loss; completely rejects extreme outliers beyond tuning constant c.
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
Tukey's Biweight (also called Bisquare) is a redescending M-estimator that completely ignores errors beyond a threshold. Unlike Huber loss which still penalizes large errors linearly, Tukey's biweight treats extreme outliers as if they don't exist.
@@ -182,4 +180,4 @@ Tukey's biweight is the only loss function that completely stops penalizing erro
* [Huber](../huber/Huber.md) - Huber Loss (linear, not redescending)
* [MdAE](../mdae/Mdae.md) - Median Absolute Error (robust via median)
* [LogCosh](../logcosh/LogCosh.md) - Log-Cosh Loss (smooth L1/L2 hybrid)
* [LogCosh](../logcosh/LogCosh.md) - Log-Cosh Loss (smooth L1/L2 hybrid)
+2 -4
View File
@@ -13,9 +13,7 @@
| **PineScript** | [wmape.pine](wmape.pine) |
- Weighted Mean Absolute Percentage Error (WMAPE) adjusts MAPE by weighting each error by the magnitude of the actual value.
- Parameterized by `period`.
- Output range: $\geq 0$.
- Requires `period` bars of warmup before first valid output (IsHot = true).
- **Similar:** [MAPE](../mape/Mape.md), [MAPD](../mapd/Mapd.md) | **Trading note:** Weighted MAPE; weights errors by actual values. More stable than MAPE for intermittent demand.
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
Weighted Mean Absolute Percentage Error (WMAPE) adjusts MAPE by weighting each error by the magnitude of the actual value. This produces a single, interpretable percentage that represents overall accuracy weighted by importance.
@@ -174,4 +172,4 @@ WMAPE gives less weight to the small-volume item with high percentage error.
* [MAPE](../mape/Mape.md) - Mean Absolute Percentage Error (unweighted)
* [MAE](../mae/Mae.md) - Mean Absolute Error (non-percentage)
* [SMAPE](../smape/Smape.md) - Symmetric MAPE
* [SMAPE](../smape/Smape.md) - Symmetric MAPE
+2 -4
View File
@@ -13,9 +13,7 @@
| **PineScript** | [wrmse.pine](wrmse.pine) |
- WRMSE extends the classic RMSE by incorporating weights for each observation, enabling analysts to emphasize critical data points such as recent ob...
- Parameterized by `period`.
- Output range: $\geq 0$.
- Requires `period` bars of warmup before first valid output (IsHot = true).
- **Similar:** [RMSE](../rmse/Rmse.md), [WMAPE](../wmape/Wmape.md) | **Trading note:** Weighted RMSE; emphasizes accuracy at specific points. Useful for time-decay weighting.
- Validated against TA-Lib, Skender, and Tulip reference implementations where available.
WRMSE extends the classic RMSE by incorporating weights for each observation, enabling analysts to emphasize critical data points such as recent observations, high-volume periods, or specific market regimes. When all weights are equal, WRMSE reduces exactly to RMSE, making it a strict generalization. This implementation uses dual RingBuffers for O(1) streaming updates with periodic resync to manage floating-point drift.
@@ -185,4 +183,4 @@ WRMSE is validated by:
- Aitken, A.C. (1936). "On Least Squares and Linear Combinations of Observations." *Proceedings of the Royal Society of Edinburgh*.
- Gauss, C.F. (1809). *Theoria Motus Corporum Coelestium*. (Foundation of least squares theory)
- Greene, W.H. (2012). *Econometric Analysis*. 7th ed. Chapter 9: Generalized Least Squares.
- Greene, W.H. (2012). *Econometric Analysis*. 7th ed. Chapter 9: Generalized Least Squares.