0

我想将这行代码从 pinescript 转换为 thinkscript ( Thinkorswim ) 我该怎么写?我遇到了多个 if 语句的问题

isAboveEma01 = line_01 > line_01[1] and line_01 > line_50 ? blue : line_01 > line_01[1] and line_01 < line_50 ? #cc00cc : line_01 < line_01[1] and line_01 > line_50 ? #0388FF : line_01 < line_01[1] and line_01 < line_50 ? #BD003A : na

我试试这个,但不起作用:

line_01.AssignValueColor( 
if (line_01 >= line_01[1] and line_01 > line_50) then {
line_01.Color("PositiveUp") ;
} else if (line_01 >= line_01[1] and line_01 < line_50) then {
line_01.Color("PositiveDown");
} else if line_01 < line_01[1] and line_01 > line_50 then {
line_01.Color("NegativeUp");
}) else line_01.Color("NegativeDown");
);
4

1 回答 1

1

'if' 语句的语法在官方教程中 只需注意 PineScript 对缩进/空格很敏感。

于 2018-11-29T09:41:48.153 回答