OPEN-SOURCE SCRIPT
ที่อัปเดต: SMA Projection

What it does
Draws a linear projection of a Simple Moving Average (SMA) 20 bars into the future using the SMA’s recent slope. Optionally shows a tiny momentum flag (just a number) positioned 0.75× ATR below the SMA on the last bar. No future data is read; everything updates on the current bar only.
How it works
SMA: Standard SMA on your chosen source and length.
Projection (fixed 20 bars): Uses a linear extrapolation from the last SMA value with slope
slope = (ma - ma[slopeLen]) / slopeLen
Momentum magnitude (optional): A signed number where >0 = up-slope, <0 = down-slope, ~0 = flat. Units are selectable: price/bar, %/bar, or ATR/bar (default). The flag is rendered small and colored teal (pos) / red (neg) / gray (flat).
Key features
Fixed 20-bar projection (no input—keeps it simple and comparable).
Tiny numeric momentum flag (off by default) placed well below the line (0.75× ATR).
Unit choices for momentum: price/bar, %/bar, ATR/bar.
Deadband option to zero-out tiny slopes.
Non-repainting projection: drawn only on the last bar; updates each candle.
Inputs (summary)
SMA length and Source
Slope lookback (for magnitude)
Show momentum flag (default: Off)
Magnitude units: price/bar, %/bar, ATR/bar (default)
Deadband and Decimals for display control
Tips
For smoother projections, increase slope lookback; for responsiveness, decrease it.
Use ATR/bar or %/bar if you want momentum values that are more comparable across symbols and timeframes.
The projection is indicative, not predictive—combine with structure, volume, and risk management.
Notes & limits
The “future” line is just a linear extrapolation from recent behavior; regime shifts will break linearity.
The momentum flag text is intentionally minimal to avoid chart clutter.
Works on any timeframe; the projection distance is always 20 bars on that timeframe.
Tags: SMA, moving average, projection, slope, momentum, ATR, extrapolation, non-repainting, trading tools
Draws a linear projection of a Simple Moving Average (SMA) 20 bars into the future using the SMA’s recent slope. Optionally shows a tiny momentum flag (just a number) positioned 0.75× ATR below the SMA on the last bar. No future data is read; everything updates on the current bar only.
How it works
SMA: Standard SMA on your chosen source and length.
Projection (fixed 20 bars): Uses a linear extrapolation from the last SMA value with slope
slope = (ma - ma[slopeLen]) / slopeLen
Momentum magnitude (optional): A signed number where >0 = up-slope, <0 = down-slope, ~0 = flat. Units are selectable: price/bar, %/bar, or ATR/bar (default). The flag is rendered small and colored teal (pos) / red (neg) / gray (flat).
Key features
Fixed 20-bar projection (no input—keeps it simple and comparable).
Tiny numeric momentum flag (off by default) placed well below the line (0.75× ATR).
Unit choices for momentum: price/bar, %/bar, ATR/bar.
Deadband option to zero-out tiny slopes.
Non-repainting projection: drawn only on the last bar; updates each candle.
Inputs (summary)
SMA length and Source
Slope lookback (for magnitude)
Show momentum flag (default: Off)
Magnitude units: price/bar, %/bar, ATR/bar (default)
Deadband and Decimals for display control
Tips
For smoother projections, increase slope lookback; for responsiveness, decrease it.
Use ATR/bar or %/bar if you want momentum values that are more comparable across symbols and timeframes.
The projection is indicative, not predictive—combine with structure, volume, and risk management.
Notes & limits
The “future” line is just a linear extrapolation from recent behavior; regime shifts will break linearity.
The momentum flag text is intentionally minimal to avoid chart clutter.
Works on any timeframe; the projection distance is always 20 bars on that timeframe.
Tags: SMA, moving average, projection, slope, momentum, ATR, extrapolation, non-repainting, trading tools
เอกสารเผยแพร่
What it doesDraws a linear projection of a Simple Moving Average (SMA) 20 bars into the future using the SMA’s recent slope. Optionally shows a tiny momentum flag (just a number) positioned 0.75× ATR below the SMA on the last bar. No future data is read; everything updates on the current bar only.
How it works
SMA: Standard SMA on your chosen source and length.
Projection (fixed 20 bars): Uses a linear extrapolation from the last SMA value with slope
slope = (ma - ma[slopeLen]) / slopeLen
Momentum magnitude (optional): A signed number where >0 = up-slope, <0 = down-slope, ~0 = flat. Units are selectable: price/bar, %/bar, or ATR/bar (default). The flag is rendered small and colored teal (pos) / red (neg) / gray (flat).
Key features
Fixed 20-bar projection (no input—keeps it simple and comparable).
Tiny numeric momentum flag (off by default) placed well below the line (0.75× ATR).
Unit choices for momentum: price/bar, %/bar, ATR/bar.
Deadband option to zero-out tiny slopes.
Non-repainting projection: drawn only on the last bar; updates each candle.
Inputs (summary)
SMA length and Source
Slope lookback (for magnitude)
Show momentum flag (default: Off)
Magnitude units: price/bar, %/bar, ATR/bar (default)
Deadband and Decimals for display control
Tips
For smoother projections, increase slope lookback; for responsiveness, decrease it.
Use ATR/bar or %/bar if you want momentum values that are more comparable across symbols and timeframes.
The projection is indicative, not predictive—combine with structure, volume, and risk management.
Notes & limits
The “future” line is just a linear extrapolation from recent behavior; regime shifts will break linearity.
The momentum flag text is intentionally minimal to avoid chart clutter.
Works on any timeframe; the projection distance is always 20 bars on that timeframe.
Tags: SMA, moving average, projection, slope, momentum, ATR, extrapolation, non-repainting, trading tools
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้มันเป็นโอเพ่นซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันการทำงานของสคริปต์ได้ ขอแสดงความชื่นชมผู้เขียน! แม้ว่าคุณจะสามารถใช้งานได้ฟรี แต่อย่าลืมว่าการเผยแพร่โค้ดซ้ำนั้นจะต้องเป็นไปตามกฎระเบียบการใช้งานของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้มันเป็นโอเพ่นซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันการทำงานของสคริปต์ได้ ขอแสดงความชื่นชมผู้เขียน! แม้ว่าคุณจะสามารถใช้งานได้ฟรี แต่อย่าลืมว่าการเผยแพร่โค้ดซ้ำนั้นจะต้องเป็นไปตามกฎระเบียบการใช้งานของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน