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. קרא עוד בתנאים וההגבלות.