rubend18

4 Rules of the Daven Icao

//4 Rules of the Daven Icao
//Programado por Ruben Jaramillo


study(title="4 Rules of the Daven Icao", shorttitle="4rules")

p11 = plot(15, color=white, transp=60, editable=false)
p10 = plot(10, color=black, transp=60, editable=false)
p5 = plot(5, color=black, transp=60, editable=false)
p0 = plot(0, color=black, transp=60, editable=false)
fill(p10, p5, color=red, transp=90, editable=false)
fill(p5, p0, color=blue, transp=90, editable=false)

//BB(20,close,2)
length1 = input(20, minval=1, title="BB - Longitud")
src1 = input(close, title="BB - Fuente")
mult = input(2.0, minval=0.001, maxval=50, title="BB - Desv Est")
basis = sma (src1, length1)
dev = mult * stdev(src1, length1)
upper = basis + dev
lower = basis - dev
x1 = (close <= lower)
y1 = (close >= upper)
plot(x1 ? 4 : na, color=blue, style=circles, linewidth=4, title="BB - Compra")
plot(y1 ? 9 : na, color=red, style=circles, linewidth=4, title="BB - Venta")

//RSI(14,close)
src2 = close, len = input(14, minval=1, title="RSI - Longitud")
up = rma(max(change(src2), 0), len )
down = rma(-min(change(src2), 0), len )
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
x2 = ( rsi <= 30)
y2 = ( rsi >= 70)
plot(x2 ? 3 : na, color=blue, style=circles, linewidth=4, title="RSI - Compra")
plot(y2 ? 8 : na, color=red, style=circles, linewidth=4, title="RSI - Venta")

//STOCH(14,3,1)
length3 = input(14, minval=1, title="STOCH - Longitud")
smoothK = input(1, minval=1, title="STOCH - K")
smoothD = input(3, minval=1, title="STOCH - D")
k = sma ( stoch (close, high, low, length3), smoothK)
d = sma (k, smoothD)
x3 = (cross(k, d) and k <= 20 and d <= 20)
y3 = (cross(k, d) and k >= 80 and d >= 80)
plot(x3 ? 2 : na, color=blue, style=circles, linewidth=4, title="STOCH - Compra")
plot(y3 ? 7 : na, color=red, style=circles, linewidth=4, title="STOCH - Venta")

//MACD(12,26,9)
fastLength = input(12, minval=1, title="MACD - Venta")
slowLength=input(26, minval=1, title="MACD - Venta")
signalLength=input(9, minval=1, title="MACD - Venta")
fastMA = ema (close, fastLength)
slowMA = ema (close, slowLength)
macd = fastMA - slowMA //AZUL
signal = ema ( macd , signalLength) //ROJO
hist = macd - signal //HISTOGRAMA
x4 = (cross( macd , signal) and macd < 0)
y4 = (cross( macd , signal) and macd > 0)
plot(x4 ? 1 : na, color=blue, style=circles, linewidth=4, title="MACD - Compra")
plot(y4 ? 6 : na, color=red, style=circles, linewidth=4, title="MACD - Venta")

plot(x1 and x2 and x3 ? 10 : na, color=blue, style=histogram, linewidth=3, editable=false)
plot(y1 and y2 and y3 ? 10 : na, color=red, style=histogram, linewidth=3, editable=false)
plot(x2 and x3 and x4 ? 10 : na, color=blue, style=histogram, linewidth=3, editable=false)
plot(y2 and y3 and y4 ? 10 : na, color=red, style=histogram, linewidth=3, editable=false)
plot(x1 and x2 and x4 ? 10 : na, color=blue, style=histogram, linewidth=3, editable=false)
plot(y1 and y2 and y4 ? 10 : na, color=red, style=histogram, linewidth=3, editable=false)
plot(x1 and x3 and x4 ? 10 : na, color=blue, style=histogram, linewidth=3, editable=false)
plot(y1 and y3 and y4 ? 10 : na, color=red, style=histogram, linewidth=3, editable=false)

plot(x1 and x2 and x3 and x4 ? 10 : na, color=blue, style=histogram, linewidth=4, editable=false)
plot(y1 and y2 and y3 and y4 ? 10 : na, color=red, style=histogram, linewidth=4, editable=false)

Release Notes: .
4 Rules of the Daven Icao V2.0
Release Notes: Source code obfuscated
Remove from Favorite Scripts Add to Favorite Scripts
Home Stock Screener Forex Screener Crypto Screener Economic Calendar How It Works Chart Features Pricing House Rules Moderators Website & Broker Solutions Widgets Charting Solutions Help Center Feature Request Blog & News FAQ Wiki Twitter
Profile Profile Settings Account and Billing TradingView Coins My Support Tickets Help Center Ideas Published Followers Following Private Messages Chat Sign Out