Liquidity Hunter | Clean Signals

ReubenMiles · study · 56 行 · 点赞 2,141 · TradingView 原页

本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。

Pine Script

// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © ReubenMiles
 
//@version=6
indicator("Liquidity Hunter | Clean Signals", overlay=true)
 
// Settings
swingLength = input.int(5, "Liquidity Swing Length", minval=2)
showSignals = input.bool(true, "Show Buy/Sell Signals")
 
// Previous swing liquidity
swingHigh = ta.pivothigh(high, swingLength, swingLength)
swingLow  = ta.pivotlow(low, swingLength, swingLength)
 
var float lastHigh = na
var float lastLow  = na
 
if not na(swingHigh)
    lastHigh := swingHigh
 
if not na(swingLow)
    lastLow := swingLow
 
// Liquidity sweep detection
buySweep = not na(lastLow) and low < lastLow and close > lastLow
sellSweep = not na(lastHigh) and high > lastHigh and close < lastHigh
 
// Confirm signals on candle close
buySignal = buySweep and barstate.isconfirmed
sellSignal = sellSweep and barstate.isconfirmed
 
// Only BUY and SELL labels
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="BUY Alert",
     message="Liquidity Hunter: BUY Signal")
 
alertcondition(sellSignal, title="SELL Alert",
     message="Liquidity Hunter: SELL Signal")

← 返回列表