UNPKG

meridianalgo-js

Version:

Advanced algorithmic trading library for Node.js & TypeScript with 100+ technical indicators, pattern recognition, and risk management tools.

172 lines 6.32 kB
/** * Candlestick Pattern Recognition * * This module provides candlestick pattern recognition capabilities for * technical analysis including doji, hammer, engulfing patterns, and more. * * @fileoverview Candlestick pattern recognition for technical analysis * @author MeridianAlgo * @version 1.0.0 */ /** * Candlestick data structure */ export interface Candlestick { open: number; high: number; low: number; close: number; volume?: number; } /** * Pattern recognition result */ export interface PatternResult { pattern: string; bullish: boolean; bearish: boolean; confidence: number; description: string; } /** * Doji Pattern * * A doji occurs when the open and close prices are very close or equal, * indicating indecision in the market. * * @param candle - Candlestick data * @param threshold - Threshold for body size relative to total range (default: 0.1) * @returns Pattern result if doji is detected */ export declare function detectDoji(candle: Candlestick, threshold?: number): PatternResult | null; /** * Hammer Pattern * * A hammer is a bullish reversal pattern with a small body at the top * and a long lower shadow, indicating potential upward reversal. * * @param candle - Candlestick data * @param threshold - Threshold for shadow ratio (default: 2) * @returns Pattern result if hammer is detected */ export declare function detectHammer(candle: Candlestick, threshold?: number): PatternResult | null; /** * Shooting Star Pattern * * A shooting star is a bearish reversal pattern with a small body at the bottom * and a long upper shadow, indicating potential downward reversal. * * @param candle - Candlestick data * @param threshold - Threshold for shadow ratio (default: 2) * @returns Pattern result if shooting star is detected */ export declare function detectShootingStar(candle: Candlestick, threshold?: number): PatternResult | null; /** * Engulfing Pattern (Bullish) * * A bullish engulfing pattern occurs when a small bearish candle is followed * by a larger bullish candle that completely engulfs the previous candle. * * @param prevCandle - Previous candlestick * @param currentCandle - Current candlestick * @returns Pattern result if bullish engulfing is detected */ export declare function detectBullishEngulfing(prevCandle: Candlestick, currentCandle: Candlestick): PatternResult | null; /** * Engulfing Pattern (Bearish) * * A bearish engulfing pattern occurs when a small bullish candle is followed * by a larger bearish candle that completely engulfs the previous candle. * * @param prevCandle - Previous candlestick * @param currentCandle - Current candlestick * @returns Pattern result if bearish engulfing is detected */ export declare function detectBearishEngulfing(prevCandle: Candlestick, currentCandle: Candlestick): PatternResult | null; /** * Morning Star Pattern * * A morning star is a three-candle bullish reversal pattern consisting of * a long bearish candle, a small body candle (doji), and a long bullish candle. * * @param candles - Array of three candlesticks * @returns Pattern result if morning star is detected */ export declare function detectMorningStar(candles: Candlestick[]): PatternResult | null; /** * Evening Star Pattern * * An evening star is a three-candle bearish reversal pattern consisting of * a long bullish candle, a small body candle (doji), and a long bearish candle. * * @param candles - Array of three candlesticks * @returns Pattern result if evening star is detected */ export declare function detectEveningStar(candles: Candlestick[]): PatternResult | null; /** * Harami Pattern (Bullish) * * A bullish harami is a two-candle pattern where a small bullish candle * is contained within the body of the previous large bearish candle. * * @param prevCandle - Previous candlestick * @param currentCandle - Current candlestick * @returns Pattern result if bullish harami is detected */ export declare function detectBullishHarami(prevCandle: Candlestick, currentCandle: Candlestick): PatternResult | null; /** * Harami Pattern (Bearish) * * A bearish harami is a two-candle pattern where a small bearish candle * is contained within the body of the previous large bullish candle. * * @param prevCandle - Previous candlestick * @param currentCandle - Current candlestick * @returns Pattern result if bearish harami is detected */ export declare function detectBearishHarami(prevCandle: Candlestick, currentCandle: Candlestick): PatternResult | null; /** * Three White Soldiers Pattern * * Three white soldiers is a bullish continuation pattern consisting of * three consecutive long bullish candles with higher closes. * * @param candles - Array of three candlesticks * @returns Pattern result if three white soldiers is detected */ export declare function detectThreeWhiteSoldiers(candles: Candlestick[]): PatternResult | null; /** * Three Black Crows Pattern * * Three black crows is a bearish continuation pattern consisting of * three consecutive long bearish candles with lower closes. * * @param candles - Array of three candlesticks * @returns Pattern result if three black crows is detected */ export declare function detectThreeBlackCrows(candles: Candlestick[]): PatternResult | null; /** * Detect all patterns in a series of candlesticks * * @param candles - Array of candlestick data * @returns Array of detected patterns */ export declare function detectAllPatterns(candles: Candlestick[]): PatternResult[]; /** * Collection of candlestick pattern recognition functions */ export declare const PatternRecognition: { detectDoji: typeof detectDoji; detectHammer: typeof detectHammer; detectShootingStar: typeof detectShootingStar; detectBullishEngulfing: typeof detectBullishEngulfing; detectBearishEngulfing: typeof detectBearishEngulfing; detectMorningStar: typeof detectMorningStar; detectEveningStar: typeof detectEveningStar; detectBullishHarami: typeof detectBullishHarami; detectBearishHarami: typeof detectBearishHarami; detectThreeWhiteSoldiers: typeof detectThreeWhiteSoldiers; detectThreeBlackCrows: typeof detectThreeBlackCrows; detectAllPatterns: typeof detectAllPatterns; }; //# sourceMappingURL=patterns.d.ts.map