Indicator · Pine Script v5 · On the chart

AAPL Structural Lines & Fills

by dcaoyuan

This indicator plots horizontal support and resistance from confirmed pivot lows and pivot highs, using ten bars on each side.

View on GitHub

GitHub stars55on the repository
Pine versionv5runs as is
Lines of code31
Settings0inputs
LicenceApache-2.0
Last update6 months ago20 Apr 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

31 lines of Pine Script v5 from public/indicators/strlines.pine, published under Apache-2.0. Keep the author's credit and licence lines when you reuse it.

strlines.pine
//@version=5
indicator("AAPL Structural Lines & Fills", overlay=true)

// Pivot Points (Using build-in logic)
ph = ta.pivothigh(high, 10, 10)
pl = ta.pivotlow(low, 10, 10)

// Storage for Lines
var line resLine = na
var line supLine = na

// Logic for Resistance Line
if not na(ph)
    line.delete(resLine)
    resLine := line.new(bar_index[10], ph, bar_index + 10, ph, color=color.new(color.red, 0), width=2)

// Logic for Support Line
if not na(pl)
    line.delete(supLine)
    supLine := line.new(bar_index[10], pl, bar_index + 10, pl, color=color.new(color.green, 0), width=2)

// Using linefill to visualize the Trading Zone
if not na(resLine) and not na(supLine)
    linefill.new(resLine, supLine, color.new(color.gray, 90))

// VWAP for additional context
vwapVal = ta.vwap(close)
plot(vwapVal, "VWAP", color.orange, 2)

plotshape(ph, style=shape.labeldown, location=location.abovebar, color=color.red, text="Res", textcolor=color.white)
plotshape(pl, style=shape.labelup, location=location.belowbar, color=color.green, text="Sup", textcolor=color.white)

Overview

When a new pivot appears, it replaces the previous line and extends it ten bars beyond the current bar. A translucent gray fill marks the zone between the latest support and resistance. It also plots volume-weighted average price in orange and labels pivots as support or resistance on the price chart. There are no user inputs, and lines only update after pivots confirm.

Details

Published by

dcaoyuan on GitHub

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Support & resistance, Volume

Markets

Stocks

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

aicharttradingvibepinescripttechnical-analysispinestock

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.

Similar Pine Scripts

This overlay indicator draws a fixed-range volume profile on the price chart, splitting traded activity into up and down volume at each price level. It also plots a sentiment profile, a developing point of control, and value-area high and low around a configur

Indicator v5 VolumeSupport & resistance
Updated 2 months ago · MIT GitHub repository of Volume Profile and Indicator by DGT

MGIC-tracker

by Allen1212
303 stars

The MGIC-tracker is a TradingView indicator that overlays ARK Invest trade records onto stock price charts. It plots buy and sell labels at the exact timestamp of each transaction, showing share volume and ETF weight. Users select a specific ETF type via setti

Indicator v4 Support & resistanceVolume
Updated 2 years ago · None stated GitHub repository of MGIC-tracker
218 stars

Comprehensive Volume Profile is an overlay indicator that calculates and plots volume distribution across specified time ranges such as daily sessions, weekly, monthly, or custom bar lengths. It identifies key structural price levels including the Point of Con

Indicator v6 VolumeSupport & resistance
Updated 3 months ago · None stated GitHub repository of Comprehensive Volume Profile

Moon Dev GEX Arrows

by moondevonyt
92 stars

This overlay indicator plots option strike walls and an optional session VWAP on the price chart for SPY or ES. It spaces major strikes by the selected instrument, draws a set number of strikes on each side, and marks wall-trap and sweep events after a cooldow

Indicator v5 Support & resistanceSessions & time
Updated 8 weeks ago · Custom licence GitHub repository of Moon Dev GEX Arrows

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers