Graphical/probuilder

DRAWARROW

DRAWARROW in ProBuilder draws a horizontal right-pointing arrow at a bar index and price, with an optional COLOURED colour and transparency. Syntax and examples.

Syntax

probuilder
DRAWARROW(x1, y1) COLOURED(R, G, B, a)

Parameters

NameTypeDefaultDescription
x1integerrequiredBar index where the arrow is drawn.
y1pricerequiredPrice or vertical value the arrow points to.
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

DRAWARROW runs inside a ProBuilder indicator. It draws a horizontal arrow pointing to the right, anchored at the coordinate (x1, y1), where x1 is a bar index and y1 is a price. It is used to flag a specific bar or event, such as a moving-average crossover.

Because the arrow marks a condition on a single bar, it is normally placed inside an IF block that fires only when the event occurs, so arrows accumulate across history where the condition was met. The optional COLOURED clause sets colour and transparency, which is handy for distinguishing event types. For a single arrow on the current bar, set DEFPARAM DrawOnLastBarOnly = true.

Examples

Example 1, Mark a moving-average crossover (Indicator)

probuilder
// Blue arrow at the crossover, purple arrows while fast stays above slow
fast = Average[10](close)
slow = Average[30](close)
IF fast CROSSES OVER slow THEN
    cross = slow[1]
    DRAWARROW(BarIndex-1, slow[1]) COLOURED(0, 100, 255, 255)
ENDIF
IF fast > slow AND slow <> cross THEN
    DRAWARROW(BarIndex, slow) COLOURED(151, 17, 228, 100)
ENDIF
RETURN

The first arrow flags the crossover bar, then semi-transparent arrows follow while the fast average stays above the slow one.

Example 2, Flag every new high (Indicator)

probuilder
// A green arrow at each bar that prints a new 20-bar high
IF high >= Highest[20](high) THEN
    DRAWARROW(BarIndex, high) COLOURED(0, 200, 0)
ENDIF
RETURN

Arrows accumulate through history at each fresh high.

Example 3, Single arrow on the last bar (Indicator)

probuilder
// One arrow at the current close only
DEFPARAM DrawOnLastBarOnly = true
DRAWARROW(BarIndex, close) COLOURED(255, 140, 0)
RETURN

With DrawOnLastBarOnly = true, only the current bar is marked.

Common errors and gotchas

  • Indicator only. DRAWARROW has no effect in ProScreener, ProOrder or ProBacktest. Keep it in a ProBuilder indicator.
  • Points right, not up or down. DRAWARROW is a horizontal right-pointing arrow. For directional signals use DRAWARROWUP or DRAWARROWDOWN.
  • X is a bar index. Passing a price into x1 misplaces the arrow horizontally. Use BarIndex.
  • Every-bar arrows. Without a guarding condition or DrawOnLastBarOnly, an arrow is drawn on every bar and clutters the chart.