OPEN-SOURCE SCRIPT

Decimal EMA

203
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".

면책사항

해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.