Skip to content

Documentation / @finchart/indicators / attachMovingAverage

Function: attachMovingAverage() ​

attachMovingAverage(options): Plugin<SeriesHost, IndicatorApi<MovingAverage>>

Defined in: indicators/src/plugins.ts:381

Mounts a moving average on that pane.

ts
const ma = plot.mainPane.use(attachMovingAverage({ source: price, period: 20 }));

The host is a pane because mounting a single series is all this needs — taking the whole PaneHost when only addSeries gets used left the indicator unaware if the pane it was mounted on later disappeared.

Parameters ​

options ​

AttachMovingAverageOptions

Returns ​

Plugin<SeriesHost, IndicatorApi<MovingAverage>>