1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
Source Code
43 lines of Pine Script v6 from public/indicators/supertrend_pivots.pine, published under Apache-2.0. Keep the author's credit and licence lines when you reuse it.
supertrend_pivots.pine
//@version=6
// 主图指标:SuperTrend & Pivot Points
indicator("SuperTrend & Pivots", overlay=true)
// SuperTrend
atrPeriod = 10
factor = 3.0
[supertrend, direction] = ta.supertrend(factor, atrPeriod)
bodyMiddle = plot((open + close) / 2, display=display.none)
upTrend = plot(direction < 0 ? supertrend : na, "Up Trend", color = color.green, style=plot.style_linebr)
downTrend = plot(direction < 0? na : supertrend, "Down Trend", color = color.red, style=plot.style_linebr)
fill(bodyMiddle, upTrend, color.new(color.green, 90), fillgaps=false)
fill(bodyMiddle, downTrend, color.new(color.red, 90), fillgaps=false)
// Pivot Points (Auto - Traditional)
// 简单的日线级别枢轴点计算 (基于前一日数据)
h = request.security(syminfo.tickerid, "D", high[1])
l = request.security(syminfo.tickerid, "D", low[1])
c = request.security(syminfo.tickerid, "D", close[1])
p = (h + l + c) / 3
r1 = 2 * p - l
s1 = 2 * p - h
r2 = p + (h - l)
s2 = p - (h - l)
// 仅绘制最近的 Pivot 线以避免图表混乱
var line line_p = na
var line line_r1 = na
var line line_s1 = na
if barstate.islast
line.delete(line_p)
line.delete(line_r1)
line.delete(line_s1)
line_p := line.new(bar_index - 10, p, bar_index + 10, p, color=color.orange, width=1, style=line.style_dashed)
line_r1 := line.new(bar_index - 10, r1, bar_index + 10, r1, color=color.red, width=1, style=line.style_dashed)
line_s1 := line.new(bar_index - 10, s1, bar_index + 10, s1, color=color.green, width=1, style=line.style_dashed)
// 使用 label 显示文字 (Pine Script v5/v6 label is supported)
label.new(bar_index + 11, p, "P", style=label.style_none, textcolor=color.orange)
label.new(bar_index + 11, r1, "R1", style=label.style_none, textcolor=color.red)
label.new(bar_index + 11, s1, "S1", style=label.style_none, textcolor=color.green)
Overview
When the trend direction is up it draws a green line and a light green fill toward the candle midpoint; when down it draws a red line and a light red fill. It also computes traditional daily pivot levels from the previous day's high, low, and close, then draws dashed P, R1, and S1 lines with labels around the last bar. R2 and S2 are calculated but not drawn, and there are no user inputs.
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.
This indicator plots Donchian Channel boundary lines along with dynamic fan projections directly on the price chart. It calculates the highest high, lowest low, and median price over a customizable lookback period. Whenever price establishes a new channel high
Dynamic Linear Regression calculates and plots linear regression trendlines and standard deviation channels directly on the price chart over a user-selected time period. Traders can configure static channels locked at the end time, dynamic channels that contin
This indicator overlays trend-following Supertrend bands on the price chart using Average True Range calculations. It plots trailing stop lines, highlights active trend directions, and prints buy or sell shape labels when price closes across band thresholds. I
Calculates an ATR-based trailing stop overlaid on the price chart to assist with trend identification and stop placement. Using a specified ATR period and multiplier, it projects upper and lower bounds around the closing price. The stop line ratchets up during
Moon Dev Lunar Sniper is a multi-indicator overlay that scores confluence across fast and slow EMAs, RSI, MACD, DMI, and BB width to fire signals only when score meets the minimum threshold. It plots buy and sell signals on the price chart, highlights cosmic b
The Ultimate Channel calculates an ultra-smoothed centerline alongside upper and lower volatility bands directly on the main price chart. It processes true range values through an advanced infinite impulse response smoothing filter to establish dynamic channel