如何编写随机 RSI 指标 [英] How to write a stochastic-RSI indikator
本文介绍了如何编写随机 RSI 指标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的指标看起来不像 Tradingview 中构建的随机 RSI 指标.公式看起来如何,使 st-RSI 指标加倍?
My indicator does not look like the build in stochastic-RSI indicator from tradingview. How does the formular look, to doublicate the st-RSI indicator?
Herer 是 屏幕截图,显示了我的代码和交易视图指标之间的区别
Herer is the screen shot that shows the difference between my code and the tradingview indicator
//@version=3
study("Stoch-RSI")
//smooth = (close + close[1] + close[2]) /3
smooth = close
p_k = stoch(rsi(smooth,14),high,low,14)
p_d = 0.0
for i = 1 to 3
p_d := p_d + p_k[i]
p_d := p_d / 3
plot(p_k*30,color=orange)
plot(p_d*30,color=purple)
plot(close)
曲线应与交易视图指标相同
The curve should look the same as the tradingview indicator
推荐答案
这个公式应该是什么样子:
this how the formula should look like:
study(title="Stoch-RSI")
band1 = hline(20)
band0 = hline(80)
fill(band1, band0, color=purple,transp=90)
smoothK = input(3, minval=1)
smoothD = input(3, minval=1)
lengthRSI = input(14, minval=1)
lengthStoch = input(14, minval=1)
src4 = input(close, title="RSI Source")
rsi1 = rsi(src4, lengthRSI)
k = sma(stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)
d = sma(k, smoothD)
plot(k, color=blue)
plot(d, color=red)
h0 = hline(80, linestyle=dotted)
h1 = hline(20, linestyle=dotted)
这篇关于如何编写随机 RSI 指标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文