How to change volume bar colors when the price closes down
Updated on 2011-04-23 04:46:11
|
Default volume bar colors can be changed by right clicking on one bar, selecting the "Volume" tab then updating the "color" field. You can choose one or two colors, update the alpha or opacity of each one of these colors and even the direction of the colors.
The same color settings will be applied to all volume bars, unless you explicitly specify a different color for each bar depending on a measure, value or formula. Changing the bar colors dynamically is done by adding "UpdateColor" function in the chart formula.
Steps:
- Right click on the chart then select "Edit Formula"
- Select the formula that displays the volume bars (Plot(volume...). You can update the active formula by clicking on the left/right arrows in the Formula Editor menu bar.
- After the (Plot(volume...) line, type the following line:
UpdateColor(perf(close, 1) < 0, colorRed|20);
The "UpdateColor" function updates the color of the last 'Plot' formula. The first argument is the condition it will check to determine whether to update a bar color or not.
In our example, the color of a volume bar is changed if on the same bar, the price of the asset has closed down.
The color is changed to Red with an alpha value of 20. (255 means that bar is completely opaque, while a value of 0 means that the bar is fully transparent).
|