Pine 脚本输入字符串选项
Pine Script input string options
我想将选项显示为照片 1 中的字符串 photo1
我希望它在选项中是“非常敏感”“敏感”和“正常”。例如,如果您选择非常敏感,则长度应为 20.0。选择正常时,长度应为 53.0。我该怎么做?
我不知道 PineScript。我写了一些东西来解释我想做什么
length = input(title="Settings",options=["VerySensitve", "Sensitive","Normal"])
if (length == "VerySensitive")
length = 20.0
else if (length == "Sensitive")
length = 33.0
else if (length == "Normal")
length = 53.0
最好将你多次引用的文字放在变量中,这样如果你更改菜单字符串,在你的情况下,你只需要在一个地方更改它。
//@version=4
study("", "", true)
SV1 = "VerySensitive"
SV2 = "Sensitive"
SV3 = "Normal"
sensitivity = input(SV3, "Sensitivity", options=[SV1, SV2, SV3])
int length = na
if sensitivity == SV1
length := 20
else if sensitivity == SV2
length := 33
else if sensitivity == SV3
length := 53
ma = sma(close, length)
plot(ma)
我想将选项显示为照片 1 中的字符串 photo1
我希望它在选项中是“非常敏感”“敏感”和“正常”。例如,如果您选择非常敏感,则长度应为 20.0。选择正常时,长度应为 53.0。我该怎么做?
我不知道 PineScript。我写了一些东西来解释我想做什么
length = input(title="Settings",options=["VerySensitve", "Sensitive","Normal"])
if (length == "VerySensitive")
length = 20.0
else if (length == "Sensitive")
length = 33.0
else if (length == "Normal")
length = 53.0
最好将你多次引用的文字放在变量中,这样如果你更改菜单字符串,在你的情况下,你只需要在一个地方更改它。
//@version=4
study("", "", true)
SV1 = "VerySensitive"
SV2 = "Sensitive"
SV3 = "Normal"
sensitivity = input(SV3, "Sensitivity", options=[SV1, SV2, SV3])
int length = na
if sensitivity == SV1
length := 20
else if sensitivity == SV2
length := 33
else if sensitivity == SV3
length := 53
ma = sma(close, length)
plot(ma)