OPEN-SOURCE SCRIPT
已更新

EMA with Adaptive Straight Segments

239
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.
版本注释
Added double EMA for crosses
版本注释
✨ 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.
版本注释
Clear example chart

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。