Documentation / @finchart/indicators / movingAverage
Function: movingAverage()
Call Signature
movingAverage(
source,options):MovingAverage
Defined in: indicators/src/factories.ts:162
Moving average — simple (default) or exponential. There's only one branch, ma, but it's a computed node because it can serve as another indicator's input (Source).
ts
const ma20 = movingAverage(price, { period: 20 });
const ema20 = movingAverage(price, { period: 20, type: "ema" });
pane.addSeries({ series: lineSeries(), input: ma20.out.ma });Parameters
source
Source<OHLC>
options
Returns
Call Signature
movingAverage<
T>(source,options):MovingAverage
Defined in: indicators/src/factories.ts:166
Moving average — simple (default) or exponential. There's only one branch, ma, but it's a computed node because it can serve as another indicator's input (Source).
ts
const ma20 = movingAverage(price, { period: 20 });
const ema20 = movingAverage(price, { period: 20, type: "ema" });
pane.addSeries({ series: lineSeries(), input: ma20.out.ma });Type Parameters
T
T extends BaseDataPoint
Parameters
source
Source<T>
options
MovingAverageOptions & object