// 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 Inducement Tracker", overlay=true, max_labels_count=500) internalLen = input.int(3, "Internal swing length", minval=1) externalLen = input.int(30, "External range lookback", minval=5) proximityPct = input.float(0.35, "Distance to liquidity %", step=0.05) pctAway(a, b) => math.abs(a - b) / nz(b == 0.0 ? na : b, a) * 100 pivotHigh = ta.pivothigh(high, internalLen, internalLen) pivotLow = ta.pivotlow(low, internalLen, internalLen) externalHigh = ta.highest(high, externalLen) externalLow = ta.lowest(low, externalLen) induHigh = not na(pivotHigh) and pivotHigh < externalHigh and pctAway(pivotHigh, externalHigh) <= proximityPct induLow = not na(pivotLow) and pivotLow > externalLow and pctAway(pivotLow, externalLow) <= proximityPct plotshape(induHigh, title="Bullish inducement", style=shape.labeldown, color=color.new(color.orange, 0), text="Induce↑", location=location.abovebar, offset=-internalLen) plotshape(induLow, title="Bearish inducement", style=shape.labelup, color=color.new(color.blue, 0), text="Induce↓", location=location.belowbar, offset=-internalLen) bgcolor(induHigh ? color.new(color.orange, 90) : induLow ? color.new(color.blue, 90) : na)