我如何调用请求。

发布于 2025-01-25 15:28:22 字数 447 浏览 2 评论 0原文

我需要在Heikin Ashi Security中致电Ta.Sar,这给了我一个买入/出售信号以在Japatin中执行蜡烛价值。

//SAR security example (not working)
start = input(0.02)
increment = input(0.02)
maximum = input(0.2, "Max Value")
out = (request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close) ta.sar(start, increment, maximum))
sarColor = out < low ? color.lime : color.red
plot(out, "ParabolicSAR", style=plot.style_cross, color=sarColor)

I need to call a ta.sar in heikin ashi security, that gives me a buy/sell signal to execute in japanise candles values.

//SAR security example (not working)
start = input(0.02)
increment = input(0.02)
maximum = input(0.2, "Max Value")
out = (request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close) ta.sar(start, increment, maximum))
sarColor = out < low ? color.lime : color.red
plot(out, "ParabolicSAR", style=plot.style_cross, color=sarColor)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

友欢 2025-02-01 15:28:22

request.security()函数3rd paramter是您希望返回的expression。在您的情况下,您需要关闭,而您要获得SAR。您还使用额外的括号,可以从代码中删除:

//@version=5
indicator(title="Money Flow Index", shorttitle="MFI", format=format.price, precision=2, timeframe="", timeframe_gaps=true)
start = input(0.02)
increment = input(0.02)
maximum = input(0.2, "Max Value")
out = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, ta.sar(start, increment, maximum))
sarColor = out < low ? color.lime : color.red
plot(out, "ParabolicSAR", style=plot.style_cross, color=sarColor)

如果您希望在以后使用关闭的情况下,可以同时获得关闭和SAR:

//@version=5
indicator(title="Money Flow Index", shorttitle="MFI", format=format.price, precision=2, timeframe="", timeframe_gaps=true)
start = input(0.02)
increment = input(0.02)
maximum = input(0.2, "Max Value")
[_close, out] = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, [close, ta.sar(start, increment, maximum)])
sarColor = out < low ? color.lime : color.red
plot(out, "ParabolicSAR", style=plot.style_cross, color=sarColor)
plot(_close)

The request.security() function 3rd paramter is the expression you wish to return. In you case, you're requesting Close, while you want to get sar. You also use an extra parenthesis you can delete from your code:

//@version=5
indicator(title="Money Flow Index", shorttitle="MFI", format=format.price, precision=2, timeframe="", timeframe_gaps=true)
start = input(0.02)
increment = input(0.02)
maximum = input(0.2, "Max Value")
out = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, ta.sar(start, increment, maximum))
sarColor = out < low ? color.lime : color.red
plot(out, "ParabolicSAR", style=plot.style_cross, color=sarColor)

You can get both Close and sar if you wish using Close at a later time:

//@version=5
indicator(title="Money Flow Index", shorttitle="MFI", format=format.price, precision=2, timeframe="", timeframe_gaps=true)
start = input(0.02)
increment = input(0.02)
maximum = input(0.2, "Max Value")
[_close, out] = request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, [close, ta.sar(start, increment, maximum)])
sarColor = out < low ? color.lime : color.red
plot(out, "ParabolicSAR", style=plot.style_cross, color=sarColor)
plot(_close)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文