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
DRAWARROW(x1, y1) COLOURED(R, G, B, a)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
x1 | integer | required | Bar index where the arrow is drawn. |
y1 | price | required | Price or vertical value the arrow points to. |
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
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)
// 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
RETURNThe 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)
// 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
RETURNArrows accumulate through history at each fresh high.
Example 3, Single arrow on the last bar (Indicator)
// One arrow at the current close only
DEFPARAM DrawOnLastBarOnly = true
DRAWARROW(BarIndex, close) COLOURED(255, 140, 0)
RETURNWith DrawOnLastBarOnly = true, only the current bar is marked.
Common errors and gotchas
- Indicator only.
DRAWARROWhas no effect in ProScreener, ProOrder or ProBacktest. Keep it in a ProBuilder indicator. - Points right, not up or down.
DRAWARROWis a horizontal right-pointing arrow. For directional signals useDRAWARROWUPorDRAWARROWDOWN. - X is a bar index. Passing a price into
x1misplaces the arrow horizontally. UseBarIndex. - Every-bar arrows. Without a guarding condition or
DrawOnLastBarOnly, an arrow is drawn on every bar and clutters the chart.
Related instructions
DRAWARROWUP, an upward-pointing arrow.DRAWARROWDOWN, a downward-pointing arrow.DRAWPOINT, a marker point.DRAWTEXT, a text label.COLOURED, sets colour and transparency.DrawOnLastBarOnly, restricts drawing to the last bar.BarIndex, supplies the x coordinate.Average, supplies a moving average to test for crossovers.
