Is it possible to shade bands (like Bollinger Bands) with a different color for each bar, according to a certain rule?
I have done this with vertical lines and brushed colors, but this is not satisfactory as the vertical lines have a width and this gives unwanted effects when shrinking or widening the bars.
Size:
Color:
Size:
Color:
This is probably a misunderstanding.
We would like to create a band that has a transparent fill ("brush" command) but which would change its fill color depending on an underlying signal.
So for example, the band's fill should be transparent green when a MA cross signal is positive and change to transparent red when the MA cross signal is negative. (the MA shall not be displayed, only the shading of the band).
In additiona, we want to have a second band with a much longer lookback period and wider variation.
The bigger band should also display a red / green fill depending on an underlying signal.
Ideally, the coloring of the short term band should be "above" the coloring of the longterm-band.
Size:
Color:
The only way I could see it being done from WealthScript is to write a routine that draws rectangles from bar to bar between the bands, with the desired color.
Here's an example:
CODE:
Please log in to see this code.
Size:
Color:
Well we tried it with vertical lines, that works - sort of, but it looks very bad when the chart's time compression is scaled up or down.
The problem here is that vertical line width is static and doesn't scale.
if you choose them too thin (1 or 3) you will see white lines in between, if it is too thick, density will increase and also produce a strange look when the time is compressed.
Would those rectangles that you are referencing to scale in width ?
Where could we find code for that ?
Size:
Color:
See above.
Size:
Color:
sorry I didn't see that in the first place. Thanks.
Size:
Color:
This worked perfectly, thank you!
Size:
Color: