![](/img/trans.png)
[英]How i can call request.security on ta.sar (pinescript/TradingView)?
[英]How can I use the ta.correlation function in PineScript (Tradingview) to show the correlation of two different symbols?
我是 Pine 的新手,我的问题是在使用 ta.correlation 函数时,我不知道如何定义两个不同的符号来显示相关性。
我只设法从同一个交易品种加载价格数据(包括收盘价、开盘价等)作为输入,这当然没有什么意义。
我该如何进一步进行? 我必须先用 request.security 加载另一个符号吗?
提前致谢 :)
您可以使用 input.symbol 将这两个工具作为输入,然后使用 request.security 将它们关闭。 然后你可以计算相关性并绘制相同的
//@version=5
indicator(title="Correlation By Rohit")
symbol1 = input.symbol("CL1!","Symbol1")
symbol2 = input.symbol("UKOIL","Symbol2")
close1=request.security(symbol1, timeframe.period, close, barmerge.gaps_off)
close2=request.security(symbol2,timeframe.period, close, barmerge.gaps_off)
c=ta.correlation(close1,close2,10)
plot(c)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.