DrawRectangle()
Previous Topic  Next Topic 

Definition
Draws a rectangle.

Syntax
DrawRectangle(string tag, int startBarsAgo, double startY, int endBarsAgo, double endY, Color color)
DrawRectangle(string tag, bool autoScale, int startBarsAgo, double startY, int endBarsAgo, double endY, Color color, 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.

autoScale

Determines if the draw object will be included in the y-axis scale. Default value is false.

startBarsAgo

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

startY

The starting y value co-ordinate where the draw object will be drawn

endBarsAgo

The end bar (x axis co-ordinate) where the draw object will terminate

endY

The end y value co-ordinate where the draw object will terminate

color

The draw object color (reference)

backColor

The fill color for the object (reference)

opacity

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


Examples

// Draws a blue rectangle from the low 10 bars back to the high of 5 bars back
DrawRectangle("tag1", 10, Low[10] - TickSize, 5, High[5] + Ticksize, Color.Blue);

// Draws a blue rectangle from the low 10 bars back to the high of 5 bars back with
// a fill color or pale green with a transparency level of 2
DrawRectangle("tag1", false, 10, Low[10] - TickSize, 5, High[5] + Ticksize, Color.PaleGreen, Color.PaleGreen, 2);