Class: StudyDescriptor

CIQ.Studies. StudyDescriptor


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

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 calculate 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()

Returns the y-axis used by the study

Since:
  • 7.1.0

Returns:

Y axis

Type
CIQ.ChartEngine.YAxis

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