Hello,
I am creating an indicator where I want to specify certain "zones" on my indicator. For example, if my indicator oscillates between the values 3 and -3, I want to draw a color band on the range from 1 to 2 and from -1 to -2 (and a third from 1 to -1).
It seems I can only use setBarBgColor() to specify one zone. I need 3 zones, as mentioned above. Also, it seems using setBarBgColor() only colors up to the current bar, not a complete band across the entire indicator, including into the future.
A possible solution was to use addBand() repeatedly in a "for" loop, coloring in the area, one "tick" at a time. This works pretty well (though, I don't know about performance of having hundreds of "bands"). However, this draws the bands on top of the actual indicator that I am returning. Is there a way to specify this?
Another possible solution was to break up the indicator into multiple separate indicators so I can stack them within the chart itself. However, I could not get them to scale properly. I set them both to "scale to the right", but if I drag or resize the indicator, they don't drag and resize together (since it is imperative they scale together (the lines and the indicator itself), obviously)
Here is a screenshot:
The green band is using the "addBand" method to color in the "zone", but it is drawing over the indicator itself. But it does draw into the future, which is what I want. The red band is using the setBarBgColor() method, which colors behind the indicator, but I can only color one zone and it does not color into the future.
Can anyone offer some advice? Thanks in advance!
Daniel
I am creating an indicator where I want to specify certain "zones" on my indicator. For example, if my indicator oscillates between the values 3 and -3, I want to draw a color band on the range from 1 to 2 and from -1 to -2 (and a third from 1 to -1).
It seems I can only use setBarBgColor() to specify one zone. I need 3 zones, as mentioned above. Also, it seems using setBarBgColor() only colors up to the current bar, not a complete band across the entire indicator, including into the future.
A possible solution was to use addBand() repeatedly in a "for" loop, coloring in the area, one "tick" at a time. This works pretty well (though, I don't know about performance of having hundreds of "bands"). However, this draws the bands on top of the actual indicator that I am returning. Is there a way to specify this?
Another possible solution was to break up the indicator into multiple separate indicators so I can stack them within the chart itself. However, I could not get them to scale properly. I set them both to "scale to the right", but if I drag or resize the indicator, they don't drag and resize together (since it is imperative they scale together (the lines and the indicator itself), obviously)
Here is a screenshot:
The green band is using the "addBand" method to color in the "zone", but it is drawing over the indicator itself. But it does draw into the future, which is what I want. The red band is using the setBarBgColor() method, which colors behind the indicator, but I can only color one zone and it does not color into the future.
Can anyone offer some advice? Thanks in advance!
Daniel
Comment