第3課 解讀粉絲私訊

pine速成视频 / 1297人浏览 / 0人评论
##粉絲私訊的指標 由於比較基礎,感覺對大家的學習有幫助,就進行了解說和注釋 相關視頻資料可以在全網視頻網站上搜‘量化金城武’,找到tradingview pine語言速成第3課 ###代碼 ``` indicator(title="Stochastic RSI", shorttitle="Stoch RSI", format=format.price, precision=2, timeframe="", timeframe_gaps=true) //定义腳本屬性,設置指标参数 smoothK = input.int(3, "K", minval=1) test1 = input.int(20,title = '測試input.int',minval = 20) //定义名为smoothK的可输入变量,就是在指标的设置那里你可以输入的k的值,默认值3,最小值1 smoothD = input.int(3, "D", minval=1) //定义名为smoothD的可输入变量,就是在指标的设置那里你可以输入的D的值,默认值3,最小值1 lengthRSI = input.int(14, "RSI Length", minval=1) //定义一个名为lengthRSI可输入变量,就是在指标的设置那里你可以输入的rsi长度的值,默认值14,最小值1 lengthStoch = input.int(14, "Stochastic Length", minval=1) //定义一个名lengthStoch可输入变量,就是在指标的设置那里你可以输入的随机指标长度的值,默认值14,最小值1 src = input(close, title="RSI Source") text2 = input(high,title = '測試input(內置變量)') text3 = input(3.1,'測試3') //定义一个名为src可输入变量,就是在指标的设置那里你可以输选择输入rsi来源的值,默认值来源是收盘价 rsi1 = ta.rsi(src, lengthRSI) //算出rsi,赋予变量rsi1,来源是src(src默认是收盘价,见上一行代码) k = ta.sma(ta.stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK) //k = ta.sma(ta.stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)里面,ta.stoch(rsi1, rsi1, rsi1, lengthStoch)是随机指标(参数为rsi1,rsi1,rsi1,长度为lengthStoch) //这行代码可以看做ta.sma(随机指标,smoothK)指的是算出随机指标的长度为smoothK移动平均值 // date = ta.stoch(rsi1, rsi1, rsi1, lengthStoch) // k = ta.sma(date, smoothK) d = ta.sma(k, smoothD) //算出k系列值的长度为smoothD移动平均值 //画出线条 plot(k, "K", color=#2962FF) plot(d, "D", color=#FF6D00) h0 = hline(80, "Upper Band", color=#787B86) hline(50, "Middle Band", color=color.new(#787B86, 50)) h1 = hline(20, "Lower Band", color=#787B86) fill(h0, h1, color=color.rgb(33, 150, 243, 90), title="Background") ```

0 条评论

还没有人发表评论

发表评论 取消回复

记住我的信息,方便下次评论
有人回复时邮件通知我