STYLE
STYLE in ProBuilder sets how a returned indicator series is drawn, as a line, dotted line, histogram or points, with a width. Syntax, options and worked examples.
Syntax
RETURN myvariable STYLE(style_type, width)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
style_type | keyword | LINE | Draw style. See the options table below. |
width | integer | platform default | Line thickness or point size. |
The available style_type values are:
| Style | Effect |
|---|---|
LINE | A plain continuous line. This is the default. |
DOTTEDLINE | A basic dotted line. |
DOTTEDLINE1 to DOTTEDLINE4 | Dotted lines with varying dot patterns. |
HISTOGRAM | A series of vertical bars. |
POINT | A series of separate points. |
How it works
STYLE runs inside a ProBuilder indicator. It attaches to a value in the RETURN line and sets how that series is plotted, which is otherwise chosen by hand in the indicator settings window. It can be combined with COLOURED for colour and AS for a series name, and each returned value can carry its own STYLE.
The width argument sets line thickness or point size. Because STYLE describes a returned series rather than drawing an object at coordinates, it differs from the DRAW commands: it changes the appearance of the indicator output itself.
Examples
Example 1, Histogram, line and dotted line together (Indicator)
// Style three returned series differently on one indicator
i1 = LinearRegression[20](close)
i2 = LinearRegression[10](close)
diff = i2 - i1
avgdiff = ExponentialAverage[7](diff)
RETURN diff COLOURED(50,146,175,90) STYLE(HISTOGRAM,2) AS "LR difference", avgdiff COLOURED(227,247,40) STYLE(LINE,3) AS "Avg of difference", avgdiff[1] COLOURED(227,247,40) STYLE(DOTTEDLINE,1) AS "Delayed Avg of difference"diff is drawn as a histogram, avgdiff as a solid line and its delayed value as a thin dotted line.
Example 2, A single point series (Indicator)
// Plot closing price as points rather than a line
RETURN close STYLE(POINT, 3) AS "Close points"The POINT style renders each value as a separate dot at size 3.
Example 3, A thick line (Indicator)
// A wide moving-average line
ma = Average[50](close)
RETURN ma COLOURED(0, 120, 255) STYLE(LINE, 4) AS "MA50"The width of 4 makes the moving-average line stand out.
Common errors and gotchas
- Indicator output only.
STYLEdescribes a returned series. It has no effect in ProScreener, ProOrder or ProBacktest, which do not plot indicator output. - Attach to a RETURN value.
STYLEmust follow a value in theRETURNline. It is not a standalone statement. - One style per value. In a multi-value
RETURN, each value keeps its ownSTYLE,COLOUREDandAS. A style does not carry to the next value. - Style versus DRAW commands.
STYLEchanges how a series is plotted. To place a shape at coordinates, use aDRAWcommand such asDRAWPOINTinstead.
Related instructions
RETURN, the statementSTYLEattaches to.COLOURED, sets the colour of the returned series.AS, names the returned series in the legend.DRAWPOINT, draws points at coordinates rather than styling a series.GRAPH, plots a value in a separate panel.GRAPHONPRICE, plots a value over the price.ExponentialAverage, a series often returned with aSTYLE.Average, a series often returned with aSTYLE.
