UNPKG

@thuantan2060/technicalindicators

Version:
50 lines (49 loc) 1.85 kB
import StockData from '../StockData'; import CandlestickFinder, { ICandlestickConfig } from './CandlestickFinder'; /** * Configuration interface for Doji pattern. * Includes body tolerance thresholds for determining when open equals close. */ export interface IDojiConfig extends ICandlestickConfig { } /** * Default configuration for Doji pattern. */ export declare const DEFAULT_DOJI_CONFIG: IDojiConfig; export default class Doji extends CandlestickFinder { private bodyTolerancePercent; private bodyToleranceMinimum; constructor(config?: IDojiConfig); logic(data: StockData): boolean; } /** * Detects Doji candlestick pattern in the provided stock data. * * A Doji is a candlestick pattern where the opening and closing prices are virtually equal, * creating a cross-like appearance. This pattern indicates market indecision and potential * trend reversal points. * * @param data - Stock data containing OHLC values * @param config - Configuration object for pattern detection * @param config.scale - Scale parameter for approximateEqual function precision (default: 0.001) * @param config.bodyTolerancePercent - Body tolerance as percentage of body size (default: 0.015 = 1.5%) * @param config.bodyToleranceMinimum - Minimum body tolerance absolute value (default: 0.00015) * @returns True if Doji pattern is detected, false otherwise * * @example * ```typescript * // Using default configuration * const hasDojiPattern = doji(stockData); * * // Using custom configuration * const hasDojiPattern = doji(stockData, { * scale: 0.002, * bodyTolerancePercent: 0.02, * bodyToleranceMinimum: 0.0002 * }); * * // Backward compatibility with scale parameter * const hasDojiPattern = doji(stockData, { scale: 0.002 }); * ``` */ export declare function doji(data: StockData, config?: IDojiConfig): any;