@thuantan2060/technicalindicators
Version:
Techincal Indicators written in javascript
54 lines (53 loc) • 2.27 kB
TypeScript
import StockData from '../StockData';
import CandlestickFinder, { ICandlestickConfig } from './CandlestickFinder';
/**
* Configuration interface for BearishMarubozu pattern.
* Includes body tolerance thresholds for determining shadow significance.
*/
export interface IBearishMarubozuConfig extends ICandlestickConfig {
/** Body tolerance as percentage of body size (default: 0.015 = 1.5%) */
bodyTolerancePercent?: number;
/** Minimum body tolerance absolute value (default: 0.00015) */
bodyToleranceMinimum?: number;
}
/**
* Default configuration for BearishMarubozu pattern.
*/
export declare const DEFAULT_BEARISH_MARUBOZU_CONFIG: IBearishMarubozuConfig;
export default class BearishMarubozu extends CandlestickFinder {
private bodyTolerancePercent;
private bodyToleranceMinimum;
constructor(config?: IBearishMarubozuConfig);
logic(data: StockData): boolean;
}
/**
* Detects Bearish Marubozu candlestick pattern in the provided stock data.
*
* A Bearish Marubozu is a long bearish candlestick with no upper or lower shadows,
* indicating strong selling pressure throughout the trading session. The opening price
* equals the high and the closing price equals the low.
*
* @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 Bearish Marubozu pattern is detected, false otherwise
*
* @example
* ```typescript
* // Using default configuration
* const hasBearishMarubozuPattern = bearishmarubozu(stockData);
*
* // Using custom configuration
* const hasBearishMarubozuPattern = bearishmarubozu(stockData, {
* scale: 0.002,
* bodyTolerancePercent: 0.02,
* bodyToleranceMinimum: 0.0002
* });
*
* // Backward compatibility with scale parameter
* const hasBearishMarubozuPattern = bearishmarubozu(stockData, { scale: 0.002 });
* ```
*/
export declare function bearishmarubozu(data: StockData, config?: IBearishMarubozuConfig): any;