OPEN-SOURCE SCRIPT
Daily ATR% Dashboard george_pirlog

//version=6
indicator("ATR(14) – Daily + % vs Daily Close & Current (Heat + Alerts)", overlay=true)
// ── Inputs
atrLen = input.int(14, "ATR Length")
tfATR = input.timeframe("D", "ATR Timeframe (for ATR & daily close)")
decATR = input.int(2, "Decimals (ATR)", minval=0, maxval=6)
decPct = input.int(2, "Decimals (%)", minval=0, maxval=6)
pos = input.string("Top Right", "Table Position", options=["Top Left","Top Right","Bottom Left","Bottom Right"])
bgAlpha = input.int(75, "Table BG Transparency (0-100)", minval=0, maxval=100)
showLabel = input.bool(false, "Show floating label")
yOffsetATR = input.float(0.25, "Label Y offset (× ATR)", step=0.05)
// Praguri culoare / alerte
warnPct = input.float(2.0, "Warn Threshold % (yellow/orange)", step=0.1)
highPct = input.float(3.0, "High Threshold % (red)", step=0.1)
// ── Helpers
f_pos(p) =>
if p == "Top Left"
position.top_left
else if p == "Top Right"
position.top_right
else if p == "Bottom Left"
position.bottom_left
else
position.bottom_right
f_heatColor(pct) =>
if pct >= highPct
color.new(color.red, 0)
else if pct >= warnPct
color.new(color.orange, 0)
else
color.new(color.teal, 0)
// ── Serii daily
atrDaily = request.security(syminfo.tickerid, tfATR, ta.atr(atrLen))
closeD = request.security(syminfo.tickerid, tfATR, close)
// ── Ultima valoare & procente
atrLast = atrDaily
pctOfDailyClose = atrLast / closeD * 100
pctOfCurrent = atrLast / close * 100
// ── Tabel static (3×2)
var table box = table.new(f_pos(pos), 3, 2, border_width=1, frame_color=color.new(color.gray, 0), bgcolor=color.new(color.black, bgAlpha))
if barstate.islast
table.cell(box, 0, 0, "ATR14 (Last D)", text_color=color.white, text_size=size.small, bgcolor=color.new(color.black, bgAlpha))
table.cell(box, 1, 0, "% of Daily Close", text_color=color.white, text_size=size.small, bgcolor=color.new(color.black, bgAlpha))
table.cell(box, 2, 0, "% of Current", text_color=color.white, text_size=size.small, bgcolor=color.new(color.black, bgAlpha))
table.cell(box, 0, 1, str.tostring(atrLast, "0." + str.repeat("0", decATR)), text_color=color.white, bgcolor=color.new(color.black, bgAlpha))
table.cell(box, 1, 1, str.tostring(pctOfDailyClose, "0." + str.repeat("0", decPct)) + "%", text_color=f_heatColor(pctOfDailyClose), bgcolor=color.new(color.black, bgAlpha))
table.cell(box, 2, 1, str.tostring(pctOfCurrent, "0." + str.repeat("0", decPct)) + "%", text_color=f_heatColor(pctOfCurrent), bgcolor=color.new(color.black, bgAlpha))
// ── Etichetă opțională (apel pe o singură linie)
var label info = na
if showLabel and barstate.islast
label.delete(info)
txt = "ATR14 (Last D): " + str.tostring(atrLast, "0." + str.repeat("0", decATR)) +
"\nvs Daily Close: " + str.tostring(pctOfDailyClose, "0." + str.repeat("0", decPct)) + "%" +
"\nvs Current: " + str.tostring(pctOfCurrent, "0." + str.repeat("0", decPct)) + "%"
info := label.new(x=bar_index, y=close + atrLast * yOffsetATR, text=txt, xloc=xloc.bar_index, yloc=yloc.price, style=label.style_label_left, textcolor=color.white, color=color.new(color.black, 0), size=size.normal)
// ── Alerts (cross peste praguri)
dailyWarnUp = ta.crossover(pctOfDailyClose, warnPct)
dailyHighUp = ta.crossover(pctOfDailyClose, highPct)
currWarnUp = ta.crossover(pctOfCurrent, warnPct)
currHighUp = ta.crossover(pctOfCurrent, highPct)
alertcondition(dailyWarnUp, "Daily % crossed WARN", "ATR% vs Daily Close crossed above WARN threshold")
alertcondition(dailyHighUp, "Daily % crossed HIGH", "ATR% vs Daily Close crossed above HIGH threshold")
alertcondition(currWarnUp, "Current % crossed WARN", "ATR% vs Current Price crossed above WARN threshold")
alertcondition(currHighUp, "Current % crossed HIGH", "ATR% vs Current Price crossed above HIGH threshold")
indicator("ATR(14) – Daily + % vs Daily Close & Current (Heat + Alerts)", overlay=true)
// ── Inputs
atrLen = input.int(14, "ATR Length")
tfATR = input.timeframe("D", "ATR Timeframe (for ATR & daily close)")
decATR = input.int(2, "Decimals (ATR)", minval=0, maxval=6)
decPct = input.int(2, "Decimals (%)", minval=0, maxval=6)
pos = input.string("Top Right", "Table Position", options=["Top Left","Top Right","Bottom Left","Bottom Right"])
bgAlpha = input.int(75, "Table BG Transparency (0-100)", minval=0, maxval=100)
showLabel = input.bool(false, "Show floating label")
yOffsetATR = input.float(0.25, "Label Y offset (× ATR)", step=0.05)
// Praguri culoare / alerte
warnPct = input.float(2.0, "Warn Threshold % (yellow/orange)", step=0.1)
highPct = input.float(3.0, "High Threshold % (red)", step=0.1)
// ── Helpers
f_pos(p) =>
if p == "Top Left"
position.top_left
else if p == "Top Right"
position.top_right
else if p == "Bottom Left"
position.bottom_left
else
position.bottom_right
f_heatColor(pct) =>
if pct >= highPct
color.new(color.red, 0)
else if pct >= warnPct
color.new(color.orange, 0)
else
color.new(color.teal, 0)
// ── Serii daily
atrDaily = request.security(syminfo.tickerid, tfATR, ta.atr(atrLen))
closeD = request.security(syminfo.tickerid, tfATR, close)
// ── Ultima valoare & procente
atrLast = atrDaily
pctOfDailyClose = atrLast / closeD * 100
pctOfCurrent = atrLast / close * 100
// ── Tabel static (3×2)
var table box = table.new(f_pos(pos), 3, 2, border_width=1, frame_color=color.new(color.gray, 0), bgcolor=color.new(color.black, bgAlpha))
if barstate.islast
table.cell(box, 0, 0, "ATR14 (Last D)", text_color=color.white, text_size=size.small, bgcolor=color.new(color.black, bgAlpha))
table.cell(box, 1, 0, "% of Daily Close", text_color=color.white, text_size=size.small, bgcolor=color.new(color.black, bgAlpha))
table.cell(box, 2, 0, "% of Current", text_color=color.white, text_size=size.small, bgcolor=color.new(color.black, bgAlpha))
table.cell(box, 0, 1, str.tostring(atrLast, "0." + str.repeat("0", decATR)), text_color=color.white, bgcolor=color.new(color.black, bgAlpha))
table.cell(box, 1, 1, str.tostring(pctOfDailyClose, "0." + str.repeat("0", decPct)) + "%", text_color=f_heatColor(pctOfDailyClose), bgcolor=color.new(color.black, bgAlpha))
table.cell(box, 2, 1, str.tostring(pctOfCurrent, "0." + str.repeat("0", decPct)) + "%", text_color=f_heatColor(pctOfCurrent), bgcolor=color.new(color.black, bgAlpha))
// ── Etichetă opțională (apel pe o singură linie)
var label info = na
if showLabel and barstate.islast
label.delete(info)
txt = "ATR14 (Last D): " + str.tostring(atrLast, "0." + str.repeat("0", decATR)) +
"\nvs Daily Close: " + str.tostring(pctOfDailyClose, "0." + str.repeat("0", decPct)) + "%" +
"\nvs Current: " + str.tostring(pctOfCurrent, "0." + str.repeat("0", decPct)) + "%"
info := label.new(x=bar_index, y=close + atrLast * yOffsetATR, text=txt, xloc=xloc.bar_index, yloc=yloc.price, style=label.style_label_left, textcolor=color.white, color=color.new(color.black, 0), size=size.normal)
// ── Alerts (cross peste praguri)
dailyWarnUp = ta.crossover(pctOfDailyClose, warnPct)
dailyHighUp = ta.crossover(pctOfDailyClose, highPct)
currWarnUp = ta.crossover(pctOfCurrent, warnPct)
currHighUp = ta.crossover(pctOfCurrent, highPct)
alertcondition(dailyWarnUp, "Daily % crossed WARN", "ATR% vs Daily Close crossed above WARN threshold")
alertcondition(dailyHighUp, "Daily % crossed HIGH", "ATR% vs Daily Close crossed above HIGH threshold")
alertcondition(currWarnUp, "Current % crossed WARN", "ATR% vs Current Price crossed above WARN threshold")
alertcondition(currHighUp, "Current % crossed HIGH", "ATR% vs Current Price crossed above HIGH threshold")
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.