OPEN-SOURCE SCRIPT
Telah dikemas kini

EMA with Adaptive Straight Segments

166
This script transforms a traditional Exponential Moving Average (EMA) into a series of straight-line segments, making trend direction clearer and easier to follow. Instead of plotting every curve of the EMA, it connects key points with angled steps, giving a trend-line style look that removes noise and highlights slope.

What makes this version special is its adaptive segmentation:

Segment length automatically adjusts based on market volatility (ATR%).

In low volatility, segments stretch longer to smooth things out.

In high volatility, segments shorten to stay responsive to price swings.

Features:

Clean, step-style EMA representation.

Adjustable minimum/maximum segment lengths.

Customisable number of historical segments.

Optional display of the original EMA for comparison.

HUD label showing current ATR%, segment length, and segment count.

This tool is especially useful if, like me, you prefer structural analysis over noisy indicators. It keeps your chart tidy while still reflecting the true slope of the EMA. I find 50 and 200 are the most useful.
Nota Keluaran
Added double EMA for crosses
Nota Keluaran
✨ Update: Forward Projection Modes Added (with the Help of Janet my AI)

This update takes the original Adaptive EMA Straight Segments idea and gives you three ways to project into the future:

🔹 Finite Projection – plots a straight forecast line for a chosen number of bars (up to 500).
🔹 Infinite Projection – extends the forecast line infinitely to the right (great for trend continuation).
🔹 Ghost Projection – dotted “ghost” points showing step-by-step EMA projections up to 24 bars ahead, without repainting. Perfect for visualizing short-term continuation.

Other improvements:

Forward extension settings added in indicator inputs.

Toggle which EMA (#1 or #2) to ghost, avoiding Pine’s 64-plot limit.

Clean HUD showing ATR%, segment length, and active projection mode.

This makes the tool flexible for both visual forecasting and backward structural clarity.
Nota Keluaran
Clear example chart

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.