Indicator · Pine Script v6 · On the chart

Zen ABR Against

by Zen-Tim

This overlay indicator measures average bar range as a simple moving average of high minus low, then draws short horizontal ticks at one to four times that range above and below the close.

View on GitHub

GitHub stars29on the repository
Pine versionv6current
Lines of code78
Settings16inputs
LicenceMIT
Last update2 weeks ago14 Oct 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

78 lines of Pine Script v6 from indicators/Zen-ABR-Against/zen-abr-against-v1.0.txt, published under MIT. Keep the author's credit and licence lines when you reuse it.

zen-abr-against-v1.0.txt
//@version=6
indicator("Zen ABR Against", overlay = true, max_lines_count = 500)

// ---------------- Inputs: Bands ----------------
int    abrLen  = input.int(8, "ABR Lookback", minval = 1, group = "ABR")

bool   show1   = input.bool(true,  "Show 1x ABR", group = "Bands")
bool   show2   = input.bool(false, "Show 2x ABR", group = "Bands")
bool   show3   = input.bool(false, "Show 3x ABR", group = "Bands")
bool   show4   = input.bool(false, "Show 4x ABR", group = "Bands")

color  color1  = input.color(#c2c2c2, "1x Color (lightest)", group = "Colors")
color  color2  = input.color(#8c8c8c, "2x Color",            group = "Colors")
color  color3  = input.color(#4d4d4d, "3x Color",            group = "Colors")
color  color4  = input.color(#0d0d0d, "4x Color (darkest)",  group = "Colors")

int    lineWidth = input.int(1, "Line Width", minval = 1, maxval = 4, group = "Bands")

// ---------------- Inputs: Breakout Bar Coloring ----------------
bool   breakoutOn   = input.bool(true, "Enable Breakout Bar Coloring", group = "Breakout")
int    breakLookback = input.int(1, "Bars Back to Check", minval = 1, group = "Breakout")
int    breakLevel    = input.int(3, "ABR Multiplier Level", minval = 1, maxval = 4, group = "Breakout")

color  breakUpColor    = input.color(color.blue,   "Broke Above Color", group = "Breakout")
color  breakDownColor  = input.color(color.red,    "Broke Below Color", group = "Breakout")
color  breakBothColor  = input.color(color.purple, "Broke Both Color",  group = "Breakout")

// ---------------- ABR ----------------
float abr = ta.sma(high - low, abrLen)

// ---------------- Levels ----------------
float upper1 = close + abr * 1
float upper2 = close + abr * 2
float upper3 = close + abr * 3
float upper4 = close + abr * 4

float lower1 = close - abr * 1
float lower2 = close - abr * 2
float lower3 = close - abr * 3
float lower4 = close - abr * 4

// ---------------- Tick geometry (fixed width, immune to session gaps) ----------------
float tickHalf     = 0.4  // fraction of one bar's width either side of center - fixed, not user-facing
float tfMs         = timeframe.in_seconds() * 1000
float halfWidthMs  = tfMs * tickHalf
int   xLeft        = int(time - halfWidthMs)
int   xRight        = int(time + halfWidthMs)

// ---------------- Tick drawing ----------------
drawTick(bool show, float level, color col) =>
    if show and not na(level)
        line.new(xLeft, level, xRight, level, xloc.bar_time, extend = extend.none, color = col, width = lineWidth)

drawTick(show1, upper1, color1)
drawTick(show2, upper2, color2)
drawTick(show3, upper3, color3)
drawTick(show4, upper4, color4)

drawTick(show1, lower1, color1)
drawTick(show2, lower2, color2)
drawTick(show3, lower3, color3)
drawTick(show4, lower4, color4)

// ---------------- Breakout Bar Coloring ----------------
// Tests whether the CURRENT bar's high/low took out the ABR level (breakLevel x ABR)
// measured from the bar breakLookback bars back (using that bar's own close and ABR).
float refClose = close[breakLookback]
float refAbr   = abr[breakLookback]

float refUpper = refClose + refAbr * breakLevel
float refLower = refClose - refAbr * breakLevel

bool brokeUp   = breakoutOn and not na(refUpper) and high > refUpper
bool brokeDown = breakoutOn and not na(refLower) and low  < refLower

color barCol = brokeUp and brokeDown ? breakBothColor : brokeUp ? breakUpColor : brokeDown ? breakDownColor : na

barcolor(barCol)

Overview

The user chooses which multipliers appear, their colors, and the line width. Optional bar coloring marks the current bar when its high or low exceeds a selected multiple of the range measured from a prior bar’s close. It does not place trades or define exits.

Details

Published by

Zen-Tim on GitHub

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

Volatility & bands, Support & resistance, Breakout

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
ABR Lookbackint8abrLen
Show 1x ABRbooltrueshow1
Show 2x ABRboolfalseshow2
Show 3x ABRboolfalseshow3
Show 4x ABRboolfalseshow4
1x Color (lightest)color#c2c2c2color1
2x Colorcolor#8c8c8ccolor2
3x Colorcolor#4d4d4dcolor3
4x Color (darkest)color#0d0d0dcolor4
Line Widthint1lineWidth
Enable Breakout Bar ColoringbooltruebreakoutOn
Bars Back to Checkint1breakLookback
Show all 16 settings
SettingTypeDefaultVariable
ABR Multiplier Levelint3breakLevel
Broke Above Colorcolorcolor.bluebreakUpColor
Broke Below Colorcolorcolor.redbreakDownColor
Broke Both Colorcolorcolor.purplebreakBothColor
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

Donchian Channels (DC)

by mihakralj
99 stars

This indicator calculates and plots Donchian Channels directly on the price chart. It determines the highest high and lowest low over a user-selected lookback period using an optimized monotonic deque algorithm, as well as a middle basis line computed as their

Indicator v6 Volatility & bandsSupport & resistance
Updated 4 weeks ago · Apache-2.0 GitHub repository of Donchian Channels (DC)
47 stars

The Donchian Channels indicator plots the middle basis line as the average of the high and low over the user-defined period. It also draws the upper band as the highest high and the lower band as the lowest low across the same period on the price chart. The ma

Indicator v6 Volatility & bandsSupport & resistance
Updated 8 months ago · MIT GitHub repository of Donchian Channels (DCHANNEL)
43 stars

This indicator plots Donchian channel bands and a midline on the price chart. It finds the highest and lowest values over a user-set length, then draws the upper band, lower band, and their average as the basis. The source setting chooses high and low, or the

Indicator v4 Volatility & bandsBreakout
Updated 1 year ago · None stated GitHub repository of Donchian Channels Experiment

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,

Indicator v6 TrendVolatility & bands
Updated yesterday · MIT GitHub repository of Market Tradability Engine [WavesUnchained]

ICT Liquidity Void Fill

by ArunKBhaskar
575 stars

This overlay indicator marks ICT liquidity void fills on the price chart and can show long and short signals. It places a Fibonacci level inside a displacement candle, defaulting to the midpoint, and draws lines in a chosen style. Optional filters limit the fi

Indicator v6 SMC / ICT / price actionSupport & resistance
Updated 1 year ago · MPL-2.0 GitHub repository of ICT Liquidity Void Fill

[RS]Donchian Fans

by ricardosantos79
261 stars

This indicator plots Donchian Channel boundary lines along with dynamic fan projections directly on the price chart. It calculates the highest high, lowest low, and median price over a customizable lookback period. Whenever price establishes a new channel high

Indicator v4 Support & resistanceTrend
Updated 4 years ago · None stated GitHub repository of [RS]Donchian Fans

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