Super Stoch Update
// Short Name Changed To "SS 3.0"
// Added a third StochRSI.
// Default resolutions S1= W, S2= D, S3= 240 (4H)
// Signal function for all StochRSI's.
// Made a Variety of Cosmetic Changes
开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?
//  Original idea scripted by ChrisMoody on October 23, 2014 for user platinumFX
//  Retooled by Quicksilver
//  Added a third StochRSI.
//  Default resolutions S1= W, S2= D, S3= 240 (4H)
//  Signal function for all StochRSI's.
//  Made a Variety of Cosmetic Changes

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

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

// Stoch 1 Parameters
res = input(title="Stoch1 Resolution", type=resolution, defval="W")
len = input(14, minval=1, title="Stoch1 Length") 
smoothK = input(3, minval=1, title="Stoch1 K")
smoothD = input(3, minval=1, title="Stoch1 D")
// 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 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 Parameters
Stoch2 = input(true, title="Show Stoch2 ?")
useCurrentRes2 = input(false, title="Use Current Resolution For Stoch2 ?")
resCustom2 = input(title="Stoch2 Resolution", type=resolution, defval="D")
len2 = input(14, minval=1, title="Stoch2 Length")
smoothK2 = input(3, minval=1, title="Stoch2 K")
smoothD2 = input(3, minval=1, title="Stoch2 D")
res2 = useCurrentRes2 ? period : resCustom2
// 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'?")
//  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

// Stoch 3 Parameters
Stoch3 = input(true, title="Show Stoch3 ?")
useCurrentRes3 = input(false, title="Use Current Resolution For Stoch3 ?")
resCustom3 = input(title="Stoch3 Resolution", type=resolution, defval="240")
len3 = input(14, minval=1, title="Stoch3 Len")
smoothK3 = input(3, minval=1, title="Stoch3 K")
smoothD3 = input(3, minval=1, title="Stoch3 D")
res3 = useCurrentRes3 ? period : resCustom3
// Signal Display Options
sch3 = input(true, title="Stoch3 Strict Crossing Background Hi-Lights?")
sl3 = input(true, title="Stoch3 Strict Crossing Display 'B' and 'S'?")
sac3 = input(false, title="Stoch3 All Crossings Background Hi-Lights?")
sacl3 = input(false, title="Stoch3 All Crossings Display 'B' and 'S'?")
//  Stoch3 formula
k3 = sma(stoch(close, high, low, len3), smoothK3)
d3 = sma(k3, smoothD3)
outK3 = security(tickerid, res3, k3)
outD3 = security(tickerid, res3, d3)
// Strict Crossing Definitions
aboveLine3 = outK3 > upLine ? 1 : 0
belowLine3 = outK3 < lowLine ? 1 : 0
crossUp3 = (outK3[1] < outD3[1] and outK3[1] < lowLine[1]) and (outK3 > outD3)  ? 1 : 0
crossDn3 = (outK3[1] > outD3[1] and outK3[1] > upLine[1]) and (outK3 < outD3) ? 1 : 0
// Definition For Any Crossing
crossUpAll3 = (outK3[1] < outD3[1] and outK3 > outD3) ? 1 : 0
crossDownAll3 = (outK3[1] > outD3[1] and outK3 < outD3) ? 1 : 0

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

// Plot Stoch 1,2,3
plot(outK, title="S1 K", style=line, linewidth=1, color=lime)
plot(outD, title="S1 D", style=line, linewidth=1, color=red)
plot(Stoch2 and outK2 ? outK2 : na, title="S2 K", style=line, linewidth=1, color=#33FFFC)
plot(Stoch2 and outD2 ? outD2 : na, title="S2 D", style=line, linewidth=1, color=orange)
plot(Stoch3 and outK3 ? outK3 : na, title="S3 K", style=line, linewidth=1, color=#B968E7)
plot(Stoch3 and outD3 ? outD3 : na, title="S3 D", style=line, linewidth=1, color=yellow)

// Plot Stoch 1,2,3 Signals and Highlights
bgcolor(sch1 and crossUp ? lime : na, transp=80,title="Stoch 1 Strict Crossing Up Background")
bgcolor(sch1 and crossDn ? red : na, transp=80,title="Stoch 1 Strict Crossing Down Background")
bgcolor(sac1 and crossUpAll ? lime : na, transp=80,title="Stoch 1 All Crossing Down Background")
bgcolor(sac1 and crossDownAll ? red : na, transp=80,title="Stoch 1 Strict Crossing Down Background")
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)

bgcolor(sch2 and crossUp2 ? #33FFFC : na, transp=80,title="Stoch 2 Strict Crossing Up Background")
bgcolor(sch2 and crossDn2 ? orange : na, transp=80,title="Stoch 2 Strict Crossing Down Background")
bgcolor(sac2 and crossUpAll2 ? #33FFFC : na, transp=80,title="Stoch 2 Strict Crossing Down Background")
bgcolor(sac2 and crossDownAll2 ? orange : na, transp=80,title="Stoch 2 Strict Crossing Down Background")
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)

bgcolor(sch3 and crossUp3 ? #B968E7 : na, transp=80,title="Stoch 3 Strict Crossing Up Background")
bgcolor(sch3 and crossDn3 ? yellow : na, transp=80,title="Stoch 3 Strict Crossing Down Background")
bgcolor(sac3 and crossUpAll3 ? #B968E7 : na, transp=80,title="Stoch 3 Strict Crossing Down Background")
bgcolor(sac3 and crossDownAll3 ? yellow : na, transp=80,title="Stoch 3 Strict Crossing Down Background")
plotchar(sl3 and crossUp3 ? crossUp3 : na, title="Strict Buy 3", char='B', location=location.bottom, color=#B968E7, transp=0, offset=0,size=size.auto)
plotchar(sl3 and crossDn3 ? crossDn3 : na, title="Strict Sell 3", char='S', location=location.top, color=yellow, transp=0, offset=0,size=size.auto)
plotchar(sacl3 and crossUpAll3 ? crossUpAll3 : na, title="Any Buy 3", char='b', location=location.bottom, color=#B968E7, transp=0, offset=0,size=size.auto)
plotchar(sacl3 and crossDownAll3 ? crossDownAll3 : na, title="Any Sell 3", char='s', location=location.top, color=yellow, transp=0, offset=0,size=size.auto)


// end