Reputation: 27
kcolor = iff( sqzval > 0,
iff( sqzval > nz(sqzval[1]), color.lime, color.green),
iff( sqzval < nz(sqzval[1]), color.red, color.maroon))
This is the relevant code. I have a variable with multiple conditions, so it will be and (variable name)
something something. I want a condition that checks if kcolor
is either color.lime
or color.maroon
, and likewise for color.green
or color.red
.
I've tried a couple ways but I haven't found anything that works. kcolor = color.lime or color.maroon
doesn't work, it gives me a syntax error at input 'kcolor'
. When I change the =
to a ==
, it doesn't work because Cannot call 'operator or' with arguments (series[bool], literal color)
.
I know that I most likely have to make a condition that outputs a boolean value, but I don't know exactly how to do that.
Any help appreciated, thanks in advance.
Upvotes: 0
Views: 56
Reputation: 27
This is the workaround I used. The above answer is valid too, this is what I came up with.
sqzmombull = iff( sqzval > 0,
iff( sqzval > nz(sqzval[1]), true, na),
iff( sqzval < nz(sqzval[1]), na, true))
sqzmombear = iff( sqzval > 0,
iff( sqzval > nz(sqzval[1]), na, true),
iff( sqzval < nz(sqzval[1]), true, na))
Upvotes: 0
Reputation: 8779
limeOrMaroon = kcolor == color.lime or kcolor == color.maroon
greenOrRed = kcolor == color.green or kcolor == color.red
Upvotes: 1