DrawRegion()
Previous Topic  Next Topic 

Definition
Draws a region on a chart.

Syntax
DrawRegion(string tag, int startBarsAgo, int endBarsAgo, IDataSeries series, double y, Color outlineColor, Color backColor, int opacity)
DrawRegion(string tag, int startBarsAgo, int endBarsAgo, IDataSeries series1, IDataSeries series2, Color outlineColor, Color backColor, int opacity)

Method Of

Custom Indicator, Custom Strategy


Parameters

tag

A user defined unique id used to reference the draw object. For example, if you pass in a value of "myTag", each time this tag is used, the same draw object is modified. If unique tags are used each time, a new draw object will be created each time.

startBarsAgo

The bar (x axis co-ordinate) where the starting point of the region will be drawn from. For example, a value of 10 would paint the start of the region 10 bars back.

endBarsAgo

The bar (x axis co-ordinate) where the ending point of the region will be drawn to. For example, a value of 0 would paint the end on the current bar (last bar) of the chart.

series, series1, series2

Any DataSeries type object such as an indicator, Close, High, Low etc.. The value of the object will represent a y value.

y

Any double value

outlineColor

Region outline color (reference)

backColor

Region back color (reference)

opacity

Sets the level of transparency for the backColor. Valid values between 1 - 10.


Examples

// Fills in the region between the upper and lower bollinger bands
DrawRegion("tag1", CurrentBar, 0, Bollinger(2, 14).Upper, Bollinger(2, 14).Lower, Color.Empty, Color.Lime, 2);

Tips
1. Pass in Color.Empty to the "outlineColor" parameter if you do not want to have an outline color.
2. If you wanted to fill a region between a value (20 period simple moving average) and the upper edge of the chart, pass in an extreme value to the "y" parameter such as 1000000.