本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
//@version=6
indicator(title = "Adaptive Opening Range Breakout Pyramid", shorttitle = "AORB Pyramid", overlay = true, max_boxes_count = 500, max_lines_count = 500, max_labels_count = 500)
// ═══════════════════════════════ INPUTS ═══════════════════════════════
grpR = "Opening Range"
orSess = input.session("0930-1000", "Opening Range Session", group = grpR, tooltip = "Time window that builds the opening range high and low, in the timezone below. Longer window = wider levels and fewer breakouts. Shorter window = tighter levels and more, noisier breakouts.")
winSess = input.session("1000-1530", "Trade Window", group = grpR, tooltip = "Window in which new entries and pyramid adds are allowed. Its end time is also used by the end-of-window exit. Shorter window = fewer late, lower-quality entries.")
tzIn = input.string("America/New_York", "Session Timezone", group = grpR, tooltip = "IANA timezone for both sessions, e.g. America/New_York, Europe/London, Asia/Bangkok. Must match the market open you want to trade.")
daysIn = input.string("23456", "Session Days", group = grpR, tooltip = "Active days: 1 = Sunday ... 7 = Saturday. Default 23456 = Monday to Friday. Use 1234567 for markets that trade every day, such as crypto.")
grpS = "Breakout Signal"
useBuffer = input.bool(true, "ATR Breakout Buffer", group = grpS, tooltip = "Require the close to clear the range level by a fraction of ATR instead of a single tick. Filters marginal fake breakouts but enters slightly later.")
bufMul = input.float(0.10, "Buffer (x ATR)", minval = 0.0, step = 0.05, group = grpS, tooltip = "Breakout buffer = ATR x this value. Higher = stronger confirmation, fewer and later signals. Lower = earlier signals, more fake breakouts.")
atrLen = input.int(14, "ATR Length", minval = 1, group = grpS, tooltip = "ATR length used by the breakout buffer and label placement. Higher = smoother, slower-changing ATR.")
useBody = input.bool(true, "Strong Candle Filter", group = grpS, tooltip = "The breakout candle must close in the breakout direction with a solid body. Rejects wick-driven or indecisive breakouts.")
bodyMin = input.float(0.5, "Min Body / Range", minval = 0.0, maxval = 1.0, step = 0.05, group = grpS, tooltip = "Minimum candle body as a fraction of its high-low range. Higher = only strong momentum candles qualify, fewer signals.")
allowRev = input.bool(true, "Allow Reverse After Failed Breakout", group = grpS, tooltip = "After the first trade of the day closes, allow one breakout in the opposite direction. Captures failed-breakout reversals but adds a second trade per day.")
grpT = "Trade"
stopMode = input.string("OR Midpoint", "Stop Loss Mode", options = ["Breakout Candle", "OR Midpoint", "OR Opposite Side"], group = grpT, tooltip = "Breakout Candle = tightest stop, most stop-outs. OR Midpoint = balanced. OR Opposite Side = widest stop, fewer stop-outs but smaller targets in R terms.")
rr = input.float(2.0, "Risk / Reward", minval = 0.1, step = 0.1, group = grpT, tooltip = "Target distance as a multiple of the initial risk. Higher = bigger wins but lower hit rate.")
useEod = input.bool(true, "End-of-Window Exit", group = grpT, tooltip = "Close any open trade at the end of the Trade Window (or at the next session open if no bar closed there). Prevents overnight holding.")
grpF = "Weakness Fixes"
useConfirmed = input.bool(true, "Confirmed Bars Only (No Repaint)", group = grpF, tooltip = "Entries and pyramid adds are generated only after the bar closes, so signals never appear and vanish on the live bar.")
useWidth = input.bool(true, "Adaptive Range Width Filter", group = grpF, tooltip = "Skip days whose opening range is unusually narrow or wide compared with the average of recent sessions. Avoids dead or overextended opens.")
widthLen = input.int(20, "Width Lookback (Sessions)", minval = 3, group = grpF, tooltip = "Number of past sessions used for the average range width. Higher = more stable reference, slower to adapt.")
minW = input.float(0.5, "Min Width (x Average)", minval = 0.0, step = 0.05, group = grpF, tooltip = "Skip the day if the range is narrower than average x this value. Higher = skip more quiet days.")
maxW = input.float(2.0, "Max Width (x Average)", minval = 0.1, step = 0.1, group = grpF, tooltip = "Skip the day if the range is wider than average x this value. Lower = skip more volatile, already-extended opens.")
useTrend = input.bool(true, "Trend Filter", group = grpF, tooltip = "Long only when close is above the trend reference, short only when below. Reduces counter-trend breakouts but can miss early reversals.")
trendSrc = input.string("VWAP", "Trend Reference", options = ["VWAP", "EMA"], group = grpF, tooltip = "VWAP = intraday session fair value (falls back to EMA if no volume). EMA = moving average of the length below.")
emaLen = input.int(50, "Trend EMA Length", minval = 2, group = grpF, tooltip = "EMA length for the trend filter or VWAP fallback. Higher = slower trend definition.")
useVol = input.bool(true, "Volume Filter", group = grpF, tooltip = "Breakout candle volume must exceed its average by the multiplier. Ignored automatically on symbols without volume.")
volLen = input.int(20, "Volume Average Length", minval = 1, group = grpF, tooltip = "SMA length of volume used as the baseline. Higher = smoother baseline.")
volMul = input.float(1.2, "Volume Multiplier", minval = 0.1, step = 0.1, group = grpF, tooltip = "Required breakout volume = average x this value. Higher = only high-participation breakouts, fewer signals.")
grpP = "Pyramid Orders"
usePyr = input.bool(true, "Enable Pyramid", group = grpP, tooltip = "Allow extra orders in the active trade direction when price moves the set distance from the last order, inside the Trade Window.")
maxOrders = input.int(3, "Max Orders Per Side", minval = 1, maxval = 10, group = grpP, tooltip = "Total orders per trade including the first breakout entry. Higher = larger possible position and risk.")
pyrDir = input.string("With Trend (Scale In)", "Pyramid Direction", options = ["With Trend (Scale In)", "Against (Average In)"], group = grpP, tooltip = "Scale In: add Buy when price rises (Sell when it falls) by the step. Average In: add Buy when price drops (Sell when it rises), still above the stop.")
distMode = input.string("ATR", "Step Distance Mode", options = ["ATR", "Ticks"], group = grpP, tooltip = "Measure spacing between pyramid orders in ATR multiples (adapts to volatility) or a fixed number of ticks.")
distTicks = input.int(100, "Step Distance (Ticks)", minval = 1, group = grpP, tooltip = "Distance in ticks (syminfo.mintick) between orders when mode is Ticks. Higher = fewer, wider-spaced adds.")
distAtrLen = input.int(14, "Step ATR Length", minval = 1, group = grpP, tooltip = "ATR length for the step distance when mode is ATR. Higher = steadier step size.")
distAtrMul = input.float(0.75, "Step ATR Multiplier", minval = 0.1, step = 0.05, group = grpP, tooltip = "Step distance = ATR x this value. Higher = fewer, wider-spaced pyramid adds.")
grpV = "Visuals"
showRange = input.bool(true, "Show Opening Range", group = grpV, tooltip = "Draw the range box plus high, low and midpoint lines extended through the trade window. Skipped days are shown in gray.")
showGrid = input.bool(true, "Show Trade Grid", group = grpV, tooltip = "Draw risk and reward zones with stop, average entry and target lines for each trade.")
showLabels = input.bool(true, "Show Order Labels", group = grpV, tooltip = "Show B1, B2... / S1, S2... order labels and TP / SL / EOD exit labels with the trade result in R.")
showStats = input.bool(true, "Show Statistics Table", group = grpV, tooltip = "Show a table with closed trades, exit types, win rate, total R and today's range status.")
highlightBar = input.bool(true, "Highlight Breakout Candle", group = grpV, tooltip = "Color the entry candle green for Buy and red for Sell.")
bullCol = input.color(color.rgb(0, 200, 120), "Bullish Color", group = grpV, tooltip = "Color for Buy orders, reward zone and take-profit labels.")
bearCol = input.color(color.rgb(230, 70, 70), "Bearish Color", group = grpV, tooltip = "Color for Sell orders, risk zone and stop-loss labels.")
rangeCol = input.color(color.rgb(41, 121, 255), "Range Color", group = grpV, tooltip = "Color of the opening range box and level lines.")
entryCol = input.color(color.rgb(230, 230, 230), "Entry Line Color", group = grpV, tooltip = "Color of the average entry line, which moves when pyramid orders are added.")
rangeTransp = input.int(88, "Range Transparency", minval = 0, maxval = 100, group = grpV, tooltip = "Fill transparency of the range box. Higher = more transparent.")
zoneTransp = input.int(80, "Zone Transparency", minval = 0, maxval = 100, group = grpV, tooltip = "Fill transparency of risk and reward zones. Higher = more transparent.")
// ═══════════════════════════════ SESSION SETUP ═══════════════════════════════
f_mins(string s, int pos) =>
int(str.tonumber(str.substring(s, pos, pos + 2))) * 60 + int(str.tonumber(str.substring(s, pos + 2, pos + 4)))
f_dayTs(int mins) =>
timestamp(tzIn, year(time, tzIn), month(time, tzIn), dayofmonth(time, tzIn), math.floor(mins / 60), mins % 60)
int orStartMin = f_mins(orSess, 0)
int orEndMin = f_mins(orSess, 5)
int winEndMin = f_mins(winSess, 5)
string orSessFull = orSess + ":" + daysIn
string winSessFull = winSess + ":" + daysIn
if barstate.isfirst
if not timeframe.isintraday
runtime.error("Use an intraday timeframe (e.g. 1, 5, 15 minutes).")
if orEndMin <= orStartMin
runtime.error("Opening Range Session must start and end on the same day, e.g. 0930-1000.")
if timeframe.in_seconds() > (orEndMin - orStartMin) * 60
runtime.error("Chart timeframe is longer than the Opening Range. Use a timeframe equal to or shorter than the range length.")
if not chart.is_standard
runtime.error("Use a standard OHLC chart. Heikin Ashi, Renko and other synthetic charts are not supported.")
bool inOR = not na(time(timeframe.period, orSessFull, tzIn))
bool inWin = not na(time(timeframe.period, winSessFull, tzIn))
bool orStart = inOR and not inOR[1]
int orStartTs = f_dayTs(orStartMin)
int orEndTs = f_dayTs(orEndMin)
int winEndTs = f_dayTs(winEndMin)
// ═══════════════════════════════ GLOBAL SERIES ═══════════════════════════════
float atrV = ta.atr(atrLen)
float stepAtr = ta.atr(distAtrLen) * distAtrMul
float vwapV = ta.vwap(hlc3)
float emaV = ta.ema(close, emaLen)
float volSma = ta.sma(volume, volLen)
// ═══════════════════════════════ STATE ═══════════════════════════════
var float orH = na
var float orL = na
var bool orValid = false
var bool orReady = false
var bool rangeOk = true
var int orStartBar = na
var box orBox = na
var line hiLine = na
var line loLine = na
var line midLine = na
var bool longUsed = false
var bool shortUsed = false
var string orStatus = "Waiting"
var array<float> widths = array.new_float()
var bool tActive = false
var int tDir = 0
var float tStop = na
var float tTarget = na
var float tRisk = na
var int tEntryBar = na
var float lastOrderPx = na
var int orderCount = 0
var array<float> entries = array.new_float()
var box riskBox = na
var box rewardBox = na
var line avgLine = na
var line stopLine = na
var line tgtLine = na
var int statTrades = 0
var int statTP = 0
var int statSL = 0
var int statEOD = 0
var int statWin = 0
var float statR = 0.0
// ═══════════════════════════════ OPENING RANGE BUILD ═══════════════════════════════
if orStart
orH := high
orL := low
// FIX: partial range protection — the first bar must start exactly at the range start time
orValid := time == orStartTs
orReady := false
rangeOk := true
longUsed := false
shortUsed := false
orStartBar := bar_index
orStatus := "Building"
hiLine := na
loLine := na
midLine := na
orBox := showRange ? box.new(bar_index, high, bar_index + 1, low, border_color = rangeCol, border_width = 1, bgcolor = color.new(rangeCol, rangeTransp)) : na
else if inOR and not orReady and not na(orH)
orH := math.max(orH, high)
orL := math.min(orL, low)
if inOR and not orReady and not na(orBox)
box.set_right(orBox, bar_index + 1)
box.set_top(orBox, orH)
box.set_bottom(orBox, orL)
bool orCompleteNow = false
if inOR and not orReady and not na(orH) and time_close >= orEndTs
orReady := true
orCompleteNow := true
float w = orH - orL
if orValid and w > 0
int n = array.size(widths)
float avgW = n > 0 ? array.avg(widths) : na
// FIX: adaptive width filter — skip abnormally narrow / wide opening ranges
rangeOk := not useWidth or n < 3 or (w >= avgW * minW and w <= avgW * maxW)
array.push(widths, w)
if array.size(widths) > widthLen
array.shift(widths)
else
orValid := false
orStatus := not orValid ? "Invalid (partial)" : rangeOk ? "Active" : "Skipped (width)"
if not orValid and not na(orBox)
box.delete(orBox)
else if orValid and showRange
color lvlCol = rangeOk ? rangeCol : color.gray
if not rangeOk and not na(orBox)
box.set_border_color(orBox, color.gray)
box.set_bgcolor(orBox, color.new(color.gray, rangeTransp))
hiLine := line.new(bar_index, orH, bar_index + 1, orH, color = lvlCol, width = 2)
loLine := line.new(bar_index, orL, bar_index + 1, orL, color = lvlCol, width = 2)
midLine := line.new(bar_index, (orH + orL) / 2, bar_index + 1, (orH + orL) / 2, color = color.new(lvlCol, 40), width = 1, style = line.style_dotted)
orBox := na
// Extend range levels through the trade window
if not orCompleteNow and not na(hiLine) and (inWin or inOR)
line.set_x2(hiLine, bar_index + 1)
line.set_x2(loLine, bar_index + 1)
line.set_x2(midLine, bar_index + 1)
// ═══════════════════════════════ ACTIVE TRADE GRID ═══════════════════════════════
if tActive and showGrid
int rgt = bar_index + 1
if not na(riskBox)
box.set_right(riskBox, rgt)
if not na(rewardBox)
box.set_right(rewardBox, rgt)
if not na(avgLine)
line.set_x2(avgLine, rgt)
if not na(stopLine)
line.set_x2(stopLine, rgt)
if not na(tgtLine)
line.set_x2(tgtLine, rgt)
// ═══════════════════════════════ EXITS ═══════════════════════════════
bool tpExit = false
bool slExit = false
bool eodExit = false
bool closedNow = false
float exitPx = na
if tActive and bar_index > tEntryBar
if useEod and orStart
// FIX: no overnight holding — trade still open at the next session start exits at the open
eodExit := true
exitPx := open
else if barstate.isconfirmed
bool sHit = tDir == 1 ? low <= tStop : high >= tStop
bool tHit = tDir == 1 ? high >= tTarget : low <= tTarget
if sHit
// FIX: stop has priority when SL and TP touch the same bar (conservative)
slExit := true
// FIX: gap-aware stop fill — a gap through the stop fills at the open
exitPx := tDir == 1 ? math.min(open, tStop) : math.max(open, tStop)
else if tHit
tpExit := true
exitPx := tTarget
else if useEod and inWin and time_close >= winEndTs
eodExit := true
exitPx := close
if slExit or tpExit or eodExit
closedNow := true
// Result in R, measured per order against the initial risk of the first entry
float sumR = 0.0
for e in entries
sumR += (exitPx - e) * tDir / tRisk
statTrades += 1
statR += sumR
if sumR > 0
statWin += 1
if slExit
statSL += 1
else if tpExit
statTP += 1
else
statEOD += 1
if showLabels
string exitTxt = (slExit ? "SL" : tpExit ? "TP" : "EOD") + "\n" + str.tostring(sumR, "#.##") + "R"
color exitCol = sumR > 0 ? bullCol : sumR < 0 ? bearCol : color.gray
bool below = tDir == 1 ? slExit or (eodExit and sumR <= 0) : tpExit or (eodExit and sumR > 0)
label.new(bar_index, below ? low : high, exitTxt, style = below ? label.style_label_up : label.style_label_down, color = exitCol, textcolor = color.white, size = size.small)
if showGrid
int ex = eodExit and orStart ? bar_index : bar_index + 1
if not na(riskBox)
box.set_right(riskBox, ex)
if not na(rewardBox)
box.set_right(rewardBox, ex)
if not na(avgLine)
line.set_x2(avgLine, ex)
if not na(stopLine)
line.set_x2(stopLine, ex)
if not na(tgtLine)
line.set_x2(tgtLine, ex)
riskBox := na
rewardBox := na
avgLine := na
stopLine := na
tgtLine := na
tActive := false
tDir := 0
tStop := na
tTarget := na
tRisk := na
lastOrderPx := na
orderCount := 0
array.clear(entries)
// ═══════════════════════════════ ENTRY SIGNALS ═══════════════════════════════
// FIX: repaint protection — act only on closed bars
bool confOk = not useConfirmed or barstate.isconfirmed
float buf = useBuffer ? atrV * bufMul : 0.0
// FIX: trend filter (VWAP falls back to EMA when no volume)
float trendRef = trendSrc == "VWAP" and not na(vwapV) ? vwapV : emaV
bool trendLongOk = not useTrend or na(trendRef) or close > trendRef
bool trendShortOk = not useTrend or na(trendRef) or close < trendRef
// FIX: volume filter, auto-disabled on symbols without volume
bool volOk = not useVol or na(volume) or na(volSma) or volSma <= 0 or volume >= volSma * volMul
// FIX: strong candle filter against wick-driven breakouts
float barRng = high - low
bool bodyLongOk = not useBody or (close > open and barRng > 0 and (close - open) >= bodyMin * barRng)
bool bodyShortOk = not useBody or (close < open and barRng > 0 and (open - close) >= bodyMin * barRng)
// FIX: one trade at a time, max one breakout per side per day, entries only inside the trade window
bool canSignal = orReady and orValid and rangeOk and inWin and not inOR and confOk and not tActive and not closedNow and not na(buf)
bool longSignal = canSignal and close > orH + buf and not longUsed and (allowRev or not shortUsed) and trendLongOk and volOk and bodyLongOk
bool shortSignal = canSignal and not longSignal and close < orL - buf and not shortUsed and (allowRev or not longUsed) and trendShortOk and volOk and bodyShortOk
bool buySig = false
bool sellSig = false
if longSignal or shortSignal
int d = longSignal ? 1 : -1
float stp = stopMode == "Breakout Candle" ? (d == 1 ? low : high) : stopMode == "OR Midpoint" ? (orH + orL) / 2 : (d == 1 ? orL : orH)
float rsk = (close - stp) * d
if d == 1
longUsed := true
else
shortUsed := true
if rsk > 0
buySig := d == 1
sellSig := d == -1
tActive := true
tDir := d
tStop := stp
tRisk := rsk
tTarget := close + d * rsk * rr
tEntryBar := bar_index
lastOrderPx := close
orderCount := 1
array.push(entries, close)
if showGrid
riskBox := box.new(bar_index, math.max(close, tStop), bar_index + 1, math.min(close, tStop), border_color = color.new(bearCol, 100), bgcolor = color.new(bearCol, zoneTransp))
rewardBox := box.new(bar_index, math.max(close, tTarget), bar_index + 1, math.min(close, tTarget), border_color = color.new(bullCol, 100), bgcolor = color.new(bullCol, zoneTransp))
avgLine := line.new(bar_index, close, bar_index + 1, close, color = entryCol, width = 2)
stopLine := line.new(bar_index, tStop, bar_index + 1, tStop, color = bearCol, width = 1)
tgtLine := line.new(bar_index, tTarget, bar_index + 1, tTarget, color = bullCol, width = 1)
if showLabels
float off = nz(atrV, barRng) * 0.6
label.new(bar_index, d == 1 ? low - off : high + off, (d == 1 ? "B" : "S") + "1", style = d == 1 ? label.style_label_up : label.style_label_down, color = d == 1 ? bullCol : bearCol, textcolor = color.white, size = size.small)
// ═══════════════════════════════ PYRAMID ENGINE ═══════════════════════════════
// Scale In : Buy adds when close >= lastOrder + step (below target) ; Sell adds when close <= lastOrder - step (above target)
// Average In : Buy adds when close <= lastOrder - step (above stop) ; Sell adds when close >= lastOrder + step (below stop)
float stepDist = distMode == "Ticks" ? distTicks * syminfo.mintick : stepAtr
bool averageIn = pyrDir == "Against (Average In)"
bool pyrBuy = false
bool pyrSell = false
if usePyr and tActive and not buySig and not sellSig and not closedNow and confOk and inWin and orderCount < maxOrders and not na(stepDist) and bar_index > tEntryBar
bool hit = tDir == 1 ? (averageIn ? close <= lastOrderPx - stepDist and close > tStop : close >= lastOrderPx + stepDist and close < tTarget) : (averageIn ? close >= lastOrderPx + stepDist and close < tStop : close <= lastOrderPx - stepDist and close > tTarget)
if hit
array.push(entries, close)
orderCount += 1
lastOrderPx := close
pyrBuy := tDir == 1
pyrSell := tDir == -1
if not na(avgLine)
float avgPx = array.avg(entries)
line.set_y1(avgLine, avgPx)
line.set_y2(avgLine, avgPx)
if showLabels
float off2 = nz(atrV, barRng) * 0.6
label.new(bar_index, tDir == 1 ? low - off2 : high + off2, (tDir == 1 ? "B" : "S") + str.tostring(orderCount), style = tDir == 1 ? label.style_label_up : label.style_label_down, color = color.new(tDir == 1 ? bullCol : bearCol, 40), textcolor = color.white, size = size.small)
// ═══════════════════════════════ PLOTS ═══════════════════════════════
plotshape(buySig, "Buy", shape.triangleup, location.belowbar, color.green, size = size.small)
plotshape(pyrBuy, "Pyramid Buy", shape.circle, location.belowbar, color.new(color.green, 30), size = size.tiny)
plotshape(sellSig, "Sell", shape.triangledown, location.abovebar, color.red, size = size.small)
plotshape(pyrSell, "Pyramid Sell", shape.circle, location.abovebar, color.new(color.red, 30), size = size.tiny)
barcolor(highlightBar and buySig ? bullCol : highlightBar and sellSig ? bearCol : na)
// ═══════════════════════════════ STATS TABLE ═══════════════════════════════
var table stats = table.new(position.top_right, 2, 8, bgcolor = color.new(color.black, 15), frame_color = color.new(color.white, 70), frame_width = 1, border_color = color.new(color.white, 85), border_width = 1)
if showStats and barstate.islast
color hdr = color.rgb(35, 40, 50)
color cel = color.rgb(22, 26, 34)
float winRate = statTrades > 0 ? statWin * 100.0 / statTrades : 0.0
table.cell(stats, 0, 0, "STATISTICS", text_color = color.white, bgcolor = hdr, text_size = size.small)
table.cell(stats, 1, 0, "VALUE", text_color = color.white, bgcolor = hdr, text_size = size.small)
table.cell(stats, 0, 1, "Closed trades", text_color = color.white, bgcolor = cel)
table.cell(stats, 1, 1, str.tostring(statTrades), text_color = color.white, bgcolor = cel)
table.cell(stats, 0, 2, "Take profits", text_color = color.white, bgcolor = cel)
table.cell(stats, 1, 2, str.tostring(statTP), text_color = bullCol, bgcolor = cel)
table.cell(stats, 0, 3, "Stop losses", text_color = color.white, bgcolor = cel)
table.cell(stats, 1, 3, str.tostring(statSL), text_color = bearCol, bgcolor = cel)
table.cell(stats, 0, 4, "EOD exits", text_color = color.white, bgcolor = cel)
table.cell(stats, 1, 4, str.tostring(statEOD), text_color = color.white, bgcolor = cel)
table.cell(stats, 0, 5, "Win rate (R > 0)", text_color = color.white, bgcolor = cel)
table.cell(stats, 1, 5, str.tostring(winRate, "#.##") + "%", text_color = color.white, bgcolor = cel)
table.cell(stats, 0, 6, "Total R", text_color = color.white, bgcolor = cel)
table.cell(stats, 1, 6, str.tostring(statR, "#.##") + "R", text_color = statR >= 0 ? bullCol : bearCol, bgcolor = cel)
table.cell(stats, 0, 7, "Today range", text_color = color.white, bgcolor = cel)
table.cell(stats, 1, 7, orStatus, text_color = color.white, bgcolor = cel)
// ═══════════════════════════════ ALERTS ═══════════════════════════════
alertcondition(buySig, "AORB Buy", "AORB Buy breakout on {{ticker}} at {{close}}")
alertcondition(sellSig, "AORB Sell", "AORB Sell breakout on {{ticker}} at {{close}}")
alertcondition(pyrBuy, "AORB Pyramid Buy", "AORB Pyramid Buy add on {{ticker}} at {{close}}")
alertcondition(pyrSell, "AORB Pyramid Sell", "AORB Pyramid Sell add on {{ticker}} at {{close}}")
alertcondition(tpExit, "AORB Take Profit", "AORB Take Profit hit on {{ticker}}")
alertcondition(slExit, "AORB Stop Loss", "AORB Stop Loss hit on {{ticker}}")
alertcondition(eodExit, "AORB End-of-Window Exit", "AORB trade closed at end of window on {{ticker}}")