Indicator · Pine Script v5 · On the chart

Support & Resistance Levels with Break of Structure

by SynergOps· code credited to Salih Emin (cerebrux)

This indicator identifies dynamic support and resistance levels using pivot highs and lows.

View on GitHub

GitHub stars7on the repository
Pine versionv5runs as is
Lines of code42
Settings4inputs
LicenceMPL-2.0
Last update1 year ago4 Aug 2025

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

42 lines of Pine Script v5 from Support and Resistance Breaker - Indicator/SR_and_breaker.pine, published under MPL-2.0. Keep the author's credit and licence lines when you reuse it.

SR_and_breaker.pine
//@version=5
// This script is distributed under the terms of the MIT License.
// See https://opensource.org/licenses/MIT for more information.
// © Salih Emin (cerebrux)

indicator(title='Support & Resistance Levels with Break of Structure', shorttitle='Support & Resistance Levels with Break of Structure', overlay=true, max_bars_back=1000)

// Define input parameters
toggleBreaks = input(true, title='Show Stracture Breakers')
leftBars = input(9, title='Left Bars')
rightBars = input(9, title='Right Bars')
volumeThreshold = input(26, title='Volume Threshold')

// Calculate pivots
higherPivot = fixnan(ta.pivothigh(leftBars, rightBars)[1])
lowerPivot = fixnan(ta.pivotlow(leftBars, rightBars)[1])

// Plot pivots
plot(higherPivot, color=ta.change(higherPivot) ? na : #ff0000, linewidth=2, offset=-(rightBars + 1), title='Resistance Level')
plot(lowerPivot, color=ta.change(lowerPivot) ? na : #00ff4c, linewidth=2, offset=-(rightBars + 1), title='Support Level')

// Calculate volume_oscillator
short_time_vol = ta.ema(volume, 9)
long_time_vol = ta.ema(volume, 26)
volume_oscillator = 100 * (short_time_vol - long_time_vol) / long_time_vol

// Plot breaks with volume
plotshape(toggleBreaks and ta.crossunder(close, lowerPivot) and not(open - close < high - open) and volume_oscillator > volumeThreshold, title='BEARISH Break of Structure', text='Bearish Break', style=shape.labeldown, location=location.abovebar, color=color.new(#fd0000, 0), textcolor=color.new(color.white, 0), size=size.tiny)
plotshape(toggleBreaks and ta.crossover(close, higherPivot) and not(open - low > close - open) and volume_oscillator > volumeThreshold, title='BULLISH Break of Structure', text='Bullish Break', style=shape.labelup, location=location.belowbar, color=color.new(#00c40a, 0), textcolor=color.new(color.white, 0), size=size.tiny)

// Plot bull / bearish wicks
plotshape(toggleBreaks and ta.crossover(close, higherPivot) and open - low > close - open, title='Bullish Wick Break', text='Bullish Wick', style=shape.labelup, location=location.belowbar, color=color.new(#007c04, 0), textcolor=color.new(color.white, 0), size=size.tiny)
plotshape(toggleBreaks and ta.crossunder(close, lowerPivot) and open - close < high - open, title='Bullish Wick Break', text='Bearish Wick', style=shape.labeldown, location=location.abovebar, color=color.new(#570000, 0), textcolor=color.new(color.white, 0), size=size.tiny)


// Set up alerts for when the price reaches the support and resistance levels
alertcondition(ta.crossunder(close, lowerPivot) or close == lowerPivot, title='Price at Support Level', message='Price at Support Level')
alertcondition(ta.crossover(close, higherPivot) or close == higherPivot, title='Price at Resistance Level', message='Price at Resistance Level')

// Set alerts for when the price breaks levels
alertcondition(ta.crossunder(close, lowerPivot) and volume_oscillator > volumeThreshold, title='Support Level Broken', message='Support Level Broken')
alertcondition(ta.crossover(close, higherPivot) and volume_oscillator > volumeThreshold, title='Resistance Level Broken', message='Resistance Level Broken')

Overview

Support & Resistance Levels with Break of Structure plots resistance and support lines directly on the price chart once pivot points are confirmed. Additionally, it calculates a volume oscillator using 9-period and 26-period exponential moving averages of volume to validate structure breaks. When price crosses established levels accompanied by high volume oscillator values or wick extension, it plots break of structure labels above or below the candles.

Details

Published by

SynergOps on GitHub

Code credit

Salih Emin (cerebrux), as written in the script's header

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Support & resistance, SMC / ICT / price action, Breakout, Volume

Markets

Any symbol

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.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Show Stracture BreakersbooltruetoggleBreaks
Left Barsint9leftBars
Right Barsint9rightBars
Volume Thresholdint26volumeThreshold
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

13 stars

This script identifies and visualizes bullish and bearish order blocks on the price chart. It detects low-volatility consolidation ranges followed by breakout moves accompanied by high trading volume. Users can select between Simple, Relative, or Weighted volu

Indicator v6 SMC / ICT / price actionSupport & resistance
Updated 6 months ago · MIT GitHub repository of Advanced Order Blocks with Volume

Moon Dev GEX Sweep & CVD

by moondevonyt
92 stars

The indicator detects liquidity sweeps across key price levels and calculates a cumulative volume delta proxy. It uses pivot high and low lookbacks to identify swing points, marking sweeps when price breaks beyond a level and quickly closes back inside. Featur

Indicator v5 Support & resistanceSMC / ICT / price action
Updated 8 weeks ago · Custom licence GitHub repository of Moon Dev GEX Sweep & CVD

This indicator tracks smart money market structure directly on the price chart. It calculates dual-period swing highs and swing lows to detect Changes of Character (CHoCH), Breaks of Structure (BOS), inducements, and liquidity sweeps. When structural levels ar

Indicator v5 SMC / ICT / price actionSupport & resistance
Updated 1 year ago · Apache-2.0 GitHub repository of Market Structure with Inducements & Sweeps [LuxAlgo]

Calculates higher-timeframe volume profiles to identify Value Area High (VAH), Value Area Low (VAL), and Point of Control (POC) levels directly on the price chart. It flags potential reversal setups and Change in State of Delivery (CISD) patterns relative to v

Indicator v6 VolumeSupport & resistance
Updated 2 months ago · None stated GitHub repository of CandelaCharts - Value Area Reversals

Copilot

by milocaetano
48 stars

Copilot is an order flow range-reversal indicator designed to overlay trading setups directly on the price chart. It evaluates four criteria: market context (sideways vs trending regime based on ATR height), structure (double top or double bottom retests), abs

Indicator v5 SMC / ICT / price actionSupport & resistance
Updated yesterday · MIT GitHub repository of Copilot

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