Graphical/probuilder

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

probuilder
DRAWELLIPSE(x1, y1, x2, y2) COLOURED(R, G, B, a)

Parameters

NameTypeDefaultDescription
x1integerrequiredX coordinate of the top-left corner of the bounding box, normally a bar index.
y1pricerequiredY coordinate of the top-left corner, a price or computed value.
x2integerrequiredX coordinate of the bottom-right corner of the bounding box.
y2pricerequiredY coordinate of the bottom-right corner.
R, G, Bintegerplatform defaultOptional COLOURED red, green and blue components, 0 to 255.
ainteger255Optional 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)

probuilder
// Ellipse inside the box from (10, 20) to (50, 60), red at half opacity
DRAWELLIPSE(10, 20, 50, 60) COLOURED(255, 0, 0, 128)
RETURN

Preserved 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)

probuilder
// 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)
RETURN

The bounding box spans 10 bars and the recent range, so the ellipse marks that swing.

Example 3, Ellipse with a fill (Indicator)

probuilder
// 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)
RETURN

FILLCOLOR shades the interior while COLOURED sets the outline.

Common errors and gotchas

  • Indicator only. DRAWELLIPSE has 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 x1 or x2 misplaces the shape horizontally. Use BarIndex or offsets from it.
  • Redraw cost. Without DrawOnLastBarOnly = true, the ellipse is drawn on every bar and slows the chart.