【问题标题】:How to write a stochastic-RSI indikator如何编写随机 RSI 指标
【发布时间】:2019-04-27 19:37:42
【问题描述】:

我的指标看起来不像 TradingView 的内置随机 RSI 指标。如何获得熟悉的外观,以复制 st-RSI 指标?

这里是 screen shot,它显示了我的代码和 TradingView 指标之间的区别

//@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)

曲线应该与交易视图指标相同

【问题讨论】:

    标签: pine-script indicator


    【解决方案1】:

    公式应该是这样的:

    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)
    

    【讨论】:

    • 完美,谢谢!!
    • 非常欢迎,如果答案正常,请将其标记为正确答案。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-28
    • 2020-07-23
    • 2019-11-22
    • 2020-07-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多