OPEN-SOURCE SCRIPT

[teachershim] draw sma 9/25/50/100/200/400

157
📌 Description — [teachershim] draw sma 9/25/50/100/200/400
This indicator displays Simple Moving Averages (SMA) for periods 9, 25, 50, 100, 200, and 400 on the chart.
It also marks the last confirmed bar’s SMA values with circular dots positioned to the right by a user-defined offset,
and labels each dot with the SMA period number for quick visual reference.

🔹 Features
SMA Lines

Plots SMA lines for periods 9 / 25 / 50 / 100 / 200 / 400 in distinct colors and thickness.

Last Value Markers

Adds circular markers (dots) at the SMA value of the last confirmed bar, shifted right by the specified offset.

SMA Period Labels

Displays the SMA period number (e.g., "9", "25", "50") just above each dot.

Customizable Parameters

Right offset for marker placement.

Vertical gap between marker and label (in percentage of chart range).

🔹 Parameters
Right Offset: Number of bars to place the marker/label to the right of the last bar.

Text Vertical Gap (%): Percentage offset to position the label above the dot.

🔹 Colors & Line Thickness
SMA 9 → Teal, thickness 1

SMA 25 → Orange, thickness 2

SMA 50 → Blue, thickness 2

SMA 100 → Purple, thickness 1

SMA 200 → Red, thickness 2

SMA 400 → Gray, thickness 1

🔹 Use Cases
Quickly identify key support/resistance levels across multiple SMA periods.

Instantly see the current SMA values without hovering over the chart.

Monitor SMA alignment and spacing for trend analysis or trading setups.

💡 Notes

If the right offset is too large, ensure your chart’s right margin is wide enough to display the markers.

max_labels_count in Pine Script limits how many labels can be displayed at once.

If you want, I can also make you a shorter, more concise “marketplace style” version for TradingView’s public library so it’s punchier and attracts more clicks.
Do you want me to prepare that?

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。