//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[1] > highs[1] and close[1] < highs[1]) and close > close[1]
isBearishOB = (low[1] < lows[1] and close[1] > lows[1]) and close < close[1]

// Plot Order Blocks
if showOB
if isBullishOB
box.new(left=bar_index[1], right=bar_index, top=highs[1], bottom=close[1], color=color.new(color.green, 80), border_color=color.green)
if isBearishOB
box.new(left=bar_index[1], right=bar_index, top=close[1], bottom=lows[1], color=color.new(color.red, 80), border_color=color.red)

// === FAIR VALUE GAPS ===
fvgUp = (low[2] > high) and (low[1] > high[1])
fvgDown = (high[2] < low) and (high[1] < low[1])

// Plot FVG
if showFVG
if fvgUp
line.new(x1=bar_index[2], y1=low[2], x2=bar_index[1], y2=high[1], color=color.new(color.green, 50), width=2)
if fvgDown
line.new(x1=bar_index[2], y1=high[2], x2=bar_index[1], y2=low[1], color=color.new(color.red, 50), width=2)

// === BREAKERS ===
breakerHigh = ta.valuewhen(isBearishOB, highs[1], 0)
breakerLow = ta.valuewhen(isBullishOB, lows[1], 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")
Trend Analysis

כתב ויתור