英文:
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 < 50 and rsiprev > 20 and rsiprev < 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 < 50 and rsiprev > 20 and rsiprev < 50
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论