首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CM_Stochastic高亮酒吧克里斯穆迪?警报

CM_Stochastic高亮酒吧克里斯穆迪?警报
EN

Stack Overflow用户
提问于 2019-03-17 15:03:21
回答 1查看 436关注 0票数 0

有人能告诉我如何在tradingview上精确地设置警报(我知道如何设置警报.)针对“严格购买”标准中的CM_Stochastic高亮栏指示器??,我做了很多搜索,但运气不佳。(谢谢:)强文本

EN

回答 1

Stack Overflow用户

发布于 2019-03-17 17:46:04

不幸的是,该脚本并不是非常友好地用于设置警报。幸运的是,源代码是可用的。

我编辑了一些代码(它具有相同的功能),这样它可以绘制一些形状和一些文本,并且您可以根据这些形状设置警报。

在原来的指示器有"S“或"B”的地方,我的指示符有“严格卖出”或“严格购买”三角形。所以,功能是一样的。当然,当你加上我的指示符,它不会有那些"S“或"B"s。上面的图表有两个指标。

现在您可以简单地做“添加警报”并选择新的指示器(Stoch )。

然后选择“形状”并查看下拉菜单,并选择要根据其设置警报的形状。

创建一个新的指示器,并在代码下面复制和粘贴。保存它,然后将它添加到图表中。

代码语言:javascript
复制
//@version=3
study("Stoch HL", overlay=true)

//Created by ChrisMoody on October 23, 2014 by user request - belgusinc
//Changes Barcolor when Stochastic is Overbought Oversold.

//Necessary for Highlight Bars
//Only Necessary if you want you want Stochastic Croses
len = input(14, minval=1, title="Length for Stochastic") 
smoothK = input(3, minval=1, title="SmoothK for Stochastic")
smoothD = input(3, minval=1, title="SmoothD for Stochastic")
upLine = input(80, minval=50, maxval=90, title="Upper Line Value?")
lowLine = input(20, minval=10, maxval=50, title="Lower Line Value?")

//Not Necessary, In Inputs Tab, capability to turn On/Off Highlight Bars, and Both Crosses
//These are all checkboxes in inputs tab....Show Barcolor Highlights, Show Background Hghlight, Plot B and S for Buy Sell 
sbc = input(true, title="Show Price Bar highlight When Stoch is Above/Below High/Low Lines?")
sbh = input(false, title="Show Background highlight When Stoch is Above/Below High/Low Lines?")
sch = input(false, title="Show Back Ground Highlights When Stoch Cross - Strict Criteria - K Greater/LesThan High/Low Line - Crosses D ?")
sl = input(true, title="Show 'B' and 'S' Letters When Stoch Crosses High/Low Line & D?")
sac = input(false, title="Show Back Ground Highlights When Stoch Cross - Any Cross?")
sacl = input(false, title="Show 'B' and 'S' Letters When Stoch Crosses - Any Cross?")

//Necessary for Highlight Bars
//Stoch formula
k = sma(stoch(close, high, low, len), smoothK)
d = sma(k, smoothD)

//Necessary for Highlight Bars
//aboveline = OverBought, belowline = Oversold Definitions
aboveLine = k > upLine ? 1 : 0
belowLine = k < lowLine ? 1 : 0

//Only Necessary if you want you want Stochastic Croses
//Definition for Cross when Above High-Low lines
crossUp = (k[1] < d[1] and k[1] < lowLine[1]) and (k > d)  ? 1 : 0
crossDn = (k[1] > d[1] and k[1] > upLine[1]) and (k < d) ? 1 : 0

//Only Necessary if you want you want Stochastic Croses
//Definition for Cross that doesn't have to be above or below High and Low line.
crossUpAll = (k[1] < d[1] and k > d) ? 1 : 0
crossDownAll = (k[1] > d[1] and k < d) ? 1 : 0

//Only Necessary if you want background Highlighting also - Take out the sbh/sbc and part
//BackGround Highlights based on Above/Below Lines, Strict Cross Up/Down
//BackGroound Color Plots
bgcolor(sbh and aboveLine ? red : na, transp=70)
bgcolor(sbh and belowLine ? lime : na, transp=70)
bgcolor(sch and crossUp ? lime : na, transp=40)
bgcolor(sch and crossDn ? red : na, transp=40)

//Only Necessary if you want background Highlighting also
//plots bgcolor Cross with no filter
bgcolor(sac and crossUpAll ? lime : na, transp=40)
bgcolor(sac and crossDownAll ? red : na, transp=40)

//Necessary for Highlight Bars
//Highlight Bar Definitions
overBought() => sbc and aboveLine 
overSold() => sbc and belowLine 

//Necessary for Highlight Bars
//Highlight Bar Plot Statement based on Above Definitions
barcolor(overBought() ? orange : overSold() ? fuchsia : na)

// Buy and Sell Conditions
bssc = sl and crossUp ? crossUp : na
sssc = sl and crossDn ? crossDn : na
bscu = sacl and crossUpAll ? crossUpAll : na
sscd = sacl and crossDownAll ? crossDownAll : na

//Not Necessary if you just want Highlight Bars  - Extra Feature
//These are just the Letters B and Sell Based on Crosses
alertcondition(condition=bssc, title="Strict Buy", message="Buy Signal Strict Criteria.")
alertcondition(condition=sssc, title="Strict Sell", message="Sell Signal Strict Criteria.")
alertcondition(condition=bscu, title="Buy Cross Up", message="Buy Signal Any Cross Up.")
alertcondition(condition=sscd, title="Sell Cross Down", message="Sell Signal Any Cross Down.")

plotshape(bssc, style=shape.triangleup, color=lime, transp=40, text="Strict Buy", editable=false, location=location.belowbar, size=size.small)
plotshape(sssc, style=shape.triangledown, color=red, transp=40, text="Strict Sell", editable=false, location=location.abovebar, size=size.small)
plotshape(bscu, style=shape.triangleup, color=lime, transp=40, text="Buy Cross Up", editable=false, location=location.belowbar, size=size.small)
plotshape(sscd, style=shape.triangledown, color=red, transp=40, text="Sell Cross Down", editable=false, location=location.abovebar, size=size.small)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55208460

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档