本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
//@version=6
indicator("Anosh Smart Money V1", overlay=true, max_labels_count=500, max_lines_count=200)
// === SETTINGS ===
swingLen = input.int(5, "Swing Length", minval=2)
useEMA = input.bool(true, "Use EMA Trend Filter")
emaFastLen = input.int(50, "Fast EMA")
emaSlowLen = input.int(200, "Slow EMA")
showSwings = input.bool(true, "Show Swing High/Low")
showSignals = input.bool(true, "Show BUY/SELL Signals")
// === EMA TREND ===
emaFast = ta.ema(close, emaFastLen)
emaSlow = ta.ema(close, emaSlowLen)
plot(emaFast, "EMA Fast", color=color.orange)
plot(emaSlow, "EMA Slow", color=color.blue)
bullTrend = emaFast > emaSlow
bearTrend = emaFast < emaSlow
// === MARKET STRUCTURE ===
ph = ta.pivothigh(high, swingLen, swingLen)
pl = ta.pivotlow(low, swingLen, swingLen)
var float lastHigh = na
var float lastLow = na
var float brokenHigh = na
var float brokenLow = na
var int marketTrend = 0
if not na(ph)
lastHigh := ph
if not na(pl)
lastLow := pl
plotshape(showSwings and not na(ph), title="Swing High",
style=shape.triangledown, location=location.abovebar,
color=color.red, size=size.tiny, offset=-swingLen)
plotshape(showSwings and not na(pl), title="Swing Low",
style=shape.triangleup, location=location.belowbar,
color=color.lime, size=size.tiny, offset=-swingLen)
// === BOS / CHOCH ===
breakHigh = not na(lastHigh) and ta.crossover(close, lastHigh) and (na(brokenHigh) or lastHigh != brokenHigh)
breakLow = not na(lastLow) and ta.crossunder(close, lastLow) and (na(brokenLow) or lastLow != brokenLow)
bullCHOCH = breakHigh and marketTrend == -1
bearCHOCH = breakLow and marketTrend == 1
bullBOS = breakHigh and marketTrend != -1
bearBOS = breakLow and marketTrend != 1
if breakHigh
label.new(bar_index, high, bullCHOCH ? "CHOCH ↑" : "BOS ↑",
style=label.style_label_down, color=bullCHOCH ? color.orange : color.green,
textcolor=color.white, size=size.tiny)
brokenHigh := lastHigh
marketTrend := 1
if breakLow
label.new(bar_index, low, bearCHOCH ? "CHOCH ↓" : "BOS ↓",
style=label.style_label_up, color=bearCHOCH ? color.orange : color.red,
textcolor=color.white, size=size.tiny)
brokenLow := lastLow
marketTrend := -1
// === LIQUIDITY SWEEPS ===
buySweep = not na(lastLow) and low < lastLow and close > lastLow and close > open
sellSweep = not na(lastHigh) and high > lastHigh and close < lastHigh and close < open
plotshape(buySweep, title="Sell-side Liquidity Sweep",
style=shape.circle, location=location.belowbar,
color=color.aqua, size=size.tiny, text="Sweep")
plotshape(sellSweep, title="Buy-side Liquidity Sweep",
style=shape.circle, location=location.abovebar,
color=color.fuchsia, size=size.tiny, text="Sweep")
// === BUY / SELL SIGNALS ===
buySignal = buySweep and (not useEMA or bullTrend)
sellSignal = sellSweep and (not useEMA or bearTrend)
plotshape(showSignals and buySignal, title="BUY",
style=shape.labelup, location=location.belowbar,
color=color.green, text="BUY", textcolor=color.white, size=size.small)
plotshape(showSignals and sellSignal, title="SELL",
style=shape.labeldown, location=location.abovebar,
color=color.red, text="SELL", textcolor=color.white, size=size.small)
// === ALERTS ===
alertcondition(buySignal, title="Anosh BUY",
message="Anosh Smart Money: BUY signal on {{ticker}} at {{close}}")
alertcondition(sellSignal, title="Anosh SELL",
message="Anosh Smart Money: SELL signal on {{ticker}} at {{close}}")
alertcondition(bullCHOCH or bearCHOCH, title="CHOCH Alert",
message="Anosh Smart Money: CHOCH detected on {{ticker}}")
alertcondition(bullBOS or bearBOS, title="BOS Alert",
message="Anosh Smart Money: BOS detected on {{ticker}}")