DRAWELLIPSE
DRAWELLIPSE in ProBuilder draws an ellipse inside a bounding box set by two corners given as bar index and price, with an optional COLOURED colour.
Syntax
DRAWELLIPSE(x1, y1, x2, y2) COLOURED(R, G, B, a)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
x1 | integer | required | X coordinate of the top-left corner of the bounding box, normally a bar index. |
y1 | price | required | Y coordinate of the top-left corner, a price or computed value. |
x2 | integer | required | X coordinate of the bottom-right corner of the bounding box. |
y2 | price | required | Y coordinate of the bottom-right corner. |
R, G, B | integer | platform default | Optional COLOURED red, green and blue components, 0 to 255. |
a | integer | 255 | Optional alpha (transparency), 0 fully transparent to 255 fully opaque. |
How it works
DRAWELLIPSE runs inside a ProBuilder indicator. The two coordinate pairs (x1, y1) and (x2, y2) define the top-left and bottom-right corners of a bounding rectangle, and the ellipse is inscribed inside that rectangle. The x coordinates are bar indices and the y coordinates are prices, so the shape covers a span of both time and price. This suits circling a zone of interest or a pattern without altering the underlying data.
The optional COLOURED clause sets colour and transparency. As with other drawing objects, scripts commonly set DEFPARAM DrawOnLastBarOnly = true so the ellipse is drawn once.
Examples
Example 1, A single coloured ellipse (Indicator)
// Ellipse inside the box from (10, 20) to (50, 60), red at half opacity
DRAWELLIPSE(10, 20, 50, 60) COLOURED(255, 0, 0, 128)
RETURNPreserved from the source: the corners set the bounding box and the ellipse fills it, drawn red at 50 percent transparency.
Example 2, Circle a recent swing (Indicator)
// Enclose the last 10 bars around the recent high
DEFPARAM DrawOnLastBarOnly = true
hh = Highest[10](high)
ll = Lowest[10](low)
DRAWELLIPSE(BarIndex-10, hh, BarIndex, ll) COLOURED(0, 120, 255, 150)
RETURNThe bounding box spans 10 bars and the recent range, so the ellipse marks that swing.
Example 3, Ellipse with a fill (Indicator)
// Blue outline with a light fill around the current bar
DEFPARAM DrawOnLastBarOnly = true
DRAWELLIPSE(BarIndex-3, high, BarIndex+3, low) COLOURED(0, 0, 200) FILLCOLOR(200, 220, 255)
RETURNFILLCOLOR shades the interior while COLOURED sets the outline.
Common errors and gotchas
- Indicator only.
DRAWELLIPSEhas no effect in ProScreener, ProOrder or ProBacktest. Keep it in a ProBuilder indicator. - Corners, not centre and radius. The four values are two opposite corners of a bounding box, not a centre point and radii.
- X is a bar index. Passing a price into
x1orx2misplaces the shape horizontally. UseBarIndexor offsets from it. - Redraw cost. Without
DrawOnLastBarOnly = true, the ellipse is drawn on every bar and slows the chart.
Related instructions
DRAWRECTANGLE, draws the bounding box itself.DRAWTRIANGLE, draws a three-vertex shape.DRAWPOINT, draws a single marker point.COLOURED, sets the outline colour and transparency.FILLCOLOR, sets the interior fill colour.DrawOnLastBarOnly, restricts drawing to the last bar for performance.BarIndex, supplies the x coordinates.Highest, finds a range top to enclose.
