OPEN-SOURCE SCRIPT
MTF CRT Setup Finder (Raids + BOS linked)

//version=6
indicator("MTF CRT Setup Finder (Raids + BOS linked)", overlay=true, max_lines_count=500)
// === INPUTS ===
lookback = input.int(5, "Swing Lookback Bars", minval=2)
// === Function: Detect swing highs/lows ===
swingHigh(src, lb) => ta.pivothigh(src, lb, lb)
swingLow(src, lb) => ta.pivotlow(src, lb, lb)
// === Function: Detect CRT with memory ===
f_crt(tf) =>
hi = request.security(syminfo.tickerid, tf, high)
lo = request.security(syminfo.tickerid, tf, low)
cl = request.security(syminfo.tickerid, tf, close)
sh = request.security(syminfo.tickerid, tf, swingHigh(high, lookback))
sl = request.security(syminfo.tickerid, tf, swingLow(low, lookback))
raidHigh = not na(sh) and hi > sh and cl < sh
raidLow = not na(sl) and lo < sl and cl > sl
// store last raid state
var bool hadRaidHigh = false
var bool hadRaidLow = false
if raidHigh
hadRaidHigh := true
if raidLow
hadRaidLow := true
bosDown = hadRaidHigh and cl < sl
bosUp = hadRaidLow and cl > sh
// reset after BOS
if bosDown
hadRaidHigh := false
if bosUp
hadRaidLow := false
[raidHigh, raidLow, bosUp, bosDown]
// === Apply on H1 only first (test) ===
[raidHigh, raidLow, bosUp, bosDown] = f_crt("60")
// === Plot ===
plotshape(raidHigh, title="Raid High", style=shape.diamond, color=color.red, size=size.small, text="Raid High")
plotshape(raidLow, title="Raid Low", style=shape.diamond, color=color.green, size=size.small, text="Raid Low")
plotshape(bosDown, title="Bearish CRT", style=shape.triangledown, color=color.red, size=size.large, text="CRT↓")
plotshape(bosUp, title="Bullish CRT", style=shape.triangleup, color=color.green, size=size.large, text="CRT↑")
indicator("MTF CRT Setup Finder (Raids + BOS linked)", overlay=true, max_lines_count=500)
// === INPUTS ===
lookback = input.int(5, "Swing Lookback Bars", minval=2)
// === Function: Detect swing highs/lows ===
swingHigh(src, lb) => ta.pivothigh(src, lb, lb)
swingLow(src, lb) => ta.pivotlow(src, lb, lb)
// === Function: Detect CRT with memory ===
f_crt(tf) =>
hi = request.security(syminfo.tickerid, tf, high)
lo = request.security(syminfo.tickerid, tf, low)
cl = request.security(syminfo.tickerid, tf, close)
sh = request.security(syminfo.tickerid, tf, swingHigh(high, lookback))
sl = request.security(syminfo.tickerid, tf, swingLow(low, lookback))
raidHigh = not na(sh) and hi > sh and cl < sh
raidLow = not na(sl) and lo < sl and cl > sl
// store last raid state
var bool hadRaidHigh = false
var bool hadRaidLow = false
if raidHigh
hadRaidHigh := true
if raidLow
hadRaidLow := true
bosDown = hadRaidHigh and cl < sl
bosUp = hadRaidLow and cl > sh
// reset after BOS
if bosDown
hadRaidHigh := false
if bosUp
hadRaidLow := false
[raidHigh, raidLow, bosUp, bosDown]
// === Apply on H1 only first (test) ===
[raidHigh, raidLow, bosUp, bosDown] = f_crt("60")
// === Plot ===
plotshape(raidHigh, title="Raid High", style=shape.diamond, color=color.red, size=size.small, text="Raid High")
plotshape(raidLow, title="Raid Low", style=shape.diamond, color=color.green, size=size.small, text="Raid Low")
plotshape(bosDown, title="Bearish CRT", style=shape.triangledown, color=color.red, size=size.large, text="CRT↓")
plotshape(bosUp, title="Bullish CRT", style=shape.triangleup, color=color.green, size=size.large, text="CRT↑")
Skrypt open-source
W duchu TradingView twórca tego skryptu udostępnił go jako open-source, aby traderzy mogli analizować i weryfikować jego funkcjonalność. Brawo dla autora! Możesz korzystać z niego za darmo, ale pamiętaj, że ponowna publikacja kodu podlega naszym Zasadom Społeczności.
Wyłączenie odpowiedzialności
Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.
Skrypt open-source
W duchu TradingView twórca tego skryptu udostępnił go jako open-source, aby traderzy mogli analizować i weryfikować jego funkcjonalność. Brawo dla autora! Możesz korzystać z niego za darmo, ale pamiętaj, że ponowna publikacja kodu podlega naszym Zasadom Społeczności.
Wyłączenie odpowiedzialności
Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.