OPEN-SOURCE SCRIPT
Aktualisiert MA Slope Indicator

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).
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).
Versionshinweise
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).
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.