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
138 lines of Pine Script v5 from pinescript/editors_picks/average-lines.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.
Average Lines allows users to set left and right bar counts for pivot detection, choose which averages to display (pivot highs only, lows only, both, or none), and enable optional line filling. Colors can be customized for connecting lines between pivots, individual lines, averages, and fills for each pivot type. The script maintains arrays to limit plotted lines to 500 points for performance. It draws its elements as an overlay on the price chart.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
leftbars
int
10
left
rightbars
int
1
right
fill lines?
bool
true
fill
choice
string
ph
choice
max pivot points for calculations
int
500
max
max bars between concerning bar and last bar
int
1000
maxX
connecting line between (pivots)
color
color.new(color.red , 85)
c_pih
lines
color
color.new(color.red , 99)
c_lh
average
color
color.new(#00bcd4 , 0)
c_avh
linefill
color
color.new(color.red , 93)
c_fh
connecting line between (pivots)
color
color.new(color.lime, 85)
c_pil
lines
color
color.new(color.blue, 99)
c_ll
Show all 14 settings
Setting
Type
Default
Variable
average
color
color.new(#388e3c , 0)
c_avl
linefill
color
color.new(color.lime, 93)
c_fl
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.
Moving Average Channel plots separate simple moving averages for upper and lower bands on the price chart. It fills the space between bands with semi-transparent color and colors bars green above the upper band, red below the lower band, or gray in between. Us
This indicator calculates pivot high and pivot low points on the price chart based on configurable left and right bar counts. Confirmed pivot highs and lows are plotted with negative bar offsets directly on the price chart using line and cross styles. Addition
This overlay indicator marks call and put setups from EMAs, RSI, MACD, and a SPY volume ratio. A call needs higher highs, RSI above its minimum, rising MACD, above-average proxy volume, and a rising trend EMA; a put reverses those tests. Early markers use an E
The Midnight VWAP indicator calculates and overlays two distinct Volume Weighted Average Price (VWAP) lines on the price chart based on customizable session timeframes. It tracks an overnight or pre-market session alongside regular trading hours, resetting cal
This indicator plots Ichimoku Cloud elements on the price chart, including Tenkan-sen, Kijun-sen, Senkou Span A and B lines with optional Chikou Span. It signals trend changes via Tenkan-sen and Kijun-sen crosses and places arrows at Kijun-sen direction shifts
This indicator displays moving average deduction reference points directly on the price chart. It plots dynamic labels on historical bars corresponding to short, medium, and long lookback periods, defaulted to 20, 60, and 120 bars. Each text label displays the