Added signal functionality to StochRSI 2
Set Default Resolution of StochRSI 1 to "D" and StochRSI 2 to "240"
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?
//  Originally scripted by ChrisMoody on October 23, 2014 for user platinumFX
//  Retooled by Quicksilver
//  Set Default Resolution StochRSI 1 to "D" and StochRSI 2 to "240"
//  Added signal functionality to StochRSI 2

study(title="Super Stoch", shorttitle="SS 2.0")

// Upper, Middle, and Lower line display options
midLine = input(true, title="Show Mid Line?")
upLine = input(70, minval=50, maxval=90, title="Upper Line")
lowLine = input(30, minval=10, maxval=50, title="Lower Line")


// Stoch 1 
// Signal Display Options
sch1 = input(true, title="Stoch1 Strict Crossing Background Hi-Lights?")
sl1 = input(true, title="Stoch1 Strict Crossing Display 'B' and 'S'?")
sac1 = input(false, title="Stoch1 All Crossings Background Hi-Lights?")
sacl1 = input(false, title="Stoch1 All Crossings Display 'B' and 'S'?")
// Stoch 1 Parameters
len = input(14, minval=1, title="Stoch1 Len") 
smoothK = input(3, minval=1, title="Stoch1 K")
smoothD = input(3, minval=1, title="Stoch1 D")
res = input(title="Stoch1 Resolution", type=resolution, defval="D")
//  Stoch 1 formula
k = sma(stoch(close, high, low, len), smoothK)
d = sma(k, smoothD)
outK = security(tickerid, res, k)
outD = security(tickerid, res, d)
// Strict Crossing Definitions
aboveLine = outK > upLine ? 1 : 0
belowLine = outK < lowLine ? 1 : 0
crossUp = (outK[1] < outD[1] and outK[1] < lowLine[1]) and (outK > outD)  ? 1 : 0
crossDn = (outK[1] > outD[1] and outK[1] > upLine[1]) and (outK < outD) ? 1 : 0
// Definition For Any Crossing
crossUpAll = (outK[1] < outD[1] and outK > outD) ? 1 : 0
crossDownAll = (outK[1] > outD[1] and outK < outD) ? 1 : 0

// Stoch 2 
// Signal Display Options
sch2 = input(true, title="Stoch2 Strict Crossing Background Hi-Lights?")
sl2 = input(true, title="Stoch2 Strict Crossing Display 'B' and 'S'?")
sac2 = input(false, title="Stoch2 All Crossings Background Hi-Lights?")
sacl2 = input(false, title="Stoch2 All Crossings Display 'B' and 'S'?")
// Stoch 2 Parameters
ssStoch = input(true, title="Show Stoch2 ?")
useCurrentRes2 = input(false, title="Use current timeframe For Stoch2 ?")
resCustom2 = input(title="Stoch2 Resolution", type=resolution, defval="240")
len2 = input(14, minval=1, title="Stoch2 Len")
smoothK2 = input(3, minval=1, title="Stoch2 K")
smoothD2 = input(3, minval=1, title="Stoch2 D")
res2 = useCurrentRes2 ? period : resCustom2
//  Stoch2 formula
k2 = sma(stoch(close, high, low, len2), smoothK2)
d2 = sma(k2, smoothD2)
outK2 = security(tickerid, res2, k2)
outD2 = security(tickerid, res2, d2)
// Strict Crossing Definitions
aboveLine2 = outK2 > upLine ? 1 : 0
belowLine2 = outK2 < lowLine ? 1 : 0
crossUp2 = (outK2[1] < outD2[1] and outK2[1] < lowLine[1]) and (outK2 > outD2)  ? 1 : 0
crossDn2 = (outK2[1] > outD2[1] and outK2[1] > upLine[1]) and (outK2 < outD2) ? 1 : 0
// Definition For Any Crossing
crossUpAll2 = (outK2[1] < outD2[1] and outK2 > outD2) ? 1 : 0
crossDownAll2 = (outK2[1] > outD2[1] and outK2 < outD2) ? 1 : 0

// Plot Lines
p1 = plot(upLine, title= "Upper Line", style=solid, linewidth=1, color=gray)
p2 = plot(lowLine, title= "Lower Line", style=solid, linewidth=1, color=gray)
plot(midLine and 50 ? 50 : na, title="Mid Line", style=linebr, linewidth=1, color=gray)

// BackGroound Color Plots
bgcolor(sch1 and crossUp ? lime : na, transp=80)
bgcolor(sch1 and crossDn ? red : na, transp=80)
bgcolor(sch2 and crossUp2 ? #33FFFC : na, transp=80)
bgcolor(sch2 and crossDn2 ? orange : na, transp=80)

//plots for Cross with no filter
bgcolor(sac1 and crossUpAll ? lime : na, transp=80)
bgcolor(sac1 and crossDownAll ? red : na, transp=80)
bgcolor(sac2 and crossUpAll2 ? #33FFFC : na, transp=80)
bgcolor(sac2 and crossDownAll2 ? orange : na, transp=80)

//Plot Stoch1
plot(outK, title="Stoch1 K", style=line, linewidth=1, color=lime)
plot(outD, title="Stoch1 D", style=line, linewidth=1, color=red)

// Plot Stoch2
plot(ssStoch and outK2 ? outK2 : na, title="Stoch2 K", style=line, linewidth=1, color=#33FFFC)
plot(ssStoch and outD2 ? outD2 : na, title="Stoch2 D", style=line, linewidth=1, color=orange)


plotchar(sl1 and crossUp ? crossUp : na, title="Strict Buy 1", char='B', location=location.bottom, color=lime, transp=0, offset=0,size=size.auto)
plotchar(sl1 and crossDn ? crossDn : na, title="Strict Sell 1", char='S', location=location.top, color=red, transp=0, offset=0,size=size.auto)
plotchar(sacl1 and crossUpAll ? crossUpAll : na, title="Any Buy 1", char='B', location=location.bottom, color=lime, transp=0, offset=0,size=size.auto)
plotchar(sacl1 and crossDownAll ? crossDownAll : na, title="Any Sell 1", char='S', location=location.top, color=red, transp=0, offset=0,size=size.auto)

plotchar(sl2 and crossUp2 ? crossUp2 : na, title="Strict Buy 2", char='b', location=location.bottom, color=#33FFFC, transp=0, offset=0,size=size.auto)
plotchar(sl2 and crossDn2 ? crossDn2 : na, title="Strict Sell 2", char='s', location=location.top, color=orange, transp=0, offset=0,size=size.auto)
plotchar(sacl2 and crossUpAll2 ? crossUpAll2 : na, title="Any Buy 2", char='b', location=location.bottom, color=#33FFFC, transp=0, offset=0,size=size.auto)
plotchar(sacl2 and crossDownAll2 ? crossDownAll2 : na, title="Any Sell 2", char='s', location=location.top, color=orange, transp=0, offset=0,size=size.auto)



// end