ICT Turtle Soup (Liquidity Reversal)

MrWoof888 · study · 40 行 · 点赞 984 · TradingView 原页

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

Pine Script

//@version=6
indicator("ICT Turtle Soup (Liquidity Reversal)", overlay=true)
 
// === INPUTS ===
swingLookback   = input.int(5, "Swing Lookback", minval=1)
showLabels      = input.bool(true, "Show Labels")
labelTextSize   = input.string("small", "Label Size", options=["tiny", "small", "normal", "large", "huge"])
bullColor       = input.color(color.green, "Bullish Turtle Soup Color")
bearColor       = input.color(color.red, "Bearish Turtle Soup Color")
 
// === SWING HIGH/LOW DETECTION ===
isSwingHigh     = high[swingLookback] > high[swingLookback + 1] and high[swingLookback] > high[swingLookback - 1]
isSwingLow      = low[swingLookback] < low[swingLookback + 1] and low[swingLookback] < low[swingLookback - 1]
 
var float prevHigh = na
var float prevLow  = na
 
if isSwingHigh
    prevHigh := high[swingLookback]
if isSwingLow
    prevLow := low[swingLookback]
 
// === TURTLE SOUP CONDITIONS ===
bearTS = not na(prevHigh) and high > prevHigh and close < prevHigh
bullTS = not na(prevLow) and low < prevLow and close > prevLow
 
// === PLOT SHAPES ===
plotshape(bearTS, location=location.abovebar, style=shape.labeldown, color=bearColor, size=size.tiny, title="Bearish Turtle Soup", text="🐢🔻")
plotshape(bullTS, location=location.belowbar, style=shape.labelup, color=bullColor, size=size.tiny, title="Bullish Turtle Soup", text="🐢🔺")
 
// === OPTIONAL LABELS ===
if showLabels
    if bearTS
        label.new(bar_index, high, "Turtle Soup\n(Bearish)", style=label.style_label_down, color=bearColor, textcolor=color.white, size=labelTextSize)
    if bullTS
        label.new(bar_index, low, "Turtle Soup\n(Bullish)", style=label.style_label_up, color=bullColor, textcolor=color.white, size=labelTextSize)
 
// === ALERT CONDITIONS ===
alertcondition(bearTS, title="Bearish Turtle Soup Alert", message="Bearish Turtle Soup detected!")
alertcondition(bullTS, title="Bullish Turtle Soup Alert", message="Bullish Turtle Soup detected!")

← 返回列表