MCPcopy Create free account
hub / github.com/AmazingAng/PolyWorld / computeEMA

Function computeEMA

src/components/ChartPanel.tsx:65–72  ·  view source on GitHub ↗
(values: number[], period: number)

Source from the content-addressed store, hash-verified

63}
64
65function computeEMA(values: number[], period: number): number[] {
66 const k = 2 / (period + 1);
67 const ema: number[] = [values[0]];
68 for (let i = 1; i < values.length; i++) {
69 ema.push(values[i] * k + ema[i - 1] * (1 - k));
70 }
71 return ema;
72}
73
74function computeMACD(bars: OHLCBar[]): {
75 macd: { time: number; value: number }[];

Callers 1

computeMACDFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected