Pivot Trendlines is an indicator that plots horizontal support and resistance lines along with trendline support and resistance based on swing pivots of customizable lengths.
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
166 lines of Pine Script v5 from Tradingview/pivot-trendlines.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.
Three separate groups allow adjustment of pivot length to draw multiple horizontal lines at key levels and connecting trendlines on the price chart. Users configure colors and line styles for each group to highlight potential breakout zones and trend channels. The tool provides visual reference levels derived from pivot points without generating buy or sell signals.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Pivot Length
int
1
n
Horizontal Support
color
color.gray
hs_color1
Horizontal Resistance
color
color.gray
hr_color1
Trendline Support
color
color.gray
ts_color1
Trendline Resistance
color
color.gray
tr_color1
_style_hs1
string
Solid
_style_hs1
_style_hr1
string
Solid
_style_hr1
_style_ts1
string
Solid
_style_ts1
_style_tr1
string
Solid
_style_tr1
Pivot Length
int
2
n2
Horizontal Support
color
color.gray
hs_color2
Horizontal Resistance
color
color.gray
hr_color2
Show all 27 settings
Setting
Type
Default
Variable
Trendline Support
color
color.gray
ts_color2
Trendline Resistance
color
color.gray
tr_color2
_style_hs2
string
Solid
_style_hs2
_style_hr2
string
Solid
_style_hr2
_style_ts2
string
Solid
_style_ts2
_style_tr2
string
Solid
_style_tr2
Pivot Length
int
3
n3
Horizontal Support
color
color.gray
hs_color3
Horizontal Resistance
color
color.gray
hr_color3
Trendline Support
color
color.gray
ts_color3
Trendline Resistance
color
color.gray
tr_color3
_style_hs3
string
Solid
_style_hs3
_style_hr3
string
Solid
_style_hr3
_style_ts3
string
Solid
_style_ts3
_style_tr3
string
Solid
_style_tr3
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.
Sideway Zones Live is an overlay indicator that estimates inner and outer sideways bands from recent highs and lows with a rational quadratic kernel. It tracks swing pivots over a loopback period and counts bars that remain between the outer high and low. Afte
This indicator calculates dynamic upper and lower trendlines from pivot highs and pivot lows across a specified bar length. Trendline slopes are derived using ATR, standard deviation, or linear regression methods. It plots trendlines and breakout signal labels
This indicator detects inside candles inside larger parent candles on the price chart. It plots colored boxes around inside and parent candles, fills them with user-adjustable transparency, draws Fibonacci retracement lines and mother candle range lines, and d
This indicator maps Smart Money Concepts (SMC) market structure directly onto the price chart. It detects internal and swing structure breaks (BOS and CHoCH), tracks bullish and bearish order blocks, identifies fair value gaps (FVG), highlights equal highs and
The Market Tradability Engine calculates multi-factor tradability, balance, compression, and direction scores to evaluate market regime quality. It classifies market conditions into eight distinct states, including Balance, Compression, Ready, Breakout, Trend,
This indicator tracks swing highs and swing lows to generate trend-following trailing stop levels on the price chart. When the closing price breaks above the previous swing high, the system establishes a bullish state using the recent swing low as a trailing s