本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
//@version=6
// ════════════════════════════════════════════════════════════════════════════════
// Trader's Compass — Key Levels · VWAP · Multi-Timeframe Trend · Volatility
//
// One overlay that answers the questions every trader asks before a trade:
// • WHERE are the levels? Previous day/week/month H/L, prior close, today's
// open, overnight H/L, opening range, ADR targets.
// Labels that sit close together are merged.
// • WHICH WAY is the trend? 5-timeframe trend + RSI dashboard and overall bias.
// • HOW MUCH room is left? Daily range vs ADR, % used, ADR projection levels.
// • IS anyone trading it? Relative volume, optional volume bar colouring.
// • WHERE is fair value? Anchored VWAP with ±1σ / ±2σ bands.
// • Liquidity sweeps of PDH/PDL, PWH/PWL and overnight H/L, plus alerts.
//
// Works on stocks, futures, forex and crypto, any intraday or daily chart.
// Higher-timeframe values use closed bars by default (no repainting).
// ════════════════════════════════════════════════════════════════════════════════
indicator("Trader's Compass — Key Levels, VWAP, MTF Trend & Volatility", shorttitle = "Compass", overlay = true, max_lines_count = 100, max_labels_count = 100)// ───────────────────────────────── Inputs ─────────────────────────────────
const string G_LV = "Key levels"
const string G_SS = "Sessions"
const string G_VW = "VWAP"
const string G_MT = "Multi-timeframe dashboard"
const string G_VO = "Volume & bar colours"
const string G_SW = "Liquidity sweeps"
const string G_EM = "Moving averages"
const string G_ST = "Style"
showDay = input.bool(true, "Previous day high / low / close", group = G_LV)
showDO = input.bool(true, "Today's open", group = G_LV)
showWeek = input.bool(true, "Previous week high / low", group = G_LV)
showMonth = input.bool(false, "Previous month high / low", group = G_LV)
showON = input.bool(true, "Overnight high / low", group = G_LV)
showOR = input.bool(true, "Opening range", group = G_LV)
orMin = input.int(15, "Opening range length (minutes)", minval = 1, maxval = 240, group = G_LV)
showADR = input.bool(true, "ADR projection levels", group = G_LV, tooltip = "Today's low + ADR and today's high − ADR: where an average day would end if it extended from here.")
adrLen = input.int(14, "ADR length (days)", minval = 1, group = G_LV)
showLbl = input.bool(true, "Level labels", group = G_LV)
showPrice = input.bool(true, "Show prices on labels", group = G_LV)
mergeAtr = input.float(0.25, "Merge labels closer than (× ATR)", minval = 0, step = 0.05, group = G_LV, tooltip = "Levels within this distance share one label, e.g. 'PDH · ONH'. 0 = never merge.")
extBars = input.int(15, "Extend lines right (bars)", minval = 0, maxval = 200, group = G_LV)
tz = input.string("America/New_York", "Session timezone", group = G_SS)
rthSess = input.session("0930-1600", "Regular session", group = G_SS, tooltip = "US stocks and index futures: 0930-1600 New York time.")
onSess = input.session("1800-0930", "Overnight session", group = G_SS, tooltip = "Futures: 1800-0930 New York time (Globex). Stocks: needs extended hours on the chart; use 0400-0930 for pre-market only.")
showVW = input.bool(true, "Show VWAP", group = G_VW)
vwAnchor = input.string("Session", "Anchor", options = ["Session", "Week", "Month"], group = G_VW)
showB1 = input.bool(true, "±1σ bands", group = G_VW)
showB2 = input.bool(true, "±2σ bands", group = G_VW)
showDash = input.bool(true, "Show dashboard", group = G_MT)
tf1 = input.timeframe("5", "Timeframe 1", group = G_MT)
tf2 = input.timeframe("15", "Timeframe 2", group = G_MT)
tf3 = input.timeframe("60", "Timeframe 3", group = G_MT)
tf4 = input.timeframe("240", "Timeframe 4", group = G_MT)
tf5 = input.timeframe("D", "Timeframe 5", group = G_MT)
trFast = input.int(21, "Trend EMA fast", minval = 2, group = G_MT)
trSlow = input.int(50, "Trend EMA slow", minval = 3, group = G_MT)
mtfConf = input.bool(true, "Use closed higher-timeframe bars (no repaint)", group = G_MT)
dashPos = input.string("Top right", "Position", options = ["Top right", "Top left", "Bottom right", "Bottom left", "Middle right"], group = G_MT)
dashSz = input.string("Small", "Text size", options = ["Tiny", "Small", "Normal"], group = G_MT)
rvolLen = input.int(20, "Relative volume lookback (bars)", minval = 2, group = G_VO)
rvolHi = input.float(2.0, "High relative volume ≥", minval = 1.0, step = 0.1, group = G_VO)
barMode = input.string("Off", "Colour bars by", options = ["Off", "Trend (fast/slow EMA)", "Relative volume"], group = G_VO)
showSweep = input.bool(true, "Mark sweeps of PDH/PDL, PWH/PWL, ONH/ONL", group = G_SW, tooltip = "A sweep is a bar that trades through a key level and closes back on the original side. Common stop-run / reversal tell.")
showEMA = input.bool(false, "Plot EMAs", group = G_EM)
emaLen1 = input.int(21, "EMA 1", minval = 1, group = G_EM)
emaLen2 = input.int(50, "EMA 2", minval = 1, group = G_EM)
emaLen3 = input.int(200, "EMA 3", minval = 1, group = G_EM)
cDay = input.color(#FF9800, "Previous day", group = G_ST)
cDO = input.color(#90A4AE, "Today's open", group = G_ST)
cWeek = input.color(#AB47BC, "Previous week", group = G_ST)
cMonth = input.color(#42A5F5, "Previous month", group = G_ST)
cON = input.color(#26A69A, "Overnight", group = G_ST)
cOR = input.color(#EC407A, "Opening range", group = G_ST)
cADR = input.color(#9E9E9E, "ADR projections", group = G_ST)
cVW = input.color(#2962FF, "VWAP", group = G_ST)
lineW = input.int(1, "Level line width", minval = 1, maxval = 4, group = G_ST)
lblSz = input.string("Small", "Label size", options = ["Tiny", "Small", "Normal"], group = G_ST)
// ───────────────────────────── Helpers ─────────────────────────────
f_size(string s) =>
s == "Tiny" ? size.tiny : s == "Normal" ? size.normal : size.small
f_pos(string p) =>
switch p
"Top left" => position.top_left
"Bottom right" => position.bottom_right
"Bottom left" => position.bottom_left
"Middle right" => position.middle_right
=> position.top_right
f_tfTxt(string tf) =>
int s = timeframe.in_seconds(tf)
s < 3600 ? str.tostring(math.round(s / 60)) + "m" : s < 86400 ? str.tostring(math.round(s / 3600)) + "H" : tf == "D" or tf == "1D" ? "D" : tf
// ───────────────────────────── Core series ─────────────────────────────
bool intra = timeframe.isintraday
int tfSec = timeframe.in_seconds()
bool dayOk = tfSec <= 86400
bool weekOk = tfSec <= 604800
float atrC = ta.atr(14)
[pdh, pdl, pdc, adr] = request.security(syminfo.tickerid, "D", [high[1], low[1], close[1], ta.atr(adrLen)[1]], lookahead = barmerge.lookahead_on)
dOpen = request.security(syminfo.tickerid, "D", open, lookahead = barmerge.lookahead_on)
[pwh, pwl] = request.security(syminfo.tickerid, "W", [high[1], low[1]], lookahead = barmerge.lookahead_on)
[pmh, pml] = request.security(syminfo.tickerid, "M", [high[1], low[1]], lookahead = barmerge.lookahead_on)
// Today's running range (tracked bar by bar: no look-ahead)
newDay = timeframe.change("D")
newWeek = timeframe.change("W")
newMonth = timeframe.change("M")
var float dHigh = na
var float dLow = na
var int dayBar = 0
var int weekBar = 0
var int monthBar = 0
if newDay
dHigh := high
dLow := low
dayBar := bar_index
else
dHigh := math.max(nz(dHigh, high), high)
dLow := math.min(nz(dLow, low), low)
if newWeek
weekBar := bar_index
if newMonth
monthBar := bar_index
// Overnight high / low
inON = intra and not na(time(timeframe.period, onSess, tz))
var float onH = na
var float onL = na
var int onBar = na
if inON and not inON[1]
onH := high
onL := low
onBar := bar_index
else if inON
onH := math.max(onH, high)
onL := math.min(onL, low)
// Regular session + opening range
inRTH = intra and not na(time(timeframe.period, rthSess, tz))
rthStart = inRTH and not inRTH[1]
var int orT0 = na
var float orH = na
var float orL = na
if rthStart
orT0 := time
orH := high
orL := low
else if inRTH and not na(orT0) and time < orT0 + orMin * 60000
orH := math.max(orH, high)
orL := math.min(orL, low)
orDone = inRTH and not na(orT0) and time >= orT0 + orMin * 60000
// VWAP with standard-deviation bands
anchorChg = vwAnchor == "Session" ? newDay : vwAnchor == "Week" ? newWeek : newMonth
[vw, vwU1, vwL1] = ta.vwap(hlc3, anchorChg, 1.0)
vwU2 = vw + 2 * (vwU1 - vw)
vwL2 = vw - 2 * (vw - vwL1)
// Relative volume
float vol = nz(volume)
float vAvg = ta.sma(vol, rvolLen)
float rvol = vAvg > 0 ? vol / vAvg : na
// Moving averages
emaA = ta.ema(close, emaLen1)
emaB = ta.ema(close, emaLen2)
emaC = ta.ema(close, emaLen3)
eTrF = ta.ema(close, trFast)
eTrS = ta.ema(close, trSlow)
// ───────────────────────────── Multi-timeframe trend ─────────────────────────────
// +2 strong up (close > fast > slow) · +1 up (close > slow) · 0 flat
// −1 down (close < slow) · −2 strong down (close < fast < slow)
f_trend() =>
float ef = ta.ema(close, trFast)
float es = ta.ema(close, trSlow)
int sc = close > ef and ef > es ? 2 : close > es ? 1 : close < ef and ef < es ? -2 : close < es ? -1 : 0
float r = ta.rsi(close, 14)
[mtfConf ? sc[1] : sc, mtfConf ? r[1] : r]
f_req(string tf) =>
request.security(syminfo.tickerid, tf, f_trend(), lookahead = mtfConf ? barmerge.lookahead_on : barmerge.lookahead_off)
[s1, r1] = f_req(tf1)
[s2, r2] = f_req(tf2)
[s3, r3] = f_req(tf3)
[s4, r4] = f_req(tf4)
[s5, r5] = f_req(tf5)
// ───────────────────────────── Liquidity sweeps ─────────────────────────────
f_swH(float lvl) =>
not na(lvl) and high > lvl and close < lvl and open < lvl
f_swL(float lvl) =>
not na(lvl) and low < lvl and close > lvl and open > lvl
swHigh = showSweep and barstate.isconfirmed and ((dayOk and f_swH(pdh)) or (weekOk and f_swH(pwh)) or (intra and not inON and f_swH(onH)))
swLow = showSweep and barstate.isconfirmed and ((dayOk and f_swL(pdl)) or (weekOk and f_swL(pwl)) or (intra and not inON and f_swL(onL)))
// ───────────────────────────── Plots ─────────────────────────────
bool vwOn = showVW and intra
color vwCol = anchorChg ? na : cVW
pVW = plot(vwOn ? vw : na, "VWAP", vwCol, 2)
pU1 = plot(vwOn and showB1 ? vwU1 : na, "VWAP +1σ", anchorChg ? na : color.new(cVW, 55), 1)
pL1 = plot(vwOn and showB1 ? vwL1 : na, "VWAP −1σ", anchorChg ? na : color.new(cVW, 55), 1)
pU2 = plot(vwOn and showB2 ? vwU2 : na, "VWAP +2σ", anchorChg ? na : color.new(cVW, 70), 1)
pL2 = plot(vwOn and showB2 ? vwL2 : na, "VWAP −2σ", anchorChg ? na : color.new(cVW, 70), 1)
fill(pU1, pL1, color.new(cVW, 95), "VWAP ±1σ fill")
fill(pU1, pU2, color.new(cVW, 97), "VWAP upper band fill")
fill(pL1, pL2, color.new(cVW, 97), "VWAP lower band fill")
bool orOn = showOR and inRTH and not na(orH)
pOH = plot(orOn ? orH : na, "Opening range high", rthStart ? na : cOR, 1, plot.style_linebr)
pOL = plot(orOn ? orL : na, "Opening range low", rthStart ? na : cOR, 1, plot.style_linebr)
fill(pOH, pOL, color.new(cOR, 92), "Opening range fill")
plot(showEMA ? emaA : na, "EMA 1", color.new(#00BCD4, 0), 1)
plot(showEMA ? emaB : na, "EMA 2", color.new(#FFC107, 0), 1)
plot(showEMA ? emaC : na, "EMA 3", color.new(#E91E63, 0), 2)
plotshape(swHigh, "Sweep of high", shape.triangledown, location.abovebar, color.new(#FF5252, 0), text = "sweep", textcolor = color.new(#FF5252, 0), size = size.tiny)
plotshape(swLow, "Sweep of low", shape.triangleup, location.belowbar, color.new(#00E676, 0), text = "sweep", textcolor = color.new(#00E676, 0), size = size.tiny)
color barCol = na
if barMode == "Trend (fast/slow EMA)"
barCol := close > eTrF and eTrF > eTrS ? #26A69A : close < eTrF and eTrF < eTrS ? #EF5350 : #787B86
else if barMode == "Relative volume" and not na(rvol) and rvol >= rvolHi
barCol := close >= open ? #00E676 : #FF1744
barcolor(barCol, title = "Bar colour")
// ───────────────────────────── Levels: lines, merged labels ─────────────────────────────
type Level
float price
string nm
color col
int x1
bool drawLine
string lstyle
f_add(array<Level> a, bool cond, float p, string nm, color c, int x1, bool dl, string st) =>
if cond and not na(p)
array.push(a, Level.new(p, nm, c, x1, dl, st))
f_lbl(int x, float p, string txt, color c) =>
label.new(x, p, showPrice ? txt + " " + str.tostring(p, format.mintick) : txt, style = label.style_label_left, color = color.new(c, 15), textcolor = color.white, size = f_size(lblSz))
var array<line> lvLines = array.new<line>()
var array<label> lvLabels = array.new<label>()
var table dash = table.new(f_pos(dashPos), 3, 13, bgcolor = color.new(#131722, 8), border_color = color.new(#2A2E39, 0), border_width = 1, frame_color = color.new(#2A2E39, 0), frame_width = 1)
f_scTxt(int s) =>
s == 2 ? "▲▲ Strong up" : s == 1 ? "▲ Up" : s == -1 ? "▼ Down" : s == -2 ? "▼▼ Strong down" : "• Flat"
f_scCol(int s) =>
s >= 2 ? #00E676 : s == 1 ? #66BB6A : s <= -2 ? #FF1744 : s == -1 ? #EF5350 : #B2B5BE
f_rsiCol(float r) =>
na(r) ? #B2B5BE : r >= 70 ? #FF5252 : r <= 30 ? #00E676 : #D1D4DC
f_cell(table t, int c, int r, string txt, color tc) =>
table.cell(t, c, r, txt, text_color = tc, text_size = f_size(dashSz), text_halign = c == 0 ? text.align_left : text.align_right)
if barstate.islast
// clear the previous drawing
for ln in lvLines
line.delete(ln)
array.clear(lvLines)
for lb in lvLabels
label.delete(lb)
array.clear(lvLabels)
int far = bar_index - 4900
int xd = math.max(dayBar, far)
int xw = math.max(weekBar, far)
int xm = math.max(monthBar, far)
int xo = math.max(nz(onBar, bar_index), far)
int xr = bar_index + extBars
array<Level> lv = array.new<Level>()
f_add(lv, showDay and dayOk, pdh, "PDH", cDay, xd, true, line.style_solid)
f_add(lv, showDay and dayOk, pdl, "PDL", cDay, xd, true, line.style_solid)
f_add(lv, showDay and dayOk, pdc, "PDC", cDay, xd, true, line.style_dotted)
f_add(lv, showDO and intra, dOpen, "Open", cDO, xd, true, line.style_dashed)
f_add(lv, showWeek and weekOk, pwh, "PWH", cWeek, xw, true, line.style_solid)
f_add(lv, showWeek and weekOk, pwl, "PWL", cWeek, xw, true, line.style_solid)
f_add(lv, showMonth, pmh, "PMH", cMonth, xm, true, line.style_solid)
f_add(lv, showMonth, pml, "PML", cMonth, xm, true, line.style_solid)
f_add(lv, showON and intra and not na(onBar), onH, "ONH", cON, xo, true, line.style_dashed)
f_add(lv, showON and intra and not na(onBar), onL, "ONL", cON, xo, true, line.style_dashed)
f_add(lv, orOn, orH, "ORH", cOR, bar_index, false, line.style_solid)
f_add(lv, orOn, orL, "ORL", cOR, bar_index, false, line.style_solid)
f_add(lv, showADR and dayOk and not na(adr), dLow + adr, "ADR high", cADR, xd, true, line.style_dotted)
f_add(lv, showADR and dayOk and not na(adr), dHigh - adr, "ADR low", cADR, xd, true, line.style_dotted)
f_add(lv, vwOn and not na(vw), vw, "VWAP", cVW, bar_index, false, line.style_solid)
// lines
for l in lv
if l.drawLine
array.push(lvLines, line.new(l.x1, l.price, xr, l.price, color = l.col, style = l.lstyle, width = lineW))
// merged labels (sorted by price, grouped when closer than mergeAtr × ATR)
int n = array.size(lv)
if showLbl and n > 0
array<float> prices = array.new<float>()
for l in lv
array.push(prices, l.price)
array<int> idx = array.sort_indices(prices, order.ascending)
float mergeD = mergeAtr * nz(atrC)
float gP = na
color gC = na
string txt = ""
for k = 0 to n - 1
Level l = array.get(lv, array.get(idx, k))
if na(gP) or math.abs(l.price - gP) > mergeD
if not na(gP)
array.push(lvLabels, f_lbl(xr, gP, txt, gC))
gP := l.price
gC := l.col
txt := l.nm
else
txt := txt + " · " + l.nm
array.push(lvLabels, f_lbl(xr, gP, txt, gC))
// nearest level above / below price
float upP = na
float dnP = na
string upN = "—"
string dnN = "—"
for l in lv
if l.price > close and (na(upP) or l.price < upP)
upP := l.price
upN := l.nm
if l.price < close and (na(dnP) or l.price > dnP)
dnP := l.price
dnN := l.nm
// dashboard
if showDash
color w = #D1D4DC
color dim = #8A8F9C
f_cell(dash, 0, 0, "Compass", color.white)
f_cell(dash, 1, 0, syminfo.ticker + " · " + f_tfTxt(timeframe.period), dim)
f_cell(dash, 2, 0, "RSI", dim)
f_cell(dash, 0, 1, f_tfTxt(tf1), w)
f_cell(dash, 1, 1, f_scTxt(s1), f_scCol(s1))
f_cell(dash, 2, 1, na(r1) ? "—" : str.tostring(r1, "#"), f_rsiCol(r1))
f_cell(dash, 0, 2, f_tfTxt(tf2), w)
f_cell(dash, 1, 2, f_scTxt(s2), f_scCol(s2))
f_cell(dash, 2, 2, na(r2) ? "—" : str.tostring(r2, "#"), f_rsiCol(r2))
f_cell(dash, 0, 3, f_tfTxt(tf3), w)
f_cell(dash, 1, 3, f_scTxt(s3), f_scCol(s3))
f_cell(dash, 2, 3, na(r3) ? "—" : str.tostring(r3, "#"), f_rsiCol(r3))
f_cell(dash, 0, 4, f_tfTxt(tf4), w)
f_cell(dash, 1, 4, f_scTxt(s4), f_scCol(s4))
f_cell(dash, 2, 4, na(r4) ? "—" : str.tostring(r4, "#"), f_rsiCol(r4))
f_cell(dash, 0, 5, f_tfTxt(tf5), w)
f_cell(dash, 1, 5, f_scTxt(s5), f_scCol(s5))
f_cell(dash, 2, 5, na(r5) ? "—" : str.tostring(r5, "#"), f_rsiCol(r5))
int total = nz(s1) + nz(s2) + nz(s3) + nz(s4) + nz(s5)
string biasTxt = total >= 6 ? "BULLISH" : total >= 2 ? "Leaning bullish" : total <= -6 ? "BEARISH" : total <= -2 ? "Leaning bearish" : "Mixed / range"
color biasCol = total >= 6 ? #00E676 : total >= 2 ? #66BB6A : total <= -6 ? #FF1744 : total <= -2 ? #EF5350 : #B2B5BE
f_cell(dash, 0, 6, "Bias", w)
f_cell(dash, 1, 6, biasTxt, biasCol)
f_cell(dash, 2, 6, (total > 0 ? "+" : "") + str.tostring(total), biasCol)
float rngNow = dHigh - dLow
float adrPct = adr > 0 ? rngNow / adr * 100 : na
f_cell(dash, 0, 7, "Day range / ADR", w)
f_cell(dash, 1, 7, na(adr) ? "—" : str.tostring(rngNow, format.mintick) + " / " + str.tostring(adr, format.mintick), w)
f_cell(dash, 2, 7, na(adrPct) ? "—" : str.tostring(adrPct, "#") + "%", na(adrPct) ? w : adrPct >= 100 ? #FF5252 : adrPct >= 75 ? #FFB74D : #66BB6A)
f_cell(dash, 0, 8, "Rel. volume", w)
f_cell(dash, 1, 8, na(rvol) ? "n/a" : str.tostring(rvol, "#.0") + "×", na(rvol) ? dim : rvol >= rvolHi ? #FFB74D : w)
f_cell(dash, 2, 8, "", w)
float vwD = vwOn and not na(vw) and atrC > 0 ? (close - vw) / atrC : na
f_cell(dash, 0, 9, "vs VWAP", w)
f_cell(dash, 1, 9, na(vwD) ? "—" : vwD >= 0 ? "Above" : "Below", na(vwD) ? dim : vwD >= 0 ? #66BB6A : #EF5350)
f_cell(dash, 2, 9, na(vwD) ? "" : (vwD >= 0 ? "+" : "") + str.tostring(vwD, "#.0") + " ATR", dim)
f_cell(dash, 0, 10, "Next resistance", w)
f_cell(dash, 1, 10, upN, #EF9A9A)
f_cell(dash, 2, 10, na(upP) ? "" : "+" + str.tostring(upP - close, format.mintick), dim)
f_cell(dash, 0, 11, "Next support", w)
f_cell(dash, 1, 11, dnN, #A5D6A7)
f_cell(dash, 2, 11, na(dnP) ? "" : "−" + str.tostring(close - dnP, format.mintick), dim)
f_cell(dash, 0, 12, "Session", w)
f_cell(dash, 1, 12, not intra ? "—" : inRTH ? (orDone ? "Regular" : "Opening range") : inON ? "Overnight" : "Closed / other", dim)
f_cell(dash, 2, 12, "", w)
// ───────────────────────────── Alerts ─────────────────────────────
adrHit = not na(adr) and (dHigh - dLow) >= adr and (dHigh[1] - dLow[1]) < adr and not newDay
xPDH = ta.crossover(close, pdh)
xPDL = ta.crossunder(close, pdl)
xONH = ta.crossover(close, onH)
xONL = ta.crossunder(close, onL)
xORH = ta.crossover(close, orH)
xORL = ta.crossunder(close, orL)
xVWu = ta.crossover(close, vw)
xVWd = ta.crossunder(close, vw)
alertcondition(xPDH, "Price crossed above previous day high", "{{ticker}} crossed above the previous day high")
alertcondition(xPDL, "Price crossed below previous day low", "{{ticker}} crossed below the previous day low")
alertcondition(xONH, "Price crossed above overnight high", "{{ticker}} crossed above the overnight high")
alertcondition(xONL, "Price crossed below overnight low", "{{ticker}} crossed below the overnight low")
alertcondition(orDone and xORH, "Opening range breakout", "{{ticker}} broke above the opening range")
alertcondition(orDone and xORL, "Opening range breakdown", "{{ticker}} broke below the opening range")
alertcondition(xVWu, "Price crossed above VWAP", "{{ticker}} crossed above VWAP")
alertcondition(xVWd, "Price crossed below VWAP", "{{ticker}} crossed below VWAP")
alertcondition(swHigh, "Liquidity sweep of a high", "{{ticker}} swept a key high and closed back below it")
alertcondition(swLow, "Liquidity sweep of a low", "{{ticker}} swept a key low and closed back above it")
alertcondition(adrHit, "Average daily range reached", "{{ticker}} has used 100% of its average daily range")
alertcondition(not na(rvol) and rvol >= rvolHi and barstate.isconfirmed, "High relative volume bar", "{{ticker}} printed a high relative volume bar")