简体   繁体   English

松脚本。 将 2 个图表合并为一个

[英]pine script. merging 2 charts into one

I am searching for a pine-script that calculates an average-chart out of 2 given chart-symbols an after that shows me the MA200 of the newly generated chart.我正在寻找一个 pine 脚本,它计算 2 个给定图表符号的平均图表,然后显示新生成图表的 MA200。 Does anybody has this?有人有这个吗? Or knows how to do?或者知道怎么做? Best Regards此致

you can get the close price of both contracts using request.security.您可以使用 request.security 获得两个合约的收盘价。 Then you can find average of two closes and plot it.然后你可以找到两个关闭的平均值并绘制它。 Then you can find sma of avg and plot it.然后你可以找到 avg 的 sma 并绘制它。

Example:例子:

//@version=5
indicator(title="Indicator Merge By Rohit",overlay=true)
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)
avg=(close1+close2)/2
plot(avg)
plot(ta.sma(avg,200))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM