/** * Adaptive MACD [LuxAlgo] * * R-squared correlation-based adaptive MACD. * The MACD line adapts its speed based on the Pearson correlation between * price and bar index (R²). When price is trending (high R²), MACD behaves * like standard MACD. When choppy (low R²), the adaptive factor K changes * the lag characteristics. * * Formula: * a1 = 2/(fast+1), a2 = 2/(slow+1) * r2 = 0.5 * correlation(close, bar_index, length)^2 + 0.5 * K = r2 * (1-a1)(1-a2) + (1-r2) * (1-a1)/(1-a2) * macd[i] = (close - close[1]) * (a1-a2) + (2-a1-a2) * macd[1] - K * macd[2] * signal = EMA(macd, signalLen) * histogram = macd - signal * * Reference: TradingView "Adaptive MACD [LuxAlgo]" */ import { type IndicatorResult, type InputConfig, type PlotConfig, type Bar } from 'oakscriptjs'; export interface AdaptiveMACDInputs { r2Period: number; fast: number; slow: number; signal: number; } export declare const defaultInputs: AdaptiveMACDInputs; export declare const inputConfig: InputConfig[]; export declare const plotConfig: PlotConfig[]; export declare const metadata: { title: string; shortTitle: string; overlay: boolean; }; export declare function calculate(bars: Bar[], inputs?: Partial): IndicatorResult; export declare const AdaptiveMACD: { calculate: typeof calculate; metadata: { title: string; shortTitle: string; overlay: boolean; }; defaultInputs: AdaptiveMACDInputs; inputConfig: InputConfig[]; plotConfig: PlotConfig[]; }; //# sourceMappingURL=adaptive-macd.d.ts.map