Paranoia Indicator
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © PepCurses

//@version=5 
indicator(title="Paranoia Indicator", shorttitle="Paranoia Indicator --> 3 in 1") 
 
//RSI 
rsiLengthInput = 27 
rsiSourceInput = (close) 
up = ta.rma(math.max(ta.change(rsiSourceInput), 0), rsiLengthInput) 
down = ta.rma(-math.min(ta.change(rsiSourceInput), 0), rsiLengthInput) 
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down)) 
aaa=(rsi-50)/50 
 
//MACD  
fast = 6 
slow = 60 
fastMA = ta.ema(close, fast) 
slowMA = ta.ema(close, slow) 
macd = (fastMA / slowMA) 
signal = ta.ema(macd, 10) 
bbb=(macd/signal-1)*100 
 
//Stochastic 
periodK = 70 
smoothK = 10 
k = ta.sma(ta.stoch(close, high, low, periodK), smoothK) 
ccc = (k-50)/50 

//Paranoia fórmula 
paranoia = (((aaa*23.6)+(bbb*61.8)+(ccc*14.6))/3)/10 

//Color IP "santy cruz" 
colorparanoia = paranoia>paranoia[1]?  color.rgb(0, 255, 0, 10) : color.rgb(255, 0, 0, 10) 
p1 = plot(paranoia, title="Color del Ind. Paranoia", linewidth=4, color = colorparanoia) 
p2 = plot(paranoia, title="Color de fondo del IP", color = paranoia>0.00? color.rgb(0, 255, 255, 50) : color.rgb(255, 235, 59, 50), style=plot.style_area)  
 
//Filtre o Mitja 
filtre = ta.ema(paranoia, 8) // es la mitja del paranoia 
plot(filtre, title="Filtro", color=color.white, linewidth=2) 
 
//Bandes Internes Violetes
band=(ta.sma(paranoia, 60)) 
mul=1.1*(ta.stdev(paranoia, 60)) 
bandsup=band+mul 
bandinf=band-mul 
 
plot(bandsup,title="Band Superior", linewidth=1, style=plot.style_circles, color= color.new(color.purple,10)) 
plot(bandinf,title="Band Inferior", linewidth=1, style=plot.style_circles, color= color.new(color.purple,10)) 
 
//Bandes Exteriors Gris
bandext= ta.wma(paranoia, 89) 
mulext=1.8*(ta.stdev(paranoia, 89)) 
bandsupext=bandext+mulext 
bandinfext=bandext-mulext 

plot(bandsupext,title="Band Externa Superior", linewidth=3, color= color.new(color.white,72)) 
plot(bandinfext,title="Band Externa Inferior", linewidth=3, color= color.new(color.white,72)) 
bgcolor(title="Color de fondo",color=color.new(color.gray,85))




