new StudyDescriptor(name, type, panel, inputs, outputs, parameters)
Creates a study descriptor which contains all of the information necessary to handle a study. Also provides convenience methods to extract information from it.
Do not call directly or try to manually create your own study descriptor, but rather always use the one returned by CIQ.Studies.addStudy
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the study. This should be unique to the chart. For instance if there are two RSI panels then they should be of different periods and named accordingly. Usually this is determined automatically by the library. |
type |
string | The type of study, which can be used as a look up in the StudyLibrary |
panel |
string | The name of the panel that contains the study |
inputs |
object | Names and values of input fields |
outputs |
object | Names and values (colors) of outputs |
parameters |
object | Additional parameters that are unique to the particular study |
Members
-
disabled :boolean
-
Display state of the study.
Type:
- boolean
- Since:
-
8.7.0
-
inputs :Object.<string, (string|number|boolean)>
-
Keys for each possible study input with descriptors for the set and default values.
Type:
- Object.<string, (string|number|boolean)>
-
max :number|null
-
The maximum data point.
Type:
- number | null
-
min :number|null
-
The minimum data point.
Type:
- number | null
-
name :string
-
The study's ID. Includes ZWNJ characters. Please note: To facilitate study name translations, study names use zero-width non-joiner (unprintable) characters to delimit the general study name from the specific study parameters. Example: "\u200c"+"Aroon"+"\u200c"+" (14)". At translation time, the library will split the text into pieces using the ZWNJ characters, parentheses, and commas to just translate the required part of a study name. For more information on ZWNJ characters see: Zero-width_non-joiner. Please be aware of these ZWNJ characters, which will now be present in all study names and corresponding panel names; including the
layout.studies
study keys. Affected fields in the study descriptors could beid
,display
,name
andpanel
.
To prevent issues, always use the names returned in the study descriptor. This will ensure compatibility between versions.Example:
Correct reference:stxx.layout.studies["\u200c"+"Aroon"+"\u200c"+" (14)"];
Incorrect reference:stxx.layout.studies["Aroon (14)"];
Type:
- string
-
outputs :Object.<string, (string|number)>
-
Keys for each possible study output with its corresponding rendering color.
Type:
- Object.<string, (string|number)>
-
panel :string
-
ID of the panel element to which the study is attached.
Type:
- string
-
parameters :Object.<string, (string|number|boolean|Object.<string, (string|number|boolean)>)>
-
Keys for each of the study's possible plot parameters.
Type:
- Object.<string, (string|number|boolean|Object.<string, (string|number|boolean)>)>
-
type :string
-
The study type.
Type:
- string
Methods
-
appendFutureTicks(stx, ticks)
-
Adds extra ticks to the end of the scrubbed array, to be added later to the dataSet.
This function can be used to add extra ticks, like offsets into the future, to the dataSet to be plotted ahead of the current bar. If a DT is not supplied, one will be calculated for each tick in the array.
Remember to call this outside of any loop that iterates through the quotes array, or you will create a never-ending loop, since this increases the array size.
Parameters:
Name Type Description stx
CIQ.ChartEngine A chart engine instance
ticks
array The array of ticks to add. Each tick is an object containing whatever data to add.
- Since:
-
7.3.0
Example
var futureTicks=[]; for(i++;i<quotes.length;i++){ var quote=quotes[i]; if(i+offset>=0){ if(i+offset<quotes.length) quotes[i+offset][name]=quote["Forecast "+sd.name]; else { var ft={}; ft[name]=quote["Forecast "+sd.name]; futureTicks.push(ft); } } } sd.appendFutureTicks(stx,futureTicks);
-
getContext(stx)
-
Returns the context to use for drawing the study
Parameters:
Name Type Description stx
CIQ.ChartEngine A chart object
- Since:
-
7.1.0
Returns:
An HTML canvas context
- Type
- object
-
getDependents(stx [, followsPanel])
-
Returns an array of all studies which depend on a given study. A dependent study is one which uses an output of another study as input.
Parameters:
Name Type Argument Description stx
CIQ.ChartEngine A chart object
followsPanel
boolean <optional>
If true, will only return those studies which are not assigned to an explicit panel
- Since:
-
7.1.0
Returns:
Array of dependent studies
- Type
- array
-
getYAxis(stx)
-
Returns the y-axis used by the study
Parameters:
Name Type Description stx
CIQ.ChartEngine CIQ.ChartEngine
- Since:
-
7.1.0
Returns:
y-axis
-
toggleDisabledState(stx)
-
Toggles the
disabled
property.Parameters:
Name Type Description stx
CIQ.ChartEngine CIQ.ChartEngine
- Since:
-
8.7.0
-
undraggable(stx)
-
Determines whether the study can be dragged to another axis or panel.
Parameters:
Name Type Description stx
CIQ.ChartEngine A chart object.
- Since:
-
7.3.0
Returns:
true if not allowed to drag.
- Type
- boolean