BackBrush

View as Markdown

Definition

Sets the brush used for painting the chart panel’s background color for the current bar.

This property will only set the back color for the panel the indicator is running. To set background color for all panels, please see the BackBrushAll property.

Property Value

A Brush object that represents the color of the current chart bar.

Syntax

BackBrush

You may have up to 65,535 unique BackBrush instances, therefore, using static predefined brushes should be favored. Alternatively, in order to use fewer brushes, please try to cache your custom brushes until a new brush would actually need to be created.

Examples

1protected override void OnBarUpdate()
2{
3 // Sets the chart panel back color to pale green
4 BackBrush = Brushes.PaleGreen;
5
6 // Sets the back color to to null which will use the default color set in the chart properties dialog window
7 BackBrush = null;
8
9 // Sets the back color to maroon when the closing price is less than the 20 period SMA // and to lime green when above (see image below)
10 BackBrush = SMA(20)[0] >= Close[0] ? Brushes.Maroon : Brushes.LimeGreen;
11}

MAPriceBars