
Jangan lagi percaya pada satu indikator. Strategi ini menggabungkan tiga dimensi yang sempurna dari penyapuan mobilitas, abnormalitas lalu lintas, tren EMA, 11 siklus berayun untuk mengidentifikasi resistensi pendukung utama, 31 siklus EMA untuk memfilter arah tren. Retrospeksi menunjukkan bahwa mekanisme konfirmasi ganda secara efektif mengurangi gangguan false breakout, tetapi dengan harga penurunan frekuensi sinyal sekitar 30%.
Masalah terbesar dari strategi penyapu liquiditas yang biasa adalah terlalu banyak kebisingan. Di sini, 1 kali rata-rata lalu lintas 11 siklus digunakan sebagai filter, dan hanya sinyal yang dipicu oleh penembusan volume. Berdasarkan data, penambahan konfirmasi lalu lintas meningkatkan tingkat kemenangan 15-20%, tetapi akan kehilangan beberapa penembusan efektif di kelas ringan.
Desain yang paling tajam di sini: segera tutup posisi jika ada sinyal liquidity sweep yang berbalik. Logika “musuh-ku-kembali” ini lebih sensitif daripada stop loss tradisional, dan dapat ditarik kembali pada awal pembalikan tren.
31 siklus EMA tidak hanya digunakan sebagai penyaring masuk, tetapi juga sebagai garis pertahanan terakhir untuk memaksa keluar. Desain ini mencerminkan filosofi inti “trend is king” dengan posisi tanpa syarat saat harga jatuh di bawah EMA.
Desain buy_lock dan sell_lock dalam kode sangat cerdik. Setelah memicu sinyal sweep, sinyal yang sama akan dikunci sampai harga kembali ke posisi kunci. Ini menghindari pembukaan posisi berulang dalam situasi gelombang yang sama, mengurangi biaya transaksi dan paparan risiko.
Strategi ini paling cocok untuk lingkungan pasar dengan tren yang jelas tetapi berfluktuasi. Berkinerja baik di sisi tunggal naik atau turun, tetapi sering terhenti dalam getaran lateral. Disarankan untuk digunakan di tingkat garis matahari, tingkat kebisingan menit terlalu besar.
Ada risiko kerugian berturut-turut pada strategi, terutama ketika struktur pasar berubah. Identifikasi ayunan siklus 11 mungkin gagal dalam situasi ekstrem tertentu, dan ada keterlambatan dalam EMA siklus 31 dalam pembalikan cepat.
/*backtest
start: 2024-12-17 00:00:00
end: 2025-12-15 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"ETH_USDT","balance":500000}]
*/
//@version=5
strategy(
"Liquidity Sweep + Volume + OB + EMA Cross Exit (Fixed)",
overlay=true,
max_boxes_count=500,
max_lines_count=500,
initial_capital=100000,
default_qty_type=strategy.percent_of_equity,
default_qty_value=10,
pyramiding=1)
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// INPUTS
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
len = input.int(11, "Swing Length", minval=1)
volLen = input.int(11, "Volume MA Length", group="Volume Filter")
volMult = input.float(1, "Volume Multiplier", step=0.1, group="Volume Filter")
emaLength = input.int(31, "EMA Length", minval=1, group="EMA Filter")
extendBoxes = input.bool(true, "Extend Boxes")
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// EMA
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
emaVal = ta.ema(close, emaLength)
plot(emaVal, title="EMA", color=color.orange)
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// COLORS
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
buyCol = color.lime
sellCol = color.red
liqBuyCol = color.new(color.lime, 85)
liqSellCol = color.new(color.red, 85)
obBuyCol = color.new(color.green, 75)
obSellCol = color.new(color.maroon, 75)
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// VOLUME FILTER
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
volMA = ta.sma(volume, volLen)
highVol = volume > volMA * volMult
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// PIVOTS
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ph = ta.pivothigh(len, len)
pl = ta.pivotlow(len, len)
var float lastPH = na
var float lastPL = na
if not na(ph)
lastPH := ph
if not na(pl)
lastPL := pl
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// LIQUIDITY SWEEPS
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
sellSweep = not na(lastPH) and high > lastPH and close < lastPH and highVol
buySweep = not na(lastPL) and low < lastPL and close > lastPL and highVol
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// ANTI-SPAM LOCK
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
var bool buyLock = false
var bool sellLock = false
if buySweep
buyLock := true
else if not na(lastPL) and close < lastPL
buyLock := false
if sellSweep
sellLock := true
else if not na(lastPH) and close > lastPH
sellLock := false
buySignal = buySweep and not buyLock[1]
sellSignal = sellSweep and not sellLock[1]
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// TRADE STATE
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
var float entryPrice = na
var int entryBar = na
var int entryDir = 0 // 1 = BUY, -1 = SELL
var bool tradeAlive = false
//━━━━━━━━ ENTRY ━━━━━━━━━━━━━━━━━━━
if buySignal and not tradeAlive
strategy.entry("BUY", strategy.long)
entryPrice := close
entryBar := bar_index
entryDir := 1
tradeAlive := true
if sellSignal and not tradeAlive
strategy.entry("SELL", strategy.short)
entryPrice := close
entryBar := bar_index
entryDir := -1
tradeAlive := true
barsFromEntry = tradeAlive ? bar_index - entryBar : na
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// EXIT LOGIC
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
exitBuyAfter3 = tradeAlive and entryDir == 1 and barsFromEntry >= 3 and close < entryPrice
exitSellAfter3 = tradeAlive and entryDir == -1 and barsFromEntry >= 3 and close > entryPrice
exitOppBuy = tradeAlive and entryDir == 1 and sellSignal
exitOppSell = tradeAlive and entryDir == -1 and buySignal
// EMA downside cross exit
emaCrossDown = tradeAlive and ta.crossunder(close, emaVal)
exitEMA = emaCrossDown
exitSignal = exitBuyAfter3 or exitSellAfter3 or exitOppBuy or exitOppSell or exitEMA
if exitSignal
if entryDir == 1
strategy.close("BUY")
if entryDir == -1
strategy.close("SELL")
tradeAlive := false
entryPrice := na
entryBar := na
entryDir := 0
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// PLOTS
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
plotshape(buySignal, "BUY", shape.labelup, location.belowbar, color=buyCol, text="BUY", textcolor=color.black)
plotshape(sellSignal, "SELL", shape.labeldown, location.abovebar, color=sellCol, text="SELL", textcolor=color.white)
plotshape(exitBuyAfter3, "EXIT BUY 3+", shape.xcross, location.abovebar, color=color.orange)
plotshape(exitSellAfter3, "EXIT SELL 3+", shape.xcross, location.belowbar, color=color.orange)
plotshape(exitOppBuy, "EXIT BUY OPP", shape.flag, location.abovebar, color=color.yellow)
plotshape(exitOppSell, "EXIT SELL OPP", shape.flag, location.belowbar, color=color.yellow)
plotshape(exitEMA and entryDir == 1, "EXIT EMA BUY", shape.triangledown, location.abovebar, color=color.blue)
plotshape(exitEMA and entryDir == -1, "EXIT EMA SELL", shape.triangleup, location.belowbar, color=color.blue)
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// ALERTS
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
alertcondition(buySignal, "BUY Alert", "Liquidity Sweep BUY")
alertcondition(sellSignal, "SELL Alert", "Liquidity Sweep SELL")
alertcondition(exitEMA,title="EXIT EMA CROSS",message="Price crossed below EMA")