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.
//@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.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
ABR Lookback
int
8
abrLen
Show 1x ABR
bool
true
show1
Show 2x ABR
bool
false
show2
Show 3x ABR
bool
false
show3
Show 4x ABR
bool
false
show4
1x Color (lightest)
color
#c2c2c2
color1
2x Color
color
#8c8c8c
color2
3x Color
color
#4d4d4d
color3
4x Color (darkest)
color
#0d0d0d
color4
Line Width
int
1
lineWidth
Enable Breakout Bar Coloring
bool
true
breakoutOn
Bars Back to Check
int
1
breakLookback
Show all 16 settings
Setting
Type
Default
Variable
ABR Multiplier Level
int
3
breakLevel
Broke Above Color
color
color.blue
breakUpColor
Broke Below Color
color
color.red
breakDownColor
Broke Both Color
color
color.purple
breakBothColor
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 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
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
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
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,
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
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