// 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 Multi-Frame Volume Story", overlay=false) htf = input.timeframe("240", "Higher timeframe") mtf = input.timeframe("60", "Mid timeframe") volSmaLen = input.int(20, "Volume SMA", minval=1) htfVol = request.security(syminfo.tickerid, htf, ta.sma(volume, volSmaLen)) mtfVol = request.security(syminfo.tickerid, mtf, ta.sma(volume, volSmaLen)) ltVol = ta.sma(volume, volSmaLen) htfDelta = (htfVol - mtfVol) / math.max(mtfVol, 1) mtfDelta = (mtfVol - ltVol) / math.max(ltVol, 1) plot(htfDelta, title="HTF vs MTF", color=color.new(color.blue, 0), linewidth=2) plot(mtfDelta, title="MTF vs LTF", color=color.new(color.purple, 0)) bgcolor(htfDelta > 0 and mtfDelta > 0 ? color.new(color.green, 92) : htfDelta < 0 and mtfDelta < 0 ? color.new(color.red, 92) : na)