Pine script plot Tradingview中的两个变量

Pine script plot Tradingview中的两个变量,pine-script,Pine Script,我有两个计算结果 x1 = if ((o1-c1)/c1)*100 > input 1 我想把这两个变量一起画一个图,就像 plot (x1 & x2) 因此结果将是12或1或2 但我不知道如何替换“&”使其工作?您需要在以下位置交换您的条件: //@version=4 study("") // c1 = ((o1-c1)/c1)*100 // c2 = ((o2-c2)/c2)*100 c1 = close > open c2 = close[2] >

我有两个计算结果

x1 = if ((o1-c1)/c1)*100 > input
    1 
我想把这两个变量一起画一个图,就像

plot (x1 & x2)
因此结果将是12或1或2
但我不知道如何替换“&”使其工作?

您需要在以下位置交换您的条件:

//@version=4
study("")
// c1 = ((o1-c1)/c1)*100
// c2 = ((o2-c2)/c2)*100
c1 = close > open
c2 = close[2] > open[2] and close[1] > open[1]

x1 = c1 ? input(1) : 0
x2 = c2 ? input(2) : 0
x3 = (x2 != 0 ? x1 * 10 : x1) + x2
plot(x1, "x1", linewidth = 1)
plot(x2, "x2", linewidth = 2)
plot(x3, "x3", linewidth = 3)
//@version=4
study("")
// c1 = ((o1-c1)/c1)*100
// c2 = ((o2-c2)/c2)*100
c1 = close > open
c2 = close[2] > open[2] and close[1] > open[1]

x1 = c1 ? input(1) : 0
x2 = c2 ? input(2) : 0
x3 = (x2 != 0 ? x1 * 10 : x1) + x2
plot(x1, "x1", linewidth = 1)
plot(x2, "x2", linewidth = 2)
plot(x3, "x3", linewidth = 3)