ICT TRADE
//@version=5
indicator("ICT Strategy Helper", overlay=true)
// === INPUTS ===
obLookback = input.int(20, title="Order Block Lookback Period", minval=1)
showOB = input.bool(true, title="Show Order Blocks")
showFVG = input.bool(true, title="Show Fair Value Gaps (FVG)")
showBreakers = input.bool(true, title="Show Breakers")
// === ORDER BLOCKS ===
highs = ta.highest(high, obLookback)
lows = ta.lowest(low, obLookback)
isBullishOB = (high > highs and close < highs) and close > close
isBearishOB = (low < lows and close > lows) and close < close
// Plot Order Blocks
if showOB
if isBullishOB
box.new(left=bar_index, right=bar_index, top=highs, bottom=close, color=color.new(color.green, 80), border_color=color.green)
if isBearishOB
box.new(left=bar_index, right=bar_index, top=close, bottom=lows, color=color.new(color.red, 80), border_color=color.red)
// === FAIR VALUE GAPS ===
fvgUp = (low > high) and (low > high)
fvgDown = (high < low) and (high < low)
// Plot FVG
if showFVG
if fvgUp
line.new(x1=bar_index, y1=low, x2=bar_index, y2=high, color=color.new(color.green, 50), width=2)
if fvgDown
line.new(x1=bar_index, y1=high, x2=bar_index, y2=low, color=color.new(color.red, 50), width=2)
// === BREAKERS ===
breakerHigh = ta.valuewhen(isBearishOB, highs, 0)
breakerLow = ta.valuewhen(isBullishOB, lows, 0)
isBullishBreaker = close > breakerHigh
isBearishBreaker = close < breakerLow
// Plot Breakers
if showBreakers
if isBullishBreaker
label.new(bar_index, high, "Bullish Breaker", style=label.style_label_up, color=color.new(color.green, 50), textcolor=color.white)
if isBearishBreaker
label.new(bar_index, low, "Bearish Breaker", style=label.style_label_down, color=color.new(color.red, 50), textcolor=color.white)
// === ALERT CONDITIONS ===
alertcondition(isBullishBreaker, title="Bullish Breaker", message="Bullish Breaker Identified")
alertcondition(isBearishBreaker, title="Bearish Breaker", message="Bearish Breaker Identified")
alertcondition(fvgUp, title="Fair Value Gap Up", message="Bullish Fair Value Gap Detected")
alertcondition(fvgDown, title="Fair Value Gap Down", message="Bearish Fair Value Gap Detected")