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

MA Slope Indicator

48
a complete Pine Script (version 5) indicator for TradingView that implements what you're describing. It calculates Simple Moving Averages (SMAs) for four lengths (10, 20, 200, and 400 bars by default—these are configurable via inputs). For each SMA, it computes a "slope" value by comparing the current SMA value to the average of the previous X SMA values (where X is also a configurable input, defaulting to 5 bars).

The slope is calculated as: current_SMA - avg_of_previous_X_SMAs.
A positive slope indicates an upward trend (e.g., the MA is rising relative to its recent history).
A negative slope indicates a downward trend.
Zero means flat.
The script plots:
The four SMAs as lines on the chart (for reference).
Four histograms below the chart showing the slope values for each SMA, colored green for positive, red for negative, and gray for zero/flat.
This uses only simple moving averages (ta.sma() in Pine Script).
เอกสารเผยแพร่
Simple Moving Averages (SMAs) for four lengths (10, 20, 200, and 400 bars by default—these are configurable via inputs). For each SMA, it computes a "slope" value by comparing the current SMA value to the average of the previous X SMA values (where X is also a configurable input, defaulting to 5 bars).

The slope is calculated as: current_SMA - avg_of_previous_X_SMAs.
A positive slope indicates an upward trend (e.g., the MA is rising relative to its recent history).
A negative slope indicates a downward trend.
Zero means flat.
The script plots:
The four SMAs as lines on the chart (for reference).
Four histograms below the chart showing the slope values for each SMA, colored green for positive, red for negative, and gray for zero/flat.
This uses only simple moving averages (ta.sma() in Pine Script).

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน