request.security issue in pine script

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

request.security issue in pine script

问题

当我使用request.security来查询之前的值RSI[1]时,它返回了一个随机的数值。

如果我不使用request.security,则可以得到正确的RSI值,但是如果使用request.security来获取RSI[1]的值,它会返回一些奇怪的随机数值。

如果有人可以帮助我如何使用request.security来获取正确的RSI[1]值,感谢您。

rsi = ta.rsi(close, rsi_length)
rsi1 = ta.rsi(close, 11)[1]
rsiprev = request.security(sym, timeframe.period, rsi1)
rsi_cond = rsi < 50 and rsiprev > 20 and rsiprev < 50
英文:

Hi i want to get RSI value using request.security but when i query previous value which is RSI[1]

it return random value .

if i don't use request.security it return correct RSI value but to get RSI[1] value if use

request.security it return some weird random value.

if anyone help me how to get correct RSI[1] value using request.security?

thanks

rsi  = ta.rsi(close, rsi_length)
rsi1 = ta.rsi(close, 11)[1]
rsiprev = request.security(sym, timeframe.period, rsi1)
rsi_cond = rsi &lt; 50 and rsiprev &gt; 20 and rsiprev &lt; 50 

答案1

得分: 1

像这样:

rsi = ta.rsi(close, rsi_length)

rsiprev = request.security(sym, timeframe.period, rsi[1])
rsi_cond = rsi < 50 and rsiprev > 20 and rsiprev < 50
英文:

like this:

rsi  = ta.rsi(close, rsi_length)

rsiprev = request.security(sym, timeframe.period, rsi[1])
rsi_cond = rsi &lt; 50 and rsiprev &gt; 20 and rsiprev &lt; 50 

huangapple
  • 本文由 发表于 2023年5月28日 17:04:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/76350720.html
匿名

发表评论

匿名网友

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

确定