Custom Studies Defaults - SpartaCommodities/Trading_view_wiki GitHub Wiki
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 idas a key and default value for this input. The default value can bestring,numberorbooldepending on input type. The field is required if your study has inputspalettes- an object withpallette idas 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, iftruethe defaults are used forcolorertype plot, when its value isNaN
precision* - precision of the study's output values (quantity of digits after the decimal separator)styles- an object withplot idas keys and style info as values.plot styleis 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_downshape_arrow_upshape_circleshape_crossshape_xcrossshape_diamondshape_flagshape_squareshape_label_downshape_label_upshape_triangle_downshape_triangle_up
location*- string, one of the following:AboveBarBelowBarTopBottomRightLeftAbsoluteAbsoluteUpAbsoluteDown
color* - string, plot colortextColor* - string, text color
Chars
char** - stringlocation*- string, one of the following:AboveBarBelowBarTopBottomRightLeftAbsoluteAbsoluteUpAbsoluteDown
color* - string, plot colortextColor* - string, color
Arrows
colorup* - string, colorcolordown* - string, color