// 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 SMT Divergence Suite", overlay=true) compSymbol = input.symbol("TVC:DXY", "Comparison symbol") lookback = input.int(20, "Swing lookback", minval=2) compClose = request.security(compSymbol, timeframe.period, close) compHigh = request.security(compSymbol, timeframe.period, high) compLow = request.security(compSymbol, timeframe.period, low) legitHigherHigh(src) => src > ta.highest(src[1], lookback) legitLowerLow(src) => src < ta.lowest(src[1], lookback) priceHH = legitHigherHigh(high) priceLL = legitLowerLow(low) compHH = legitHigherHigh(compHigh) compLL = legitLowerLow(compLow) bearDiv = priceHH and not compHH bullDiv = priceLL and not compLL plotshape(bearDiv, title="SMT Bear", text="SMT↓", style=shape.labeldown, color=color.new(color.red, 0)) plotshape(bullDiv, title="SMT Bull", text="SMT↑", style=shape.labelup, color=color.new(color.green, 0)) plot(compClose / close * 100, title="Relative strength", color=color.new(color.blue, 0))