ICT Turtle Soup (Liquidity Reversal)

MrWoof888 · study · 43 行 · 点赞 397 · 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]
 
// Store recent high/low levels
var float prevHigh = na
var float prevLow  = na
 
if isSwingHigh
    prevHigh := high[swingLookback]
if isSwingLow
    prevLow := low[swingLookback]
 
// === TURTLE SOUP CONDITIONS ===
// Bearish setup: run above previous high, then close back below
bearTS = not na(prevHigh) and high > prevHigh and close < prevHigh
 
// Bullish setup: run below previous low, then close back above
bullTS = not na(prevLow) and low < prevLow and close > prevLow
 
// === PLOT LABELS & MARKERS ===
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="🐢🔺")
 
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)
 
// === OPTIONAL 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!")

← 返回列表