本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
// @version=5
indicator("ICT Precision Turtle Soup [Final English Version]", overlay=true, max_boxes_count=100)
// --- 1. INPUTS & SETTINGS ---
lookback_period = input.int(60, "CRT Lookback Period", minval=20)
htf_timeframe = input.timeframe("240", "HTF Trend Filter (e.g., 240=4H, D=Daily)")
disp_threshold = input.float(1.8, "Displacement Multiplier (Precision Filter)")
show_zones = input.bool(true, "Show Entry Zones (IFVG/Breaker)")
// --- 2. HTF TREND FILTER ---
// To increase accuracy, we check the trend on a Higher Timeframe
htf_close = request.security(syminfo.tickerid, htf_timeframe, close)
htf_ema = request.security(syminfo.tickerid, htf_timeframe, ta.ema(close, 50))
is_htf_bullish = htf_close > htf_ema
is_htf_bearish = htf_close < htf_ema
// --- 3. KILLZONES (GMT+8 / Malaysia Time) ---
is_london = not na(time(timeframe.period, "1600-1900:1234567", "GMT+8"))
is_newyork = not na(time(timeframe.period, "2100-0000:1234567", "GMT+8"))
in_session = is_london or is_newyork
// --- 4. CRT LEVELS (Step 1 & 2) ---
// Defining the Candle Range Theory High and Low
crt_high = ta.highest(high[1], lookback_period)
crt_low = ta.lowest(low[1], lookback_period)
equilibrium = (crt_high + crt_low) / 2
// --- 5. TBS DETECTION (Step 3: Manipulation) ---
// Detecting Turtle Body Soup structures as shown in image 1000016222.jpg
tbs_bullish = low < crt_low and close > crt_low and in_session
tbs_bearish = high > crt_high and close < crt_high and in_session
// --- 6. PRECISION ENTRY LOGIC (Step 4: MSS + Displacement) ---
// Global scope calls for pivot functions to avoid errors
pivot_high = ta.pivothigh(high, 5, 5)
pivot_low = ta.pivotlow(low, 5, 5)
var float mss_level = na
var bool potential_setup = false
var int direction = 0 // 1 = Buy, -1 = Sell
if tbs_bullish and is_htf_bullish
potential_setup := true
direction := 1
mss_level := pivot_high
if tbs_bearish and is_htf_bearish
potential_setup := true
direction := -1
mss_level := pivot_low
// Displacement Check: Ensuring institutional momentum exists
body_size = math.abs(close - open)
avg_body = ta.sma(body_size, 20)
has_displacement = body_size > avg_body * disp_threshold
// Final Signal Confirmation
buy_signal = potential_setup and direction == 1 and ta.crossover(close, mss_level) and has_displacement
sell_signal = potential_setup and direction == -1 and ta.crossunder(close, mss_level) and has_displacement
// Reset logic
if buy_signal or sell_signal or (direction == 1 and low < crt_low) or (direction == -1 and high > crt_high)
potential_setup := false
// --- 7. VISUALS & DRAWINGS ---
// Plotting CRT Boundaries
plot(crt_high, "CRT High", color=color.new(color.red, 50), style=plot.style_line, linewidth=2)
plot(crt_low, "CRT Low", color=color.new(color.green, 50), style=plot.style_line, linewidth=2)
plot(equilibrium, "50% Target", color=color.new(color.gray, 80), style=plot.style_linebr)
// Visualizing Manipulation (Turtle Soup Symbols)
plotshape(tbs_bearish, "TBS High", text="🐢", location=location.abovebar, color=color.red, textcolor=color.red, size=size.tiny)
plotshape(tbs_bullish, "TBS Low", text="🐢", location=location.belowbar, color=color.green, textcolor=color.green, size=size.tiny)
// Entry Labels for High Probability Trades
plotshape(buy_signal, "BUY ENTRY", text="⭐ PRECISION\nBUY", location=location.belowbar, style=shape.labelup, color=color.green, textcolor=color.white, size=size.normal)
plotshape(sell_signal, "SELL ENTRY", text="⭐ PRECISION\nSELL", location=location.abovebar, style=shape.labeldown, color=color.red, textcolor=color.white, size=size.normal)
// Entry Zones (Boxes)
if show_zones and (buy_signal or sell_signal)
box.new(bar_index[5], high[5], bar_index, low[0], bgcolor=buy_signal ? color.new(color.green, 90) : color.new(color.red, 90), border_color=na)
// Killzone Background
bgcolor(in_session ? color.new(color.gray, 98) : na)