简体   繁体   English

newby with pine-script 试图让多条件颜色绘制在直方图上并转换为 v4

[英]newby with pine-script trying to get multi conditional color to plot on histogram and convert to v4

more importantly i'm trying to understand why i can't convert this color definition to v4 - every way i try it errors out "mismatched input '?'更重要的是,我试图理解为什么我无法将此颜色定义转换为 v4 - 我尝试的每一种方式都会出错“不匹配的输入”? expecting 'end of line without line continuation'"期待‘没有续行的行尾’”

plotColor = hist[0] > 0 
    ? hist[0] > hist[1] ? lime : green 
    : hist[0] < hist[1] ? maroon : red
plot(hist[0], style = columns, color = plotColor, linewidth = 3)

just not getting the syntax for multi-conditional, conditional... read about tabs and spaces and the like and i tried it with bracketed conditions as well still couldn't get it to add to chart if there was any pinescript version identifier on the indicator - funny thing is, though, that if i remove a pinescript version identifier it will plot on the chart but then i can't convert it to v4... thanks, w只是没有获得多条件,条件的语法......阅读有关制表符和空格等的内容,我尝试使用括号条件进行操作,如果有任何 pinescript 版本标识符,仍然无法将其添加到图表中指标 - 不过,有趣的是,如果我删除 pinescript 版本标识符,它将在图表上绘制,但随后我无法将其转换为 v4...谢谢,w

Do you converting it manually?你手动转换吗? If so,如果是这样的话,

plotColor = hist[0] > 0 
     ? hist[0] > hist[1] ? color.lime : color.green 
     : hist[0] < hist[1] ? color.maroon : color.red
    
plot(hist[0], style = plot.style_columns, color = plotColor, linewidth = 3)

When splitting it onto the following line, the continuation of the statement must start with more than one indentation (not equal to multiple of 4 spaces) user manual拆分到下一行时,语句的续行必须以多于一个缩进(不等于 4 个空格的倍数)开头用户手册

figured it out... the line-wrap thing is a little odd but here's what i did in case anyone else finds this ... original code above with a tab in front of each indented line was changed to remove the tabs and add 2 spaces at the beginning of the 2nd line of the plotColor definition and string the 3rd line behind the second all on one line...想通了......换行的东西有点奇怪,但这是我做的,以防其他人发现这个......上面的原始代码在每个缩进的行前面都有一个制表符被更改为删除制表符并添加2在 plotColor 定义的第 2 行的开头添加空格,并将第二行后面的第 3 行串在一行上...

plotColor = hist > 0
  ? hist[0] > hist[1] ? color.lime : color.green : hist[0] < hist[1] ? color.maroon : color.red

plot(hist[0], style=plot.style_histogram, color=plotColor, linewidth=3)

it converted to v4pine with no problem and now links to a host divergence indicator properly...它可以毫无问题地转换为 v4pine,现在可以正确链接到主机分歧指示器...

when it was converted to v4 it came out with 3 spaces in front of the wrapped line...当它转换为 v4 时,它在包裹线前出现了 3 个空格......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM