CapnOscar

CapnsSurferV2

Captain Surfer Version 2
Flags just informs you reversal of Stoch RSI different time Frames Its not Buy and Sell Indicator Use carefully
Script de código aberto

Dentro do verdadeiro espírito TradingView, o autor deste script publicou ele como um script de código aberto, para que os traders possam compreender e checar ele. Um viva ao autor! Você pode usá-lo gratuitamente, mas a reutilização deste código em uma publicação é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.

Quer usar esse script no gráfico?
//@author CapnOscar 
study(shorttitle="CapnsSurferV2", title="CapnsSurferV2", overlay=true)

//Define Variables 
uprsi = 51
dorsi = 49

tfsmall = period == "3" ? "1" : period == "5" ? "3" : period == "15" ? "5" : period == "30" ? "15" : period == "60" ? "15" : period == "240" ? "60" : "5"
tfbig = period == "3" ? "5" : period == "5" ? "15" : period == "15" ? "60" : period == "30" ? "60" : period == "60" ? "240" : period == "240" ? "D" : "60"
tfmaj = period == "3" ? "15" : period == "5" ? "60" : period == "15" ? "240" : period == "60" ? "D" : period == "240" ? "W" : period == "D" ? "M" : "D"


//MajorTrend
major = close, majlen = input(84, minval=1, title="MajorTrend RSI" )
majup = rma(max(change(major), 0), majlen)
majdo = rma(-min(change(major), 0), majlen)
majtrend = majdo == 0 ? 100 : majup == 0 ? 0 : 100 - (100 / (1 + majup / majdo))
//ColorMajorRSI
majcol = majtrend > uprsi ? lime : majtrend < dorsi ? red : yellow

//Define Donchian Bollinger
back = input(2, minval=0)
price = close
range = input(2, minval=0)
lower = lowest(majlen/range)
upper = highest(majlen/range)
basis = avg(upper[back], lower[back])
trend = rma(price, majlen)
l = plot(lower[back], color=silver)
u = plot(upper[back], color=silver)
MajTr = plot(trend[back], linewidth= 4, color=majcol)
fill(u, MajTr, color=blue, transp=95)
fill(MajTr, l, color=red, transp=95)



//Define Mas
hiout = rma(high, 3)
loout = rma(low, 3)
avrma = rma(close, 8)
//Define 20Mas
hiout2 = rma(high, 20)
loout2 = rma(low, 20)

avMa= plot(avrma, color=silver, linewidth= 2, title="TPLine")

//ColorTrueMa
truemacol = hiout > trend ? green : loout < trend ? red : yellow
truema = hiout > trend ? loout : loout < trend ? hiout : avg(hiout,loout)
truMa= plot(truema, color=truemacol, linewidth= 1, title="TinyTrend")

//ColorTrueMa2
truemacol2 = hiout2 > trend ? green : loout2 < trend ? red : yellow
truema2 = hiout2 > trend ? loout2 : loout2 < trend ? hiout2 : avg(hiout2,loout2)
truMa2= plot(truema2, color=truemacol2, linewidth= 1, title="SmallTrend")

fill(truMa, MajTr, color=aqua, transp=90)
fill(truMa2, MajTr, color=blue, transp=90)



smoothK = input(3, minval=1)
smoothD = input(3, minval=1)
lengthRSI = input(10, minval=1)
lengthStoch = input(10, minval=1)
src = input(close, title="RSI Source")

rsi1 = rsi(src, lengthRSI)
k = sma(stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)
d = sma(k, smoothD)

smoothK2 = input(3, minval=1)
smoothD2 = input(3, minval=1)
lengthRSI2 = input(5, minval=1)
lengthStoch2 = input(5, minval=1)
src2 = input(close, title="RSI Source")

rsi2 = rsi(src2, lengthRSI2)
k2 = sma(stoch(rsi2, rsi2, rsi2, lengthStoch2), smoothK2)
d2 = sma(k2, smoothD2)

ksmall = security(tickerid, tfsmall, k2)
kbig = security(tickerid, tfbig, k2)
kmaj = security(tickerid, tfmaj, k2)


Short = k > 79 and d2 > 79  and falling(d2,1) and falling(k,1) and truema > truema2 ? high : na
plotshape(Short, style=shape.labeldown, location=location.abovebar, transp= 0, text='^', color=blue, textcolor=white)

Long = k < 19 and d2 < 19  and rising(d2,1) and rising(k,1) and truema < truema2 ? low : na
plotshape(Long, style=shape.labelup, location=location.belowbar, transp= 0, text='v', color=blue, textcolor=white)

smshort = ksmall > 79 and falling(ksmall,1) ? high : na
plotshape(smshort, style=shape.labeldown, location=location.abovebar, transp= 0, text='^', color=red, textcolor=white)

smlong = ksmall < 21 and rising(ksmall,1) ? high : na
plotshape(smlong, style=shape.labelup, location=location.belowbar, transp= 0, text='v', color=red, textcolor=white)

bgshort = kbig > 79 and falling(kbig,1) ? high : na
plotshape(bgshort, style=shape.labeldown, location=location.abovebar, transp= 0, text='^', color=black, textcolor=white)

bglong = kbig < 21 and rising(kbig,1) ? high : na
plotshape(bglong, style=shape.labelup, location=location.belowbar, transp= 0, text='v', color=black, textcolor=white)

mjshort = kmaj > 79 and falling(kmaj,1) ? high : na
plotshape(mjshort, style=shape.labeldown, location=location.abovebar, transp= 0, text='^', color=aqua, textcolor=white)

mjlong = kmaj < 21 and rising(kmaj,1) ? high : na
plotshape(mjlong, style=shape.labelup, location=location.belowbar, transp= 0, text='v', color=aqua, textcolor=white)