在Pine Editor中计算RSI的增益/差异如何?

huangapple go评论58阅读模式
英文:

Calculate RSI gain/difference in Pine Editor?

问题

使用命令"crossover",我可以成功显示RSI值和RSI平均值的交叉点。

rsiValue = rsi(close, 14)
rsiSMA   = sma(rsiValue, 14)
bgcolor(color=crossover(rsiValue, rsiSMA) ? #ffc1cc : na, transp=60)
bgcolor(color=crossover(rsiSMA, rsiValue) ? #00ffaa : na, transp=80)

接下来,我想使用与上面相同颜色的标记来指示当前RSI值比上一个RSI值高5个点的情况。我可以使用什么命令?所以,不是使用"crossover",而是类似于"previous value"的内容?

英文:

By using the command "crossover" I can successfully display the intersections of the RSI-value and the RSI-sma.

rsiValue = rsi(close, 14)
rsiSMA   = sma(rsiValue, 14)
bgcolor(color=crossover(rsiValue, rsiSMA) ? #ffc1cc : na, transp=60)
bgcolor(color=crossover(rsiSMA, rsiValue) ? #00ffaa : na, transp=80)

Next, I would like to use the same colored markers as above to indicate when the current RSI value is e.g. 5 points above the previous RSI value. What command can I use for this? So instead of "crossover" something like "previous value" ???

答案1

得分: 0

我自己通过YouTube视频找到了答案。解决方法是:

bgcolor(color=(rsiValue - rsiValue[1] >= 5) ?  #4cf346 : na, transp=80)
bgcolor(color=(rsiValue[1] - rsiValue >= 5) ?  #ffc1cc : na, transp=70)

方括号[1]表示前一个蜡烛图。

英文:

Found it out for myself through a YouTube video. The solution is:

bgcolor(color=(rsiValue - rsiValue[1] >= 5) ?  #4cf346 : na, transp=80)
bgcolor(color=(rsiValue[1] - rsiValue >= 5) ?  #ffc1cc : na, transp=70)

The square bracket [1] means the previous candlestick.

huangapple
  • 本文由 发表于 2023年3月12日 18:21:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/75712464.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定