Fills levels and bands
Fills
Area in between any two plots can be filled with a color (often semi-transparent). To use this feature there is a
@fill
decorator and a Fill
class.
In the first place the @fill
decorator declares which two plots should be used for filling. Optionally
it may have a color argument, which should be used if a single-colored fill is desired.
Single-colored fill
The simplest possible usecase fills the space between two plot lines:
Please note, that both @fill
decorator and Fill
object always must be used together. Even in simple cases of a
single-colored fills where Fill
object is constructed with all default values (i.e. with no arguments Fill()
).
Multicolored fill
If a multicolored fill is needed, then the color value should be calculated in the Main
function code and passed as
argument to a Fill
object returned by the Main
function.
Multicolored fill with an offset
Fill()
has an optional parameter offset: int
. It may be used to shift the coloring to the left (if offset
is
negative) or to the right (if offset
is positive):
Please note, that a non-zero fill offset
has effect only to multi-colored fills and has none to single-colored ones.
Levels
@level()
decorator creates a level (horizontal line).
Parameters:
value
— Value of the level on a vertical scale of an indicator.title
— Human readable title which is visible in the indicator’s Settings panel.line_color
— Color of the line.line_style
— Style of the line. It is represented as enum value of typeline_style
.line_width
— Width of the line.
Example:
Bands
@band()
decorator creates a band (two horizontal lines usually with a semi-transparent fill in between them).
Parameters:
value1
— Value of the first horizontal line of a band on a vertical scale of an indicator.value2
— Value of the second horizontal line of a band on a vertical scale of an indicator.title
— Human readable title which is visible in the indicator’s Settings panel.fill_color
— Color of the background.line_color
— Color of the line.line_style
— Style of the line. It is represented as enum value of typeline_style
.line_width
— Width of the line.
Example:
Was this page helpful?