OPEN-SOURCE SCRIPT

Updated

Heyo guys, here I made a comparison between my favorised smoothing algorithms.

I chose the R-Squared value as rating factor to accomplish the comparison.

The indicator is non-repainting.

In technical analysis, traders often use moving averages to smooth out the noise in price data and identify trends. While moving averages are a useful tool, they can also obscure important information about the underlying relationship between the price and the smoothed price.

One way to evaluate this relationship is by calculating the R-squared value, which represents the proportion of the variance in the price that can be explained by the smoothed price in a linear regression model.

This PineScript code implements a smoothing R-squared comparison indicator.

It provides a comparison of different smoothing techniques such as Kalman filter, T3, JMA, EMA, SMA, Super Smoother and some special combinations of them.

The Kalman filter is a mathematical algorithm that uses a series of measurements observed over time, containing statistical noise and other inaccuracies, and produces estimates of unknown variables that tend to be more accurate than those based on a single measurement.

The input parameters for the Kalman filter include the process noise covariance and the measurement noise covariance, which help to adjust the sensitivity of the filter to changes in the input data.

The T3 smoothing technique is a popular method used in technical analysis to remove noise from a signal.

The input parameters for the T3 smoothing method include the length of the window used for smoothing, the type of smoothing used (Normal or New), and the smoothing factor used to adjust the sensitivity to changes in the input data.

The JMA smoothing technique is another popular method used in technical analysis to remove noise from a signal.

The input parameters for the JMA smoothing method include the length of the window used for smoothing, the phase used to shift the input data before applying the smoothing algorithm, and the power used to adjust the sensitivity of the JMA to changes in the input data.

The EMA and SMA techniques are also popular methods used in technical analysis to remove noise from a signal.

The input parameters for the EMA and SMA techniques include the length of the window used for smoothing.

The indicator displays a comparison of the R-squared values for each smoothing technique, which provides an indication of how well the technique is fitting the data.

Higher R-squared values indicate a better fit. By adjusting the input parameters for each smoothing technique, the user can compare the effectiveness of different techniques in removing noise from the input data.

You can use it to find the best fitting smoothing method for the timeframe you usually use.

Just apply it on your preferred timeframe and look for the highlighted table cell.

It seems like the T3 works best on timeframes under 4H.

There's where I am active, so I will use this one more in the future.

---

Credits to:

▪loxx – T3

▪balipour – Super Smoother

▪ChatGPT – Wrote 80 % of this article and helped with the research

Release Notes

Made it non-repaintingIn true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.