【问题标题】:Pine Script input string optionsPine 脚本输入字符串选项
【发布时间】:2020-08-15 17:20:41
【问题描述】:

我想将选项显示为字符串,如 photo1 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

【问题讨论】:

  • 请附上您的问题的代码,以便我们从那里开始。
  • 我添加了代码,但我的代码完全荒谬。简而言之,我想做的是我不希望用户看到 "length" 。用户应该只看到灵敏度设置。请帮忙

标签: pine-script


【解决方案1】:

最好将多次引用的文字放在变量中,因此如果您更改菜单字符串,在您的情况下,您只需更改一次即可。

//@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)

【讨论】:

  • 这对我很有用,我的朋友。非常感谢。
猜你喜欢
  • 2021-05-01
  • 1970-01-01
  • 1970-01-01
  • 2023-04-02
  • 1970-01-01
  • 2022-07-22
  • 2015-01-04
  • 2023-03-30
  • 1970-01-01
相关资源
最近更新 更多