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
124 lines of Pine Script v5 from Tradingview/pivot-trendlines-v4.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.
Pivot Trendlines identifies small pivots when they occur and large pivots when price breaks through the recent opposite small pivot. Labels for small pivot highs (SPH), small pivot lows (SPL), large pivot highs (LPH), and large pivot lows (LPL) are plotted directly on the price chart. Settings allow toggling each pivot type and setting custom colors. The tool visualizes market structure and swing points for trend analysis. It draws no exit signals or stop loss as it is not a strategy. The indicator works on any timeframe and may repaint as new bars are added.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Length
int
2
pivot_length
SPH⠀⠀⠀
bool
true
use_sph
sph_color
color
color.rgb(0, 0, 0)
sph_color
SPL⠀⠀⠀
bool
true
use_spl
spl_color
color
color.rgb(0, 0, 0)
spl_color
LPH⠀⠀⠀
bool
true
use_lph
lph_color
color
color.blue
lph_color
LPL⠀⠀⠀
bool
true
use_lpl
lpl_color
color
color.blue
lpl_color
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 detects equal highs and lows by comparing prices within user-defined left and right bars using a tolerance percentage. It plots horizontal lines on the price chart for equal highs in one color and lows in another. A screener allows input of mult
This Pine Script indicator plots a ZigZag on the price chart. It identifies reversal points when price moves more than a set percentage from the last pivot. The script calculates forecasts using zigzag data and labels detected geometric patterns including harm
This indicator plots market structure on the price chart by identifying swing highs and lows. It connects these points with lines to visualize trend direction and detect Break of Structure (BOS) when price breaks a prior swing in the current trend. Change of C
This indicator implements the Fractal Model concept to plot market structure shifts, liquidity sweeps, and Change in State of Delivery (CISD) levels. It overlays custom higher-timeframe candle previews, open prices, and time markers directly on the price chart
BigBeluga Smart Money Concepts identifies and overlays market structure and volumetric order blocks directly on the price chart. It analyzes market swings, trend sweeps, and mapping structure using customizable pivot lengths and calculation modes. The indicato
Apex Trend & Liquidity Master calculates a trend cloud using customizable moving averages expanded by a volatility multiplier directly on the main price chart. It identifies dynamic support and resistance liquidity zones from swing high and low pivots, extendi