Skip to main content

Indicators

Indicators

Each indicator can be added with the method BG.charts.Controller.addIndicator to an existing BG.charts.Controller. It returns the new instance of BG.charts.Indicator.

const indicator = controller.addIndicator('TEMA');

Similar to data loaders, the identifiers used to create indicators may also contain parameters. For example, "SMA(14)" will yield a simple moving average of the last 14 values. These parameters may be modified after the initial creation. For example, the following two examples result in the same indicator:

// specify parameter at creation
const indicator = controller.addIndicator('SMA(14)');

// specify parameter after creation
const indicator = controller.addIndicator('SMA');
indicator.set('period', 14);