/** * Zig Zag Indicator * * Identifies trend reversals by connecting pivot highs and lows * that exceed a specified percentage deviation threshold. * * Based on TradingView's ZigZag indicator v8. * * PineScript display: * line.new(x1, y1, x2, y2, color=lineColorInput) * label.new(x, y, text, style=label.style_label_down/up) */ import { type ZigZagPivot, type IndicatorResult, type Bar } from 'oakscriptjs'; import type { InputConfig, PlotConfig } from 'oakscriptjs'; import type { LineDrawingData, LabelData } from '../types'; /** * ZigZag indicator input parameters */ export interface ZigZagInputs { /** Minimum percentage deviation for reversal (default: 5.0) */ deviation: number; /** Number of bars for pivot point detection (default: 10) */ depth: number; /** Extend line from last pivot to current bar */ extendLast: boolean; /** Display reversal price */ showPrice: boolean; /** Display cumulative volume */ showVolume: boolean; /** Display price change */ showChange: boolean; } /** * Extended result with pivot data */ export interface ZigZagResult extends IndicatorResult { /** Raw pivot data for advanced consumers */ pivots: ZigZagPivot[]; /** Extension line to current bar (if extendLast enabled) */ extension: ZigZagPivot | null; /** Line drawings connecting pivots */ lines: LineDrawingData[]; /** Labels at pivot points */ labels: LabelData[]; } /** * Default input values */ export declare const defaultInputs: ZigZagInputs; /** * Input configuration for UI */ export declare const inputConfig: InputConfig[]; export declare const plotConfig: PlotConfig[]; /** * Indicator metadata */ export declare const metadata: { title: string; shortTitle: string; overlay: boolean; }; /** * Calculate ZigZag indicator */ export declare function calculate(bars: Bar[], inputs?: Partial): ZigZagResult; /** * ZigZag indicator module */ export declare const ZigZag: { calculate: typeof calculate; metadata: { title: string; shortTitle: string; overlay: boolean; }; defaultInputs: ZigZagInputs; inputConfig: InputConfig[]; plotConfig: PlotConfig[]; }; //# sourceMappingURL=zigzag.d.ts.map