Custom Studies Defaults
defaults
is a field in Metainfo of Custom Study, containing an object with settings that are applied when user clicks Apply Defaults
.
This object has following fields:
* - required
bands
- an array with band styles. Band style is an object with fields:color
* - stringlinestyle
* - numberlinewidth
* - numbervalue
* - numbervisible
* - boolean
filledAreasStyle
- an object. The keys are filled area ids, the values are style objects with fields:color
* - stringvisible
* - booleantransparency
* - number
inputs
- an object withinput id
as a key and default value for this input. The default value can bestring
,number
orbool
depending on input type. The field is required if your study has inputspalettes
- an object withpallette id
as a key and palette definition:[name]: { colors, valToIndex, addDefaultColor }
, wherecolors
* - an object{ [color_id]: color_info }
. The color is an object with following fields:color
* - stringstyle
* - numberwidth
* - number
valToIndex
- an object, the mapping between the values that are returned by the script and palette color indexesaddDefaultColor
- boolean, iftrue
the defaults are used forcolorer
type plot, when its value isNaN
precision
* - precision of the study's output values (quantity of digits after the decimal separator)styles
- an object withplot id
as keys and style info as values.plot style
is an object with keys, specific for each plottype
(see below)
Default Styles
Here is a short reference for plot style
object in defaults
.
Some of fields are the same for all of plot types:
visible
* - boolean
Additional fields should be added depending on plot type
.
Line
color
* - string, plot colorlinestyle
* - numberlinewidth
* - numbertrackPrice
* - boolean, iftrue
, price line is displayed
Shapes
plottype
* - string, can have following values:shape_arrow_down
shape_arrow_up
shape_circle
shape_cross
shape_xcross
shape_diamond
shape_flag
shape_square
shape_label_down
shape_label_up
shape_triangle_down
shape_triangle_up
location
*- string, one of the following:AboveBar
BelowBar
Top
Bottom
Right
Left
Absolute
AbsoluteUp
AbsoluteDown
color
* - string, plot colortextColor
* - string, text colorsize
-PlotSymbolSize
, plot size
Note about shape size
To change the shape size, specify the size
property with one of the values listed in PlotSymbolSize
. Note that this property controls the shape's height but not its width.
The width depends on the width of the bar displayed on the chart. When the visible range is low or the chart is zoomed in, the bars expand horizontally, causing the shape's width to increase accordingly.
plots: [
{ id: "plot_0", type: "shapes" },
],
defaults: {
styles: {
plot_0: {
plottype: "shape_arrow_down",
size: 'huge',
// Other properties
},
},
},
Chars
char*
* - stringlocation
*- string, one of the following:AboveBar
BelowBar
Top
Bottom
Right
Left
Absolute
AbsoluteUp
AbsoluteDown
color
* - string, plot colortextColor
* - string, color
Arrows
colorup
* - string, colorcolordown
* - string, color