本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Alpha_Forge
//@version=6
indicator("Alpha Forge | Flow BUY SELL v0.7", shorttitle="AF AURORA", overlay=true, precision=2, behind_chart=false, explicit_plot_zorder=true, max_boxes_count=500, max_lines_count=500, max_labels_count=500)
string gSignal = "BUY / SELL rules"
int smoothLen = input.int(3, "Flow smoothing", minval=1, group=gSignal, display=display.none)
float entryLevel = input.float(10.0, "BUY score threshold", minval=1.0, maxval=90.0, step=1.0, group=gSignal, display=display.none)
int entryBars = input.int(1, "Positive flow closes required", minval=1, maxval=10, group=gSignal, display=display.none)
float warningLevel = input.float(10.0, "Negative-flow warning threshold", minval=1.0, maxval=90.0, step=1.0, group=gSignal, display=display.none)
int warningBars = input.int(2, "Negative flow closes for warning", minval=1, maxval=10, group=gSignal, display=display.none)
int trendLen = input.int(20, "Trend EMA length", minval=5, group=gSignal, display=display.none)
int trendExitBars = input.int(2, "Closes below trend to SELL", minval=1, maxval=10, group=gSignal, display=display.none)
int cooldownBars = input.int(3, "Complete bars to wait after SELL", minval=0, group=gSignal, display=display.none)
float minRelVolume = input.float(0.50, "Minimum relative volume to BUY", minval=0.0, step=0.05, group=gSignal, display=display.none)
float minPressure = input.float(0.15, "Minimum absolute pressure to BUY", minval=0.01, step=0.05, group=gSignal, display=display.none)
string gProxy = "OHLCV model"
int volumeLen = input.int(50, "Prior volume baseline", minval=10, group=gProxy, display=display.none)
int atrLen = input.int(14, "Prior ATR baseline", minval=2, group=gProxy, display=display.none)
float volumeCap = input.float(5.0, "Relative volume cap", minval=1.0, step=0.5, group=gProxy, display=display.none)
float av = input.float(0.60, "Volume amplitude (Av)", minval=0.01, step=0.05, group=gProxy, display=display.none)
float beta = input.float(1.00, "Volume saturation (beta)", minval=0.05, step=0.05, group=gProxy, display=display.none)
float ar = input.float(0.40, "Persistence amplitude (Ar)", minval=0.0, step=0.05, group=gProxy, display=display.none)
float br = input.float(1.60, "Price-move attenuation (Br)", minval=0.0, step=0.05, group=gProxy, display=display.none)
float lambda = input.float(1.25, "Price-move saturation (lambda)", minval=0.05, step=0.05, group=gProxy, display=display.none)
string gDisplay = "Aurora appearance"
bool showTrend = input.bool(true, "Trend line", group=gDisplay, display=display.none)
bool shadeLong = input.bool(true, "Active trade cloud", group=gDisplay, display=display.none)
bool showDashboard = input.bool(true, "Alpha Forge dashboard", group=gDisplay, display=display.none)
bool showGlow = input.bool(true, "Neon line glow", group=gDisplay, display=display.none)
bool showRibbon = input.bool(true, "Trend ribbon", tooltip="A decorative band around the EMA. It is not a stop or target and does not change signals.", group=gDisplay, display=display.none)
bool showMarkers = input.bool(true, "BUY / SELL badges", group=gDisplay, display=display.none)
bool tintCandles = input.bool(true, "Signature candle colors", group=gDisplay, display=display.none)
string dashboardCorner = input.string("Bottom right", "Dashboard position", options=["Bottom right", "Top right", "Bottom left", "Top left"], group=gDisplay, display=display.none)
color buyColor = input.color(#45F5B0, "Long / BUY", inline="palette", group=gDisplay, display=display.none)
color sellColor = input.color(#FF597A, "Exit / SELL", inline="palette", group=gDisplay, display=display.none)
color scanColor = input.color(#49DFFF, "Standby", inline="palette", group=gDisplay, display=display.none)
string candleStyle = input.string("Glass neon", "Candle finish", options=["Glass neon", "Hollow neon", "Classic"], group=gDisplay, display=display.none)
bool candleGlow = input.bool(true, "Candle body + wick halos", group=gDisplay, display=display.none)
int glowHistory = input.int(160, "Recent candles with halos", minval=20, maxval=200, group=gDisplay, display=display.none)
string gEntryFilter = "Trend / range entry filter"
bool useEntryFilter = input.bool(true, "Avoid ranges and falling trends", tooltip="Affects new BUYs only. Requires price above a rising broader EMA and sufficient net upward progress. Does not delay SELLs.", group=gEntryFilter, display=display.none)
int regimeLen = input.int(50, "Broader trend EMA", minval=5, maxval=300, group=gEntryFilter, display=display.none)
int regimeSlopeBars = input.int(5, "Broader trend rise lookback", minval=1, maxval=50, group=gEntryFilter, display=display.none)
int efficiencyLen = input.int(20, "Directional efficiency lookback", minval=2, maxval=100, group=gEntryFilter, display=display.none)
float minEfficiency = input.float(0.30, "Minimum upward efficiency", minval=0.05, maxval=0.95, step=0.05, tooltip="Net close-to-close rise divided by total absolute close-to-close movement. 0.30 means at least 30% net upward progress. It is not a probability.", group=gEntryFilter, display=display.none)
f_tanh(float x) =>
float limited = math.max(-10.0, math.min(10.0, x))
float e = math.exp(2.0 * limited)
(e - 1.0) / (e + 1.0)
// Aggregate candle location is a pressure proxy, not observed aggressor volume.
float priorVolume = ta.sma(volume, volumeLen)[1]
float priorAtr = ta.atr(atrLen)[1]
float barRange = high - low
float closeLocation = barRange > 0.0 ? math.max(-1.0, math.min(1.0, (2.0 * close - high - low) / barRange)) : 0.0
float relVolume = not na(volume) and priorVolume > 0.0 ? math.min(volume / priorVolume, volumeCap) : na
float pressure = closeLocation * relVolume
float normalizedReturn = priorAtr > 0.0 and close[1] > 0.0 and close > 0.0 ? math.log(close / close[1]) / (priorAtr / close[1]) : na
bool ready = not na(pressure) and not na(normalizedReturn) and not na(volume) and volume > 0.0 and priorVolume > 0.0
float q = ready ? math.sign(pressure) : 0.0
float volumeTerm = ready ? av * f_tanh(beta * pressure) : na
float correction = ready ? q * (ar - br * f_tanh(lambda * math.abs(normalizedReturn))) : na
float rawScore = ready ? 100.0 * f_tanh(volumeTerm + correction) : na
bool pressureActive = ready and math.abs(pressure) >= minPressure
// Weak pressure contributes zero, avoiding large sign corrections on tiny proxies.
// In v0.4 the flow model controls entries and warnings; it does not force exits.
// Missing volume resets confirmations and does not supply a new BUY.
float gatedScore = ready ? (pressureActive ? rawScore : 0.0) : na
float filteredScore = ta.ema(gatedScore, smoothLen)
float trend = ta.ema(close, trendLen)
bool warmed = ready and bar_index >= math.max(volumeLen, math.max(atrLen, trendLen)) + smoothLen and not na(filteredScore)
bool trendUp = not na(trend) and close > trend
bool volumeOK = ready and relVolume >= minRelVolume
// Entry-only regime checks use the current confirmed candle and past observations.
float regimeTrend = ta.ema(close, regimeLen)
float travelDistance = math.sum(math.abs(ta.change(close)), efficiencyLen)
float directionalEfficiency = not na(close[efficiencyLen]) and not na(travelDistance) ? (travelDistance > 0.0 ? math.max(-1.0, math.min(1.0, (close - close[efficiencyLen]) / travelDistance)) : 0.0) : na
bool regimeReady = not na(regimeTrend[regimeSlopeBars]) and not na(directionalEfficiency)
bool broaderTrendOK = regimeReady and close > regimeTrend and regimeTrend > regimeTrend[regimeSlopeBars]
bool efficiencyOK = regimeReady and directionalEfficiency >= minEfficiency
bool entryFilterOK = not useEntryFilter or (broaderTrendOK and efficiencyOK)
var bool confirmedFilterOK = false
var bool confirmedBroaderTrendOK = false
var float confirmedEfficiency = na
var float confirmedRegimeTrend = na
// A small finite-state machine suppresses repeated labels and orphan SELLs.
// BUY, SELL, BUY, SELL must alternate; the last BUY can remain open.
var bool inLong = false
var int positiveCloses = 0
var int negativeCloses = 0
var int belowTrendCloses = 0
var int lastSellBar = na
var int lastSignalTime = na
var string lastSignal = "NONE"
var string lastExitReason = ""
var float confirmedScore = na
var float confirmedTrend = na
var string setupStatus = "WARMUP"
var int eligibleBars = 0
var int buyCount = 0
var int sellCount = 0
bool buySignal = false
bool sellSignal = false
if barstate.isconfirmed
confirmedScore := ready ? filteredScore : na
confirmedTrend := trend
confirmedFilterOK := entryFilterOK
confirmedBroaderTrendOK := broaderTrendOK
confirmedEfficiency := directionalEfficiency
confirmedRegimeTrend := regimeTrend
positiveCloses := warmed and pressureActive and filteredScore >= entryLevel ? positiveCloses + 1 : 0
negativeCloses := warmed and pressureActive and filteredScore <= -warningLevel ? negativeCloses + 1 : 0
belowTrendCloses := not na(trend) and close < trend ? belowTrendCloses + 1 : 0
bool cooldownDone = na(lastSellBar) or bar_index - lastSellBar > cooldownBars
bool flowEntry = positiveCloses >= entryBars
bool entryReady = warmed and flowEntry and trendUp and volumeOK and pressureActive and cooldownDone and entryFilterOK
bool flowWarning = negativeCloses >= warningBars
bool trendExit = belowTrendCloses >= trendExitBars
if warmed
eligibleBars += 1
if inLong
if trendExit
sellSignal := true
inLong := false
lastSellBar := bar_index
lastSignalTime := time_close
lastSignal := "SELL"
lastExitReason := "CONFIRMED TREND BREAK"
sellCount += 1
// Re-entry requires a fresh sequence after the SELL.
positiveCloses := 0
setupStatus := "SELL / EXIT LONG"
else
setupStatus := flowWarning ? "HOLD / FLOW CAUTION" : "HOLD LONG"
else if entryReady
buySignal := true
inLong := true
lastSignalTime := time_close
lastSignal := "BUY"
lastExitReason := ""
buyCount += 1
negativeCloses := 0
belowTrendCloses := 0
setupStatus := "BUY / ENTER LONG"
else
setupStatus := not warmed ? "WARMUP / NO VOLUME" : not cooldownDone ? "WAIT / COOLDOWN" : useEntryFilter and not broaderTrendOK ? "WAIT / BROADER TREND" : useEntryFilter and not efficiencyOK ? "WAIT / RANGE" : not trendUp ? "WAIT / ABOVE TREND" : not pressureActive or not volumeOK ? "WAIT / PRESSURE" : not flowEntry ? "WAIT / FLOW CONFIRM" : "WAIT / SETUP"
// ---------------- SIGNATURE VISUAL LAYER ----------------
// Only this section renders the new appearance. It does not modify signal state.
var float visualAtr = na
var float visualClose = na
if barstate.isconfirmed
visualAtr := priorAtr
visualClose := close
color navy = #08111F
color surface = #0D1A2C
color textBright = #EAF5FF
color muted = #91A5BE
color cautionColor = #FFD479
bool cautionState = inLong and setupStatus == "HOLD / FLOW CAUTION"
bool resetState = not inLong and not na(lastSellBar) and bar_index - lastSellBar <= cooldownBars
color phaseColor = inLong ? (cautionState ? cautionColor : buyColor) : resetState ? sellColor : scanColor
color pulseColor = na(confirmedScore) ? muted : confirmedScore >= 0 ? buyColor : sellColor
// Soft halo, crisp core and narrow cosmetic ribbon share the confirmed EMA.
plot(showTrend and showGlow ? confirmedTrend : na, "Trend glow outer", color=color.new(phaseColor, 88), linewidth=12, display=display.pane, editable=false)
plot(showTrend and showGlow ? confirmedTrend : na, "Trend glow inner", color=color.new(phaseColor, 72), linewidth=7, display=display.pane, editable=false)
pTrend = plot(showTrend ? confirmedTrend : na, "Trend EMA (confirmed)", color=phaseColor, linewidth=3, display=display.all - display.status_line)
pUpper = plot(showTrend and showRibbon ? confirmedTrend + visualAtr * 0.12 : na, "Ribbon upper (visual only)", color=na, display=display.none, editable=false)
pLower = plot(showTrend and showRibbon ? confirmedTrend - visualAtr * 0.12 : na, "Ribbon lower (visual only)", color=na, display=display.none, editable=false)
fill(pUpper, pLower, color=color.new(phaseColor, 84), title="Signature trend ribbon", fillgaps=false)
pActive = plot(shadeLong and inLong ? visualClose : na, "Trade cloud anchor", color=na, display=display.none, editable=false)
fill(pTrend, pActive, math.max(visualClose, confirmedTrend), math.min(visualClose, confirmedTrend), inLong ? color.new(visualClose >= confirmedTrend ? buyColor : cautionColor, 98) : na, inLong ? color.new(visualClose >= confirmedTrend ? buyColor : cautionColor, 68) : na, title="Aurora vertical-gradient cloud", fillgaps=false)
bgcolor(shadeLong and inLong ? color.new(buyColor, 98) : na, title="Long signal ambience")
// Badge offsets are decorative. Signals still belong to the same closed candle.
float buyBadge = buySignal ? low - nz(visualAtr, high - low) * 0.40 : na
float sellBadge = sellSignal ? high + nz(visualAtr, high - low) * 0.40 : na
// Two precisely sized layers give each badge a thin luminous glass rim.
// Retain the latest 240 signal badges (480 labels), independent of the signal engine.
var array<label> badgeLayers = array.new<label>()
if showMarkers and (buySignal or sellSignal)
bool isBuyBadge = buySignal
float badgeY = isBuyBadge ? buyBadge : sellBadge
string badgeText = isBuyBadge ? "BUY ↗" : "SELL ↘"
string badgeStyle = isBuyBadge ? label.style_label_up : label.style_label_down
color badgeColor = isBuyBadge ? buyColor : sellColor
string badgeTip = isBuyBadge ? "BUY · Enter long · Confirmed candle" : "SELL · Close long · Confirmed candle"
array.push(badgeLayers, label.new(bar_index, badgeY, badgeText, style=badgeStyle, color=color.new(badgeColor, 38), textcolor=color.new(badgeColor, 100), size=14, text_font_family=font.family_monospace, text_formatting=text.format_bold))
array.push(badgeLayers, label.new(bar_index, badgeY, badgeText, style=badgeStyle, color=color.new(navy, 16), textcolor=badgeColor, size=13, text_font_family=font.family_monospace, text_formatting=text.format_bold, tooltip=badgeTip))
while array.size(badgeLayers) > 480
label.delete(array.shift(badgeLayers))
// The custom renderer is inserted below. Native bars keep normal colors in Classic mode.
barcolor(tintCandles and candleStyle == "Classic" ? (inLong ? (close >= open ? buyColor : color.new(sellColor, 16)) : (close >= open ? color.new(scanColor, 25) : color.new(sellColor, 45))) : tintCandles ? color.new(color.white, 100) : na, title="Native candle visibility / palette")
// ---------------- TRUE-OHLC GLASS CANDLES ----------------
// Body bands subdivide ONLY the actual open-close body for a glass finish.
// They are not synthetic market data, smoothed prices, predictions or signals.
bool customCandles = tintCandles and candleStyle != "Classic"
bool glassFinish = customCandles and candleStyle == "Glass neon"
float candleEnergy = na(relVolume) ? 0.40 : math.max(0.0, math.min(1.0, relVolume / 2.0))
color upHue = color.from_gradient(candleEnergy, 0.0, 1.0, inLong ? #178D74 : #13748F, inLong ? #8AFFDC : #83EFFF)
color downHue = color.from_gradient(candleEnergy, 0.0, 1.0, inLong ? #9B315E : #5F3E9B, inLong ? #FF8DB6 : #CDA4FF)
color candleHue = close >= open ? upHue : downHue
color litEdge = color.from_gradient(0.18, 0.0, 1.0, candleHue, #FFFFFF)
float bodyFloor = math.min(open, close)
float bodyRoof = math.max(open, close)
float bodyHeight = bodyRoof - bodyFloor
float glassOpen = glassFinish ? bodyFloor : na
// Four translucent bands form the interior gradient; real wicks are drawn last.
plotcandle(glassOpen, bodyFloor + bodyHeight * 0.25, bodyFloor, bodyFloor + bodyHeight * 0.25, title="Glass body lower", color=color.new(candleHue, 63), wickcolor=na, bordercolor=na, display=display.pane, editable=false)
plotcandle(glassFinish ? bodyFloor + bodyHeight * 0.25 : na, bodyFloor + bodyHeight * 0.50, bodyFloor + bodyHeight * 0.25, bodyFloor + bodyHeight * 0.50, title="Glass body lower middle", color=color.new(candleHue, 43), wickcolor=na, bordercolor=na, display=display.pane, editable=false)
plotcandle(glassFinish ? bodyFloor + bodyHeight * 0.50 : na, bodyFloor + bodyHeight * 0.75, bodyFloor + bodyHeight * 0.50, bodyFloor + bodyHeight * 0.75, title="Glass body upper middle", color=color.new(candleHue, 21), wickcolor=na, bordercolor=na, display=display.pane, editable=false)
plotcandle(glassFinish ? bodyFloor + bodyHeight * 0.75 : na, bodyRoof, bodyFloor + bodyHeight * 0.75, bodyRoof, title="Glass body highlight", color=color.new(litEdge, 9), wickcolor=na, bordercolor=na, display=display.pane, editable=false)
plotcandle(customCandles ? open : na, high, low, close, title="Real OHLC outlines + wicks", color=color.new(candleHue, 100), wickcolor=litEdge, bordercolor=litEdge, display=display.pane, editable=false)
// Bounded cosmetic halos on recently completed bars. No trading variables change.
var array<box> bodyHalos = array.new<box>()
var array<line> wickHalos = array.new<line>()
if customCandles and candleGlow and barstate.isconfirmed and bar_index >= last_bar_index - glowHistory + 1
int candleMs = math.max(1, time_close - time)
int outerHalf = int(candleMs * 0.43)
int innerHalf = int(candleMs * 0.34)
float pad = math.max(syminfo.mintick * 0.5, nz(visualAtr, high - low) * 0.025)
array.push(bodyHalos, box.new(left=time - outerHalf, top=bodyRoof + pad * 2.0, right=time + outerHalf, bottom=bodyFloor - pad * 2.0, xloc=xloc.bar_time, border_color=na, bgcolor=color.new(candleHue, 94)))
array.push(bodyHalos, box.new(left=time - innerHalf, top=bodyRoof + pad, right=time + innerHalf, bottom=bodyFloor - pad, xloc=xloc.bar_time, border_color=na, bgcolor=color.new(candleHue, 91)))
array.push(wickHalos, line.new(x1=time, y1=high, x2=time, y2=low, xloc=xloc.bar_time, color=color.new(candleHue, 84), width=4))
while array.size(bodyHalos) > glowHistory * 2
box.delete(array.shift(bodyHalos))
while array.size(wickHalos) > glowHistory
line.delete(array.shift(wickHalos))
// Exact signal and state series remain available independently of visual toggles.
plot(buySignal ? 1 : 0, "BUY event (audit)", display=display.data_window)
plot(sellSignal ? 1 : 0, "SELL event (audit)", display=display.data_window)
plot(confirmedScore, "Confirmed flow score (not probability)", display=display.data_window)
plot(inLong ? 1 : 0, "Long signal state (1 = long)", display=display.data_window)
plot(buyCount, "BUY count (loaded history)", display=display.data_window)
plot(sellCount, "SELL count (loaded history)", display=display.data_window)
plot(belowTrendCloses, "Confirmed closes below trend", display=display.data_window)
plot(negativeCloses, "Confirmed negative-flow warning closes", display=display.data_window)
plot(confirmedFilterOK ? 1 : 0, "Entry filter pass (confirmed)", display=display.data_window)
plot(confirmedEfficiency, "Upward efficiency (confirmed)", display=display.data_window)
plot(confirmedRegimeTrend, "Broader EMA (confirmed)", display=display.data_window)
string panelPosition = dashboardCorner == "Top right" ? position.top_right : dashboardCorner == "Bottom left" ? position.bottom_left : dashboardCorner == "Top left" ? position.top_left : position.bottom_right
var table status = table.new(panelPosition, 2, 9, bgcolor=navy, frame_color=#28435B, frame_width=1, border_width=0)
if barstate.isfirst
table.merge_cells(status, 0, 0, 1, 0)
table.merge_cells(status, 0, 1, 1, 1)
table.merge_cells(status, 0, 2, 1, 2)
table.merge_cells(status, 0, 3, 1, 3)
table.merge_cells(status, 0, 8, 1, 8)
if barstate.islast and showDashboard
string hero = inLong ? (cautionState ? "LONG / CAUTION" : "LONG ACTIVE") : "STANDBY"
string detail = inLong ? (cautionState ? "FLOW SOFTENING · TREND STILL ACTIVE" : "FOLLOWING THE CONFIRMED TREND") : resetState ? "REARMING AFTER EXIT" : not warmed ? "WAITING FOR VALID DATA" : useEntryFilter and not confirmedBroaderTrendOK ? "WAITING FOR A RISING BROADER TREND" : useEntryFilter and not confirmedFilterOK ? "RANGE FILTER · WAITING FOR DIRECTION" : not trendUp ? "WAITING FOR PRICE ABOVE TREND" : "SCANNING FOR THE NEXT SETUP"
string pulse = ""
int lit = na(confirmedScore) ? 0 : int(math.min(10, math.floor(math.abs(confirmedScore) / 10.0)))
for i = 0 to 9
pulse += i < lit ? "▰" : "▱"
string scoreText = na(confirmedScore) ? "—" : (confirmedScore > 0 ? "+" : "") + str.tostring(confirmedScore, "#.0")
string eventTime = na(lastSignalTime) ? "—" : str.upper(str.format_time(lastSignalTime, "MMM d HH:mm", syminfo.timezone))
table.cell(status, 0, 0, "▲ A L P H A F O R G E", text_color=scanColor, text_size=size.normal, bgcolor=surface, text_formatting=text.format_bold)
table.cell(status, 0, 1, "FLOW PERSISTENCE / AURORA GLASS", text_color=muted, text_size=size.tiny, bgcolor=surface)
table.cell(status, 0, 2, hero, text_color=phaseColor, text_size=size.large, bgcolor=color.new(phaseColor, 94), text_formatting=text.format_bold)
table.cell(status, 0, 3, detail, text_color=muted, text_size=size.tiny, bgcolor=navy)
table.cell(status, 0, 4, "FLOW PULSE", text_color=muted, text_halign=text.align_left, text_size=size.tiny, bgcolor=navy)
table.cell(status, 1, 4, pulse + " " + scoreText, text_color=pulseColor, text_halign=text.align_right, text_size=size.small, text_font_family=font.family_monospace, bgcolor=navy, tooltip="Signed model score from -100 to +100. Magnitude is not a probability, confidence or win rate.")
table.cell(status, 0, 5, "LAST " + lastSignal, text_color=lastSignal == "BUY" ? buyColor : lastSignal == "SELL" ? sellColor : muted, text_halign=text.align_left, text_size=size.tiny, bgcolor=surface)
table.cell(status, 1, 5, eventTime, text_color=textBright, text_halign=text.align_right, text_size=size.small, text_font_family=font.family_monospace, bgcolor=surface)
table.cell(status, 0, 6, "EXIT CONFIRMATION", text_color=muted, text_halign=text.align_left, text_size=size.tiny, bgcolor=navy)
table.cell(status, 1, 6, str.tostring(trendExitBars) + " CLOSES < EMA " + str.tostring(trendLen), text_color=textBright, text_halign=text.align_right, text_size=size.tiny, bgcolor=navy)
table.cell(status, 0, 7, "● CONFIRMED BARS", text_color=scanColor, text_halign=text.align_left, text_size=size.tiny, bgcolor=surface)
table.cell(status, 1, 7, "LONG ONLY", text_color=muted, text_halign=text.align_right, text_size=size.tiny, bgcolor=surface)
table.cell(status, 0, 8, "v0.7 · RESEARCH BUILD · UNVALIDATED", text_color=muted, text_size=size.tiny, bgcolor=navy)
else if barstate.islast
table.clear(status, 0, 0, 1, 8)
alertcondition(buySignal, "AF Flow BUY - enter long", "AF Flow BUY: enter-long signal confirmed at candle close. {{ticker}} {{interval}}. Earliest execution: next available bar open.")
alertcondition(sellSignal, "AF Flow SELL - close long", "AF Flow SELL: close-long signal confirmed at candle close. {{ticker}} {{interval}}. Earliest execution: next available bar open.")