|
Drawing Styles
When creating a custom indicator, you can specify one of 18 types of graphical plotting (as displayed in the main chart window or a chart subwindow), whose values are specified in the ENUM_DRAW_TYPE enumeration.
In one custom indicator, it is permissible to use any indicator building/drawing types. Each construction type requires specification of one to five global arrays for storing data necessary for drawing. These data arrays must be bound with indicator buffers using the SetIndexBuffer() function. The type of data from ENUM_INDEXBUFFER_TYPE should be specified for each buffer.
Depending on the drawing style, you may need one to four value buffers (marked as INDICATOR_DATA). If a style admits dynamic alternation of colors (all styles contain COLOR in their names), then you'll need one more buffer of color (indicated type INDICATOR_COLOR_INDEX). The color buffers are always bound after value buffers corresponding to the style.
ID |
Description |
Data buffers |
Color buffers |
---|---|---|---|
Not drawn |
1 |
0 |
|
Line |
1 |
0 |
|
Section |
1 |
0 |
|
Histogram from the zero line |
1 |
0 |
|
Histogram of the two indicator buffers |
2 |
0 |
|
Drawing arrows |
1 |
0 |
|
Style Zigzag allows vertical section on the bar |
2 |
0 |
|
Color fill between the two levels |
2 |
0 |
|
Display as a sequence of bars |
4 |
0 |
|
Display as a sequence of candlesticks |
4 |
0 |
|
Multicolored line |
1 |
1 |
|
Multicolored section |
1 |
1 |
|
Multicolored histogram from the zero line |
1 |
1 |
|
Multicolored histogram of the two indicator buffers |
2 |
1 |
|
Drawing multicolored arrows |
1 |
1 |
|
Multicolored ZigZag |
2 |
1 |
|
Multicolored bars |
4 |
1 |
|
Multicolored candlesticks |
4 |
1 |
To refine the display of the selected drawing type identifiers listed in ENUM_PLOT_PROPERTY are used.
For functions PlotIndexSetInteger() and PlotIndexGetInteger()
ID |
Description |
Property type |
---|---|---|
PLOT_ARROW |
Arrow code for style DRAW_ARROW |
uchar |
PLOT_ARROW_SHIFT |
Vertical shift of arrows for style DRAW_ARROW |
int |
PLOT_DRAW_BEGIN |
Number of initial bars without drawing and values in the DataWindow |
int |
PLOT_DRAW_TYPE |
Type of graphical construction |
|
PLOT_SHOW_DATA |
Sign of display of construction values in the DataWindow |
bool |
PLOT_SHIFT |
Shift of indicator plotting along the time axis in bars |
int |
PLOT_LINE_STYLE |
Drawing line style |
|
PLOT_LINE_WIDTH |
The thickness of the drawing line |
int |
PLOT_COLOR_INDEXES |
The number of colors |
int |
PLOT_LINE_COLOR |
The index of a buffer containing the drawing color |
color modifier = index number of colors
|
For the function PlotIndexSetDouble()
ID |
Description |
Property type |
---|---|---|
PLOT_EMPTY_VALUE |
An empty value for plotting, for which there is no drawing |
double |
For the function PlotIndexSetString()
ID |
Description |
Property type |
---|---|---|
PLOT_LABEL |
The name of the indicator graphical series to display in the DataWindow. When working with complex graphical styles requiring several indicator buffers for display, the names for each buffer can be specified using ";" as a separator. Sample code is shown in DRAW_CANDLES |
string |
5 styles can be used for drawing lines in custom indicators. They are valid only for the line thickness 0 or 1.
ID |
Description |
---|---|
STYLE_SOLID |
Solid line |
STYLE_DASH |
Broken line |
STYLE_DOT |
Dotted line |
STYLE_DASHDOT |
Dash-dot line |
STYLE_DASHDOTDOT |
Dash - two points |
To set the line drawing style and the type of drawing, the PlotIndexSetInteger() function is used. For the Fibonacci extensions the thickness and drawing style of levels can be indicated using the ObjectSetInteger() function.
Example:
#property indicator_chart_window
|