//@version=5 indicator(shorttitle="TTP BB+ RSI + VOL", title="TTP BB+ RSI + VOL", overlay=true, timeframe="", timeframe_gaps=false) // BB length = input.int(25, minval=1) src = input(close, title="Source") mult = input.float(2.0, minval=0.001, maxval=50, title="StdDev") basis = ta.sma(src, length) dev = mult * ta.stdev(src, length) upper = basis + dev lower = basis - dev offset = input.int(0, "Offset", minval = -500, maxval = 500) // VOL lengthVol = 130 coef = 0.2 vcoef = 2.5 signalLength=5 smoothVFI=false ma(x,y) => smoothVFI ? ta.sma(x,y) : x typical=hlc3 inter = math.log( typical ) - math.log( typical[1] ) vinter = ta.stdev(inter, 30 ) cutoff = coef * vinter * close vave = ta.sma( volume, lengthVol )[1] vmax = vave * vcoef vc = volume < vmax ? volume : vmax //min( volume, vmax ) mf = typical - typical[1] vcp = mf > cutoff ? vc : mf < -cutoff ? -vc : 0 vfi = ta.sma(math.sum( vcp , lengthVol )/vave, 3) vfima=ta.ema( vfi, signalLength ) d=vfi-vfima plot(vfi, "vfi") plot(vfima, "vfima") // RSI rsiLengthInput = 8 maTypeInput ="VWMA" maLengthInput = 14 bbMultInput = 2.0 up = ta.rma(math.max(ta.change(close), 0), rsiLengthInput) down = ta.rma(-math.min(ta.change(close), 0), rsiLengthInput) rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down)) rsiMA = ta.vwma(rsi, length) plot(rsi, "rsi") plot(rsiMA, "rsiMA") counterTrend = input(false) ma = ta.ema(close, 200) buysignal = ta.crossover(close, upper) and rsi > rsiMA and rsi > 65 and vfi > vfima and vfi > 0 and (counterTrend ? close < ma and open < ma : close > ma and open > ma) sellsignal = ta.crossunder(close, lower) and rsi < rsiMA and rsi < 35 and vfi < vfima and vfi < 0 and (counterTrend ? close > ma and open > ma: close < ma and open < ma) plot(buysignal ? 1: sellsignal ? 2 : 0 , "signal", color = na) plotshape(buysignal, "B", style = shape.labelup, location = location.belowbar, color = color.green, textcolor = color.white, text = "B") plotshape(sellsignal, "S", style = shape.labeldown, location = location.abovebar, color = color.red, textcolor = color.white, text = "S")