UNPKG

trading-signals

Version:

Technical indicators to run technical analysis with JavaScript / TypeScript.

25 lines 763 B
import { EMA } from '../EMA/EMA.js'; import { IndicatorSeries } from '../../base/Indicator.js'; export class DEMA extends IndicatorSeries { #inner; #outer; interval; constructor(interval) { super(); this.interval = interval; this.#inner = new EMA(interval); this.#outer = new EMA(interval); } getRequiredInputs() { return this.#outer.getRequiredInputs(); } update(price, replace) { const innerResult = this.#inner.update(price, replace); const outerResult = this.#outer.update(innerResult, replace); return this.setResult(innerResult * 2 - outerResult, replace); } get isStable() { return this.#outer.isStable; } } //# sourceMappingURL=DEMA.js.map