显示计算结果而不是输入

时间:2021-07-25 03:12:56

标签: pine-script

我试图在输入选项卡中查看计算结果,而不是能够添加输入。

示例:我为 Input 1 添加一个值,Input 2 的结果是 (Input 1 * 2)。我想在输入选项卡中显示此结果。

我想在输入选项卡中查看结果。

//Lets say Input 1 is:
L1_02 = input(true, title="Line 1 Base" )
Line1_02 = input(10.0, title=" ")

//I want Line2_02 to be the result found in calculation from Band2_02
L2_02 = input(true, title="Line 2 - Multiplier" )
Line2_02 = input(Band2_02) //this gives me Syntax error.

//Calculation for Line2_02
Band2_02 = Line1_02 * 2
//The result would be 10*2 = 20.

如何进行输入以从计算中获取值? 或者它叫什么,以便我可以搜索它?

1 个答案:

答案 0 :(得分:0)

您不能在输入中使用变量或使用输入选项卡来显示数据。输入类型是常量,而不是与正常时间序列变量相同的数据类型。在 Line1_02 的情况下,它是一个常量 input.float 类型而不是 float 并且不打算更改或更改。如果要显示数据,最好使用标签或表格函数。例如

info_label = label.new(x = bar_index, y = close, style = label.style_label_left, text = tostring(Band2_02))
label.delete(info_label[1]
相关问题