3.9.5Removing an indicator from a chart

You can use ChartChange() to remove an indicator from a chart. This removes a type of indicator.

The extra settings in the call to ChartChange() are as follows:

Property

Description

indicatorType

The class name of an indicator in the FXB.ta library, such as "MACD" or "RSI", or one of the special extra indicators described in relation to load-indicator

indicatorSettings

Optional. Calculation parameters to match against the indicators to remove. If indicatorSettings is omitted, or is an empty object, then all indicators of the indicatorType will be removed from the chart.

For example, to remove all instances of the RSI indicator from a chart:

Framework.ChartChange({

mode: "active", // or "all", or "single" plus a .chartId value

command: "remove-indicator",

indicatorType: "RSI"

});

Same effect:

Framework.ChartChange({

mode: "active", // or "all", or "single" plus a .chartId value

command: "remove-indicator",

indicatorType: "RSI",

indicatorSettings: {}

});

The optional indicatorSettings block can be used to remove only those instances of the indicator type which have specific calculation parameters. For example:

// Remove all EMA indicators where the bar-period is 10

// (leaving EMA indicators where the period is any other value)

Framework.ChartChange({

mode: "active", // or "all", or "single" plus a .chartId value

command: "remove-indicator",

indicatorType: "EMA",

indicatorSettings: {

period: 10

}

});

It is not compulsory to supply all the calculation parameters which the FXB.ta class accepts. For example:

// Removes all instances of the MACD indicator which have 26 for

// their "slow" period, regardless of their "fast" period, their "smoothing" etc.

Framework.ChartChange({

mode: "active", // or "all", or "single" plus a .chartId value

command: "remove-indicator",

indicatorType: "MACD",

indicatorSettings: {

slow: 26

}

});