// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © AI_PIPS //@version=6 indicator("AIPIPS Smart Entry Model", overlay=true) structureLen = input.int(20, "Structure lookback", minval=5) emaLen = input.int(50, "Directional EMA", minval=1) confirmBars = input.int(3, "Bars to confirm", minval=1) ema = ta.ema(close, emaLen) trendUp = close > ema trendDown = close < ema bosUp = close > ta.highest(high[1], structureLen) bosDown = close < ta.lowest(low[1], structureLen) bullishFVG = low[1] > high[2] bearishFVG = high[1] < low[2] longSignal = trendUp and bosUp and bullishFVG[confirmBars] shortSignal = trendDown and bosDown and bearishFVG[confirmBars] plot(ema, title="EMA Filter", color=color.gray) plotshape(longSignal, title="Smart Long", style=shape.labelup, text="AIPIPS Long", color=color.new(color.green, 0), textcolor=color.white) plotshape(shortSignal, title="Smart Short", style=shape.labeldown, text="AIPIPS Short", color=color.new(color.red, 0), textcolor=color.white) bgcolor(longSignal ? color.new(color.green, 92) : shortSignal ? color.new(color.red, 92) : na)