trading-signals
Version:
Technical indicators to run technical analysis with JavaScript / TypeScript.
28 lines (27 loc) • 960 B
TypeScript
import type { DEMA } from '../../trend/DEMA/DEMA.js';
import type { EMA } from '../../trend/EMA/EMA.js';
import { TechnicalIndicator, TradingSignal } from '../../base/Indicator.js';
export type MACDResult = {
histogram: number;
macd: number;
signal: number;
};
export declare class MACD extends TechnicalIndicator<MACDResult, number> {
#private;
readonly prices: number[];
readonly short: EMA | DEMA;
readonly long: EMA | DEMA;
readonly signal: EMA | DEMA;
constructor(short: EMA | DEMA, long: EMA | DEMA, signal: EMA | DEMA);
getRequiredInputs(): number;
update(price: number, replace: boolean): {
histogram: number;
macd: number;
signal: number;
} | null;
protected calculateSignal(result?: MACDResult | null | undefined): "BEARISH" | "BULLISH" | "UNKNOWN";
getSignal(): {
state: (typeof TradingSignal)[keyof typeof TradingSignal];
hasChanged: boolean;
};
}