将代码块PineScript转换为thinkscript

时间:2018-11-02 11:13:31

标签: if-statement pine-script thinkscript

我想将这行代码从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");
);

1 个答案:

答案 0 :(得分:0)

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