//@version=5
indicator('ULTIMATE-12IN1 (BY KHO_OLIO)-2023', shorttitle='12IN1 FRAME BY KHOOLIO-2023', overlay=true,  scale=scale.left,timeframe ='' )
import TradingView/ta/5



//BANDS strength
normal1 = ta.ema(high, 4)
normal2 = ta.ema(low, 4)
normal3 = ta.ema(high, 7)
normal4 = ta.ema(low, 7)
normal5 = ta.wma(high, 4)
normal6 = ta.wma(low, 4)
normal7 = ta.wma(high, 7)
normal8 = ta.wma(low, 7)
up1 = normal1 > normal3 and normal2 > normal4
down1 = normal2 < normal4 and normal1 < normal3
up2 = normal5 > normal7 and normal6 > normal8
down2 = normal6 < normal8 and normal5 < normal7
bandupi = up1 and up2 and normal1 > normal1[1] and normal3 > normal3[1] and normal2 > normal2[1] and normal4 > normal4[1] and normal5 > normal5[1] and normal7 > normal7[1] and normal6 > normal6[1] and normal8 > normal8[1]
banddowni = down1 and down2 and normal2 < normal2[1] and normal4 < normal4[1] and normal1 < normal1[1] and normal3 < normal3[1] and normal6 < normal6[1] and normal8 < normal8[1] and normal5 < normal5[1] and normal7 < normal7[1]



//MACD strength 
fast = ta.ema(close, 50)
slow = ta.ema(close, 64)
MACD = fast - slow
signal = ta.ema(MACD, 47)
hist = MACD - signal
macdupi = MACD > signal and hist > hist[1] or MACD < signal and hist > hist[1]
macddowni = MACD < signal and hist < hist[1] or MACD > signal and hist < hist[1]



//PARABOLICSAR strength
out = ta.sar(0.02, 0.022, 0.2)
sarupi = close > out and out > out[1]
sardowni = close < out and out < out[1]



//RSI strength 
RSI1s = ta.ema(ta.rsi(close, 14), 7)
RSI1 = ta.ema(RSI1s, 7)
RSI2s = ta.ema(RSI1, 7)
RSI2 = ta.ema(RSI2s, 7)
rsiupi = RSI1 > RSI2
rsidowni = RSI1 < RSI2



//Stochastic strength
STOCHKs = ta.ema(ta.stoch(close, high, low, 14), 3)
STOCHK = ta.ema(STOCHKs, 3)
STOCHDs = ta.ema(STOCHK, 3)
STOCHD = ta.ema(STOCHDs, 3)
stochupi = STOCHK > STOCHD
stochdowni = STOCHK < STOCHD



//CCI strength
CCI1s = ta.ema(ta.cci(close, 14), 14)
CCI1 = ta.ema(CCI1s, 14)
CCI2s = ta.ema(CCI1, 4)
CCI2 = ta.ema(CCI2s, 4)
cciupi = CCI1 > CCI2
ccidowni = CCI1 < CCI2



//ADX strength
TrueRange = math.max(math.max(high - low, math.abs(high - nz(close[1]))), math.abs(low - nz(close[1])))
DirectionalMovementPlus = high - nz(high[1]) > nz(low[1]) - low ? math.max(high - nz(high[1]), 0) : 0
DirectionalMovementMinus = nz(low[1]) - low > high - nz(high[1]) ? math.max(nz(low[1]) - low, 0) : 0
SmoothedTrueRange = nz(TrueRange[1]) - nz(TrueRange[1]) / 14 + TrueRange
SmoothedDirectionalMovementPlus = nz(DirectionalMovementPlus[1]) - nz(DirectionalMovementPlus[1]) / 14 + DirectionalMovementPlus
SmoothedDirectionalMovementMinus = nz(DirectionalMovementMinus[1]) - nz(DirectionalMovementMinus[1]) / 14 + DirectionalMovementMinus
DIPlus = SmoothedDirectionalMovementPlus / SmoothedTrueRange * 100
DIMinus = SmoothedDirectionalMovementMinus / SmoothedTrueRange * 100
DX = math.abs(DIPlus - DIMinus) / (DIPlus + DIMinus) * 100
ADX = ta.ema(DX, 14)
ADIPLUS = ta.ema(DIPlus, 14)
ADIMINUS = ta.ema(DIMinus, 14)
adxupi = ADIPLUS > ADIMINUS and ADX > 20
adxdowni = ADIPLUS < ADIMINUS and ADX > 20



//ATR strength 
atr2s = ta.ema(ta.tr, 7)
atr2 = ta.ema(atr2s, 7)
atr = ta.atr(7)
up = hl2 - 0.4 * atr
upr = nz(up[1], up)
up := close[1] > upr ? math.max(up, upr) : up
dn = hl2 + 0.4 * atr
dnr = nz(dn[1], dn)
dn := close[1] < dnr ? math.min(dn, dnr) : dn
trend = 1
trend := nz(trend[1], trend)
trend := trend == -1 and close > dnr ? 1 : trend == 1 and close < upr ? -1 : trend
Atrup = trend == 1 and trend[1] == -1
Atrdown = trend == -1 and trend[1] == 1
atrup = close > upr and trend == 1
atrdown = close < dnr and trend == -1



//Trend direction&strengthBars
td1s = ta.ema(close, 4)
td1 = ta.ema(td1s, 4)
td2s = ta.ema(open, 4)
td2 = ta.ema(td2s, 4)
tdup = td1 > td2
tddown = td1 < td2
tdupi = tdup
tddowni = tddown
tdups = tdup
tddowns = tddown
tbupi = tdup and close > td1
tbdowni = tddown and close < td1



//volume 
p1 = close
v1 = volume
p2 = p1[21]
v2 = v1[21]
va1 = p1 > p2 and v1 > v2
va2 = p1 > p2 and v1 < v2
va3 = p1 < p2 and v1 < v2
va4 = p1 < p2 and v1 > v2
vaupi = va1 or va2
vadowni = va3 or va4



//Bullish & Bearish strength 
bbsource = (close > open) ? (high-low) : (low-high)
bbupi = (ta.ema(bbsource, 3)) > 0
bbdowni = (ta.ema(bbsource, 3)) < 0



//Indicator strength&alert
x = 1
y = -1
z = 0
bandupn = bandupi ? x : z
banddownn = banddowni ? y : z
macdupn = macdupi ? x : z
macddownn = macddowni ? y : z
sarupn = sarupi ? x : z
sardownn = sardowni ? y : z
rsiupn = rsiupi ? x : z
rsidownn = rsidowni ? y : z
stochupn = stochupi ? x : z
stochdownn = stochdowni ? y : z
cciupn = cciupi ? x : z
ccidownn = ccidowni ? y : z
adxupn = adxupi ? x : z
adxdownn = adxdowni ? y : z
atrupn = atrup ? x : z
atrdownn = atrdown ? y : z
tdupn = tdupi ? x : z
tddownn = tddowni ? y : z
tbupn = tbupi ? x : z
tbdownn = tbdowni ? y : z
vaupn = vaupi ? x : z
vadownn = vadowni ? y : z
bbupn = bbupi ? x : z
bbdownn = bbdowni ? y : z
a = bandupn == 0 and banddownn == 0
b = macdupn == 0 and macddownn == 0
c = sarupn == 0 and sardownn == 0
d = rsiupn == 0 and rsidownn == 0
e = stochupn == 0 and stochdownn == 0
f = cciupn == 0 and ccidownn == 0
g = adxupn == 0 and adxdownn == 0
h = atrupn == 0 and atrdownn == 0
i = tdupn == 0 and tddownn == 0
j = tbupn == 0 and tbdownn == 0
k = vaupn == 0 and vadownn == 0
m = bbupn == 0 and bbdownn == 0
bandn = a ? x : z
macdn = b ? x : z
sarn = c ? x : z
rsin = d ? x : z
stochn = e ? x : z
ccin = f ? x : z
adxn = g ? x : z
atrn = h ? x : z
tdn = i ? x : z
tbn = j ? x : z
van = k ? x : z
bbn = m ? x : z

indicatorresualt = bandupn + banddownn + macdupn + macddownn + sarupn + sardownn + rsiupn + rsidownn + stochupn + stochdownn + cciupn + ccidownn + adxupn + adxdownn + atrupn + atrdownn + tdupn + tddownn + tbupn + tbdownn + vaupn + vadownn + bbupn + bbdownn
indicatorp = input(defval = 3, title='indicator Length')
ipush = ta.ema(indicatorresualt, indicatorp)
ipushcolor = ipush > ipush[1] ? color.new(color.aqua,0) : ipush < ipush[1] ? color.new(color.orange,0):na
plot(ipush, title='Market Sentiments', style=plot.style_circles, linewidth=4, color=color.new(ipushcolor,30),editable = false)
hline(0,color=color.new(color.black,50),linestyle =hline.style_dashed,linewidth = 1,editable = false)
h1=hline(8.4,color=color.new(color.black,100),linestyle =hline.style_solid,linewidth = 3,editable = false)
h2=hline(12,color=color.new(color.black,100),linestyle =hline.style_solid,linewidth = 3,editable = false)
h3=hline(-8.4,color=color.new(color.black,100),linestyle =hline.style_solid,linewidth = 3,editable = false)
h4=hline(-12,color=color.new(color.black,100),linestyle =hline.style_solid,linewidth = 3,editable = false)
fill(h1,h2,color.new(color.orange,90),editable = false)
fill(h3,h4,color.new(color.aqua,90),editable = false)





//fibonacci
high_point = ta.highest(ipush,indicatorp)
low_point = ta.lowest(ipush, indicatorp)
fib0 = high_point
fib1 = low_point
f0p = plot(fib0, title='OB', style=plot.style_linebr, linewidth=1, color=color.new(color.black,0),display = display.pane,editable = false)
f1p = plot(fib1, title='OS', style=plot.style_linebr, linewidth=1, color=color.new(color.black,0),display = display.pane,editable = false)