OPEN-SOURCE SCRIPT
Telah dikemas kini Chebyshev-Gauss Moving Average

This indicator applies the principles of Chebyshev-Gauss Quadrature to create a novel type of moving average. Inspired by reading https://rohangautam.github.io/blog/chebyshev_gauss/
What is Chebyshev-Gauss Quadrature?
It's a numerical method to approximate the integral of a function f(x) that is weighted byPine Script® over the interval [-1, 1]. The approximation is a simple sum: Pine Script® where xᵢ are special points called Chebyshev nodes.
How is this applied to a Moving Average?
A moving average can be seen as the "mean value" of the price over a lookback window. The mean value of a function with the Chebyshev weight is calculated as:
Pine Script®
The math simplifies beautifully, resulting in the mean being the simple arithmetic average of the function evaluated at the Chebyshev nodes:
Pine Script®
What's unique about this MA?
The Chebyshev nodes xᵢ are not evenly spaced. They are clustered towards the ends of the interval [-1, 1]. We map this interval to our lookback period. This means the moving average samples prices more intensely from the beginning and the end of the lookback window, and less intensely from the middle. This gives it a unique character, responding quickly to recent changes while also having a long "memory" of the start of the trend.
What is Chebyshev-Gauss Quadrature?
It's a numerical method to approximate the integral of a function f(x) that is weighted by
1/sqrt(1-x^2)
∫ f(x)/sqrt(1-x^2) dx ≈ (π/n) * Σ f(xᵢ)
How is this applied to a Moving Average?
A moving average can be seen as the "mean value" of the price over a lookback window. The mean value of a function with the Chebyshev weight is calculated as:
Mean = [∫ f(x)*w(x) dx] / [∫ w(x) dx]
The math simplifies beautifully, resulting in the mean being the simple arithmetic average of the function evaluated at the Chebyshev nodes:
Mean = (1/n) * Σ f(xᵢ)
What's unique about this MA?
The Chebyshev nodes xᵢ are not evenly spaced. They are clustered towards the ends of the interval [-1, 1]. We map this interval to our lookback period. This means the moving average samples prices more intensely from the beginning and the end of the lookback window, and less intensely from the middle. This gives it a unique character, responding quickly to recent changes while also having a long "memory" of the start of the trend.
Nota Keluaran
Updated to use library Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.