OPEN-SOURCE SCRIPT
Decimal EMA

Imagine you want a moving average line, but you want its "length" or "period" to be super precise, like 2.7 days instead of just 2 days or 3 days.
This script lets you do that. Here's the simple idea:
You Pick a Decimal Number: In the settings, you can type in a period with a decimal, say, 2.7.
The Script Does a Smart Blend:
It first calculates two regular EMAs: one for the whole number below your choice (EMA for 2 days) and one for the whole number above (EMA for 3 days).
Then, it cleverly mixes these two EMA lines. Since 2.7 is closer to 3 than to 2, it takes more from the "3-day EMA" and a bit less from the "2-day EMA." (Specifically, it takes 70% from the 3-day EMA and 30% from the 2-day EMA).
You Get a Decimal EMA Line: The result is a new EMA line that acts as if its period was exactly 2.7. This line is drawn on your chart.
Why do this?
It allows for very fine-tuned adjustments to how responsive your moving average is, giving a smoother change if you're testing slightly different period lengths.
In Short:
This script calculates an EMA for a period like "2.7" by intelligently blending the results of an EMA for "2" and an EMA for "3".
This script lets you do that. Here's the simple idea:
You Pick a Decimal Number: In the settings, you can type in a period with a decimal, say, 2.7.
The Script Does a Smart Blend:
It first calculates two regular EMAs: one for the whole number below your choice (EMA for 2 days) and one for the whole number above (EMA for 3 days).
Then, it cleverly mixes these two EMA lines. Since 2.7 is closer to 3 than to 2, it takes more from the "3-day EMA" and a bit less from the "2-day EMA." (Specifically, it takes 70% from the 3-day EMA and 30% from the 2-day EMA).
You Get a Decimal EMA Line: The result is a new EMA line that acts as if its period was exactly 2.7. This line is drawn on your chart.
Why do this?
It allows for very fine-tuned adjustments to how responsive your moving average is, giving a smoother change if you're testing slightly different period lengths.
In Short:
This script calculates an EMA for a period like "2.7" by intelligently blending the results of an EMA for "2" and an EMA for "3".
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.