I’m trying to code an indicator where the width depends on a condition. As a simply example use a pair of moving averages, e.g. MA20 and MA200.
– if MA20 >MA200, I want the width of MA20 to be 2,
– if MA20 < MA200, I want the width of MA20 to be 1.
Problems:
– RETURN MA20 COLOURED (255,0,0) style(line, 2) only accepts numbers, not code variables (e.g. style(line, x))
I thought of a workaround of plotting an indicator 2x, once with width 1 and once with width 2 (if a condition is met with width 2, otherwise invisible),
– but the transparency alpha in “colored by (r,g,b,alpha)” does not allow two different values.
Any idea how this could be fixed?
Thank you.