Indicator · Pine Script v6 · On the chart

ADR 50 SR Pro

by DEVfancybear

ADR 50 SR Pro calculates key support and resistance levels based on 50% of the Average Daily Range (ADR) projected above and below the daily opening price.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code94
Settings11inputs
LicenceMIT
Last update7 weeks ago8 Sep 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

94 lines of Pine Script v6 from backend/internal/pineruntime/sources/adr.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

adr.pine
//@version=6
indicator("ADR 50 SR Pro", overlay = true, max_lines_count = 500, max_labels_count = 500, max_boxes_count = 500)

adrPeriod = input.int(10, "ADR Period", options = [5, 10, 20], group = "Calculation")
showLabels = input.bool(true, "Show Labels", group = "Display")
showZones = input.bool(true, "Show Zones", group = "Display")
zoneWidthPct = input.float(2.0, "Zone Width % (of ADR)", minval = 0.0, step = 0.5, group = "Display")
showDash = input.bool(true, "Show Dashboard", group = "Display")
showAdrDate = input.bool(true, "Show ADR Date", group = "Display")
showDistance = input.bool(true, "Show Distance", group = "Display")
lineWidth = input.int(2, "Line Width", minval = 1, maxval = 4, group = "Style")
colHigh = input.color(color.red, "ADR H50 Color", group = "Colors")
colLow = input.color(color.green, "ADR L50 Color", group = "Colors")
zoneTransp = input.int(85, "Zone Transparency", minval = 0, maxval = 100, group = "Colors")

adr = request.security(syminfo.tickerid, "D", ta.sma(high - low, adrPeriod)[1], lookahead = barmerge.lookahead_off)
dOpen = request.security(syminfo.tickerid, "D", open, lookahead = barmerge.lookahead_off)
todayRange = request.security(syminfo.tickerid, "D", high - low, lookahead = barmerge.lookahead_off)
lastDayTime = request.security(syminfo.tickerid, "D", time[1], lookahead = barmerge.lookahead_off)

h50 = dOpen + adr * 0.50
l50 = dOpen - adr * 0.50
zoneHalf = adr * (zoneWidthPct / 100.0) / 2.0
newDay = ta.change(time("D")) != 0

isForex = syminfo.type == "forex"
unitSize = isForex ? syminfo.mintick * 10.0 : syminfo.mintick
unitName = isForex ? "pips" : "pts"
toUnits(float priceDiff) => unitSize > 0 ? priceDiff / unitSize : priceDiff

var line lnHigh = na
var line lnLow = na
var label lbHigh = na
var label lbLow = na
var box bxHigh = na
var box bxLow = na

if newDay
    lnHigh := line.new(bar_index, h50, bar_index, h50, color = colHigh, width = lineWidth, style = line.style_solid)
    lnLow := line.new(bar_index, l50, bar_index, l50, color = colLow, width = lineWidth, style = line.style_solid)
    bxHigh := box.new(bar_index, h50 + zoneHalf, bar_index, h50 - zoneHalf, border_color = na, bgcolor = showZones ? color.new(colHigh, zoneTransp) : na)
    bxLow := box.new(bar_index, l50 + zoneHalf, bar_index, l50 - zoneHalf, border_color = na, bgcolor = showZones ? color.new(colLow, zoneTransp) : na)
    lbHigh := label.new(bar_index, h50, "ADR H50", style = label.style_label_left, color = color.new(color.black, 100), textcolor = colHigh)
    lbLow := label.new(bar_index, l50, "ADR L50", style = label.style_label_left, color = color.new(color.black, 100), textcolor = colLow)

if not na(lnHigh)
    line.set_x2(lnHigh, bar_index)
    line.set_y1(lnHigh, h50)
    line.set_y2(lnHigh, h50)
    line.set_x2(lnLow, bar_index)
    line.set_y1(lnLow, l50)
    line.set_y2(lnLow, l50)
    box.set_right(bxHigh, bar_index)
    box.set_top(bxHigh, h50 + zoneHalf)
    box.set_bottom(bxHigh, h50 - zoneHalf)
    box.set_bgcolor(bxHigh, showZones ? color.new(colHigh, zoneTransp) : na)
    box.set_right(bxLow, bar_index)
    box.set_top(bxLow, l50 + zoneHalf)
    box.set_bottom(bxLow, l50 - zoneHalf)
    box.set_bgcolor(bxLow, showZones ? color.new(colLow, zoneTransp) : na)
    label.set_xy(lbHigh, bar_index, h50)
    label.set_text(lbHigh, showLabels ? "ADR H50  " + str.tostring(h50, format.mintick) : "")
    label.set_textcolor(lbHigh, showLabels ? colHigh : color.new(colHigh, 100))
    label.set_xy(lbLow, bar_index, l50)
    label.set_text(lbLow, showLabels ? "ADR L50  " + str.tostring(l50, format.mintick) : "")
    label.set_textcolor(lbLow, showLabels ? colLow : color.new(colLow, 100))

hasData = not na(adr)
adrCompletion = adr > 0 ? (todayRange / adr) * 100.0 : 0.0
completionCol = adrCompletion > 100 ? color.red : adrCompletion >= 50 ? color.yellow : color.lime
adrUnits = toUnits(adr)
rangeUnits = toUnits(todayRange)
distHigh = math.abs(toUnits(h50 - close))
distLow = math.abs(toUnits(close - l50))
adrDateStr = str.format_time(lastDayTime, "yyyy-MM-dd", syminfo.timezone)

var table dash = table.new(position.top_right, 2, 8, bgcolor = color.new(color.black, 75), frame_color = color.gray, frame_width = 1, border_color = color.new(color.gray, 50), border_width = 1)
if showDash and barstate.islast
    table.cell(dash, 0, 0, "ADR 50 SR Pro", text_color = color.aqua)
    table.cell(dash, 1, 0, unitName, text_color = color.gray)
    table.cell(dash, 0, 1, "ADR Period", text_color = color.silver)
    table.cell(dash, 1, 1, str.tostring(adrPeriod), text_color = color.white)
    table.cell(dash, 0, 2, "ADR Value", text_color = color.silver)
    table.cell(dash, 1, 2, str.tostring(adrUnits, "#.#") + " " + unitName, text_color = color.white)
    table.cell(dash, 0, 3, "Today Range", text_color = color.silver)
    table.cell(dash, 1, 3, str.tostring(rangeUnits, "#.#") + " " + unitName, text_color = color.white)
    table.cell(dash, 0, 4, "ADR Completion", text_color = color.silver)
    table.cell(dash, 1, 4, str.tostring(adrCompletion, "#") + "%", text_color = completionCol)
    table.cell(dash, 0, 5, "To H50", text_color = color.silver)
    table.cell(dash, 1, 5, showDistance ? str.tostring(distHigh, "#.#") + " " + unitName : "-", text_color = colHigh)
    table.cell(dash, 0, 6, "To L50", text_color = color.silver)
    table.cell(dash, 1, 6, showDistance ? str.tostring(distLow, "#.#") + " " + unitName : "-", text_color = colLow)
    table.cell(dash, 0, 7, showAdrDate ? "ADR Date" : "", text_color = color.silver)
    table.cell(dash, 1, 7, showAdrDate ? adrDateStr : "", text_color = color.white)

Overview

ADR 50 SR Pro plots horizontal level lines and customizable shaded zone boxes directly on the main price chart. Traders can adjust the ADR period, zone percentage width, line styling, and toggle display elements like labels, distance in pips or points, and an information dashboard panel.

Details

Published by

DEVfancybear on GitHub

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

Support & resistance, Volatility & bands, Screeners & dashboards

Markets

Any symbol

Timeframes

M15-H1

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

tradingviewalgorithmic-tradinggolangmarket-replaymetatrader5mt5nextjspostgresqlreactrisk-management

Settings

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

SettingTypeDefaultVariable
ADR Periodint10adrPeriod
Show LabelsbooltrueshowLabels
Show ZonesbooltrueshowZones
Zone Width % (of ADR)float2.0zoneWidthPct
Show DashboardbooltrueshowDash
Show ADR DatebooltrueshowAdrDate
Show DistancebooltrueshowDistance
Line Widthint2lineWidth
ADR H50 Colorcolorcolor.redcolHigh
ADR L50 Colorcolorcolor.greencolLow
Zone Transparencyint85zoneTransp
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

218 stars

This indicator maps market structure and supply and demand zones on the price chart. It marks validated and optional unvalidated swing highs and lows using a pivot length and extra confirmation bars. Consolidation and impulse moves are measured against ATR to

Indicator v6 SMC / ICT / price actionSupport & resistance Repaints
Updated 3 months ago · None stated GitHub repository of Market Structure + Supply/Demand
56 stars

This indicator marks forex trading sessions and opening ranges on the price chart. It can draw Sydney, Tokyo, Frankfurt, London, and New York session boxes or five- and fifteen-minute opening ranges, plus an optional opening channel and a day-open range. Day r

Indicator v5 Sessions & timeSupport & resistance Repaints
Updated 2 months ago · None stated GitHub repository of Day Trading Booster by DGT

ADR levels

by TamaraKGreen
46 stars

This indicator plots average daily range levels on the price chart, together with optional standard-deviation and Fibonacci levels scaled from that range. Users set the lookback in days, a scale factor, and the visibility, color, and line style of the ADR line

Indicator v5 Support & resistanceVolatility & bands
Updated 7 weeks ago · None stated GitHub repository of ADR levels
41 stars

ATR Matrix calculates Average True Range and a 50-period Simple Moving Average to display multi-tier volatility levels and risk-reward metrics. It project stop levels using negative ATR multiples from an entry price, alongside target levels from 0x to 11x ATR

Indicator v5 Volatility & bandsSupport & resistance

Zen Trading Toolkit

by Zen-Tim
29 stars

This indicator plots average bar range (ABR) measured move targets, opening range boxes, and historical key reference levels directly on the price chart. It projects bullish and bearish targets (0.5x, 1.0x, 1.5x, 2.0x ABR) from the previous session's close, al

Indicator v6 Support & resistanceVolatility & bands
Updated 2 weeks ago · MIT GitHub repository of Zen Trading Toolkit
20 stars

This indicator calculates a base moving average (EMA, SMA, WMA, or HMA) and projects multiple symmetrical envelope bands around it directly on the price chart. Users can adjust the length, source, moving average type, and initial envelope multiplier. Additiona

Indicator v5 Moving averagesVolatility & bands
Updated 1 year ago · None stated GitHub repository of Multiple Moving Average Envelope

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