The STYLE keyword in ProBuilder language is used to define the visual representation of the values returned by an indicator in a chart. This keyword allows users to programmatically set the style of the indicator lines, points, or histograms, which can otherwise be manually adjusted in the indicator settings window.
RETURN myvariable STYLE(<style_type>,<width>)
The style_type parameter specifies the type of visual representation, and the width parameter defines the thickness of the lines or size of the points.
This example demonstrates how to use the STYLE keyword to style different aspects of an indicator that calculates the difference between two linear regression lines and its exponential average:
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"
In this example, diff is styled as a histogram with a specific color and width, avgdiff as a line, and avgdiff[1] (which represents a delayed value of avgdiff) as a dotted line.
Using the STYLE keyword effectively allows for better visualization of data, making it easier to interpret the behavior of different indicators on a chart. Each style type can be used to highlight different aspects of data, depending on the analysis requirements.