我在输入大小时收到 Plotchar 错误
I am getting Plotchar error on inputing size
我想通过从用户输入大小来使用 plotchar 绘制星星。
我使用了下面的代码
sizeOption = input(title="Star Size", type=input.string,
options=["Auto", "Huge", "Large", "Normal", "Small", "Tiny"],
defval="Auto")
labelSize = (sizeOption == "Huge") ? size.huge :
(sizeOption == "Large") ? size.large :
(sizeOption == "Small") ? size.small :
(sizeOption == "Tiny") ? size.tiny :
(sizeOption == "Auto") ? size.auto :
size.normal
Bullish=close>open
plotchar(Bullish,title="Bullish",char = '*', color = color.green , location = location.abovebar, transp = 0,size = labelSize)
我收到以下错误
“无法使用 'size'=input.string 调用 'plotchar'。参数的类型应为:const string”
我需要帮助来解决这个问题。
谢谢
有两种解决方法。为每个尺寸创建 plotchar() 调用或改用标签。 Auto/Huge/Large/Normal 虽然通常对 plotchar 不是很有用,因此您可能只需要编写小而小的代码。
plotchar(sizeOption == "Tiny" ? Bullish : na, char = "*", size = size.tiny)
plotchar(sizeOption == "Auto" ? Bullish : na, char = "*", size = size.auto)
etc..
我想通过从用户输入大小来使用 plotchar 绘制星星。
我使用了下面的代码
sizeOption = input(title="Star Size", type=input.string,
options=["Auto", "Huge", "Large", "Normal", "Small", "Tiny"],
defval="Auto")
labelSize = (sizeOption == "Huge") ? size.huge :
(sizeOption == "Large") ? size.large :
(sizeOption == "Small") ? size.small :
(sizeOption == "Tiny") ? size.tiny :
(sizeOption == "Auto") ? size.auto :
size.normal
Bullish=close>open
plotchar(Bullish,title="Bullish",char = '*', color = color.green , location = location.abovebar, transp = 0,size = labelSize)
我收到以下错误 “无法使用 'size'=input.string 调用 'plotchar'。参数的类型应为:const string”
我需要帮助来解决这个问题。 谢谢
有两种解决方法。为每个尺寸创建 plotchar() 调用或改用标签。 Auto/Huge/Large/Normal 虽然通常对 plotchar 不是很有用,因此您可能只需要编写小而小的代码。
plotchar(sizeOption == "Tiny" ? Bullish : na, char = "*", size = size.tiny)
plotchar(sizeOption == "Auto" ? Bullish : na, char = "*", size = size.auto)
etc..