@thuantan2060/technicalindicators
Version:
Techincal Indicators written in javascript
1,278 lines (1,275 loc) • 46.9 kB
TypeScript
// Generated by dts-bundle-generator v9.5.1
declare class LinkedList {
private _head;
private _tail;
private _next;
private _length;
private _current;
constructor();
get head(): any;
get tail(): any;
get current(): any;
get length(): any;
push(data: any): void;
pop(): any;
shift(): any;
unshift(data: any): void;
unshiftCurrent(): any;
removeCurrent(): any;
resetCursor(): this;
next(): any;
}
export declare class FixedSizeLinkedList extends LinkedList {
size: number;
maintainHigh?: boolean;
maintainLow?: boolean;
maintainSum?: boolean;
totalPushed: number;
periodHigh: number;
periodLow: number;
periodSum: number;
lastShift: number;
_push: (data: number) => void;
constructor(size: number, maintainHigh?: boolean, maintainLow?: boolean, maintainSum?: boolean);
add(data: number): void;
iterator(): Generator<any, void, unknown>;
calculatePeriodHigh(): void;
calculatePeriodLow(): void;
}
declare class StockData {
open: number[];
high: number[];
low: number[];
close: number[];
reversedInput?: boolean;
constructor(open: number[], high: number[], low: number[], close: number[], reversedInput: boolean);
}
export declare class CandleData {
open?: number;
high?: number;
low?: number;
close?: number;
timestamp?: number;
volume?: number;
}
export declare class CandleList {
open?: number[];
high?: number[];
low?: number[];
close?: number[];
volume?: number[];
timestamp?: number[];
}
declare class IndicatorInput {
reversedInput?: boolean;
format?: (data: number) => number;
}
declare class Indicator {
result: any;
format: (data: number) => number;
constructor(input: IndicatorInput);
static reverseInputs(input: any): void;
getResult(): any;
}
declare class MAInput extends IndicatorInput {
period: number;
values: number[];
constructor(period: number, values: number[]);
}
export declare class SMA extends Indicator {
period: number;
price: number[];
result: number[];
generator: IterableIterator<number | undefined>;
constructor(input: MAInput);
static calculate: typeof sma;
nextValue(price: number): number | undefined;
}
export declare function sma(input: MAInput): number[];
export declare class EMA extends Indicator {
period: number;
price: number[];
result: number[];
generator: IterableIterator<number | undefined>;
constructor(input: MAInput);
static calculate: typeof ema;
nextValue(price: number): number;
}
export declare function ema(input: MAInput): number[];
export declare class WMA extends Indicator {
period: number;
price: number[];
result: number[];
generator: IterableIterator<number | undefined>;
constructor(input: MAInput);
static calculate: typeof wma;
nextValue(price: number): number | undefined;
}
export declare function wma(input: MAInput): number[];
export declare class WEMA extends Indicator {
period: number;
price: number[];
result: number[];
generator: IterableIterator<number | undefined>;
constructor(input: MAInput);
static calculate: typeof wema;
nextValue(price: number): number | undefined;
}
export declare function wema(input: MAInput): number[];
declare class MACDInput extends IndicatorInput {
values: number[];
SimpleMAOscillator: boolean;
SimpleMASignal: boolean;
fastPeriod: number;
slowPeriod: number;
signalPeriod: number;
constructor(values: number[]);
}
declare class MACDOutput {
MACD?: number;
signal?: number;
histogram?: number;
}
export declare class MACD extends Indicator {
result: MACDOutput[];
generator: IterableIterator<MACDOutput | undefined>;
constructor(input: MACDInput);
static calculate: typeof macd;
nextValue(price: number): MACDOutput | undefined;
}
export declare function macd(input: MACDInput): MACDOutput[];
declare class RSIInput extends IndicatorInput {
period: number;
values: number[];
}
export declare class RSI extends Indicator {
generator: IterableIterator<number | undefined>;
constructor(input: RSIInput);
static calculate: typeof rsi;
nextValue(price: number): number | undefined;
}
export declare function rsi(input: RSIInput): number[];
declare class BollingerBandsInput extends IndicatorInput {
period: number;
stdDev: number;
values: number[];
}
declare class BollingerBandsOutput extends IndicatorInput {
middle: number;
upper: number;
lower: number;
pb: number;
}
export declare class BollingerBands extends Indicator {
generator: IterableIterator<BollingerBandsOutput | undefined>;
constructor(input: BollingerBandsInput);
static calculate: typeof bollingerbands;
nextValue(price: number): BollingerBandsOutput | undefined;
}
export declare function bollingerbands(input: BollingerBandsInput): BollingerBandsOutput[];
declare class ADXInput extends IndicatorInput {
high: number[];
low: number[];
close: number[];
period: number;
}
declare class ADXOutput extends IndicatorInput {
adx: number;
pdi: number;
mdi: number;
}
export declare class ADX extends Indicator {
result: ADXOutput[];
generator: IterableIterator<ADXOutput | undefined>;
constructor(input: ADXInput);
static calculate: typeof adx;
nextValue(price: number): ADXOutput | undefined;
}
export declare function adx(input: ADXInput): ADXOutput[];
declare class ATRInput extends IndicatorInput {
low: number[];
high: number[];
close: number[];
period: number;
}
export declare class ATR extends Indicator {
result: number[];
generator: IterableIterator<number | undefined>;
constructor(input: ATRInput);
static calculate: typeof atr;
nextValue(price: CandleData): number | undefined;
}
export declare function atr(input: ATRInput): number[];
declare class TrueRangeInput extends IndicatorInput {
low: number[];
high: number[];
close: number[];
}
export declare class TrueRange extends Indicator {
result: number[];
generator: IterableIterator<number | undefined>;
constructor(input: TrueRangeInput);
static calculate: typeof truerange;
nextValue(price: CandleData): number | undefined;
}
export declare function truerange(input: TrueRangeInput): number[];
declare class ROCInput extends IndicatorInput {
period: number;
values: number[];
}
export declare class ROC extends Indicator {
result: number[];
generator: IterableIterator<number | undefined>;
constructor(input: ROCInput);
static calculate: typeof roc;
nextValue(price: number): number | undefined;
}
export declare function roc(input: ROCInput): number[];
declare class KSTInput extends IndicatorInput {
ROCPer1: number;
ROCPer2: number;
ROCPer3: number;
ROCPer4: number;
SMAROCPer1: number;
SMAROCPer2: number;
SMAROCPer3: number;
SMAROCPer4: number;
signalPeriod: number;
values: number[];
}
declare class KSTOutput {
kst: number;
signal: number;
}
export declare class KST extends Indicator {
result: KSTOutput[];
generator: IterableIterator<KSTOutput | undefined>;
constructor(input: KSTInput);
static calculate: typeof kst;
nextValue(price: number): any;
}
export declare function kst(input: KSTInput): KSTOutput[];
declare class PSARInput extends IndicatorInput {
step: number;
max: number;
high: number[];
low: number[];
}
export declare class PSAR extends Indicator {
result: number[];
generator: IterableIterator<number | undefined>;
constructor(input: PSARInput);
static calculate: typeof psar;
nextValue(input: PSARInput): number;
}
export declare function psar(input: PSARInput): number[];
declare class StochasticInput extends IndicatorInput {
period: number;
low: number[];
high: number[];
close: number[];
signalPeriod: number;
}
declare class StochasticOutput {
k: number;
d: number;
}
export declare class Stochastic extends Indicator {
result: StochasticOutput[];
generator: IterableIterator<StochasticOutput | undefined>;
constructor(input: StochasticInput);
static calculate: typeof stochastic;
nextValue(input: StochasticInput): StochasticOutput;
}
export declare function stochastic(input: StochasticInput): StochasticOutput[];
declare class WilliamsRInput extends IndicatorInput {
low: number[];
high: number[];
close: number[];
period: number;
}
export declare class WilliamsR extends Indicator {
result: number[];
generator: IterableIterator<number | undefined>;
constructor(input: WilliamsRInput);
static calculate: typeof williamsr;
nextValue(price: number): number | undefined;
}
export declare function williamsr(input: WilliamsRInput): number[];
declare class ADLInput extends IndicatorInput {
high: number[];
low: number[];
close: number[];
volume: number[];
}
export declare class ADL extends Indicator {
generator: IterableIterator<number | undefined>;
constructor(input: ADLInput);
static calculate: typeof adl;
nextValue(price: CandleData): number | undefined;
}
export declare function adl(input: ADLInput): number[];
declare class OBVInput extends IndicatorInput {
close: number[];
volume: number[];
}
export declare class OBV extends Indicator {
generator: IterableIterator<number | undefined>;
constructor(input: OBVInput);
static calculate: typeof obv;
nextValue(price: CandleData): number | undefined;
}
export declare function obv(input: OBVInput): number[];
declare class TRIXInput extends IndicatorInput {
values: number[];
period: number;
}
export declare class TRIX extends Indicator {
result: number[];
generator: IterableIterator<number | undefined>;
constructor(input: TRIXInput);
static calculate: typeof trix;
nextValue(price: number): any;
}
export declare function trix(input: TRIXInput): number[];
declare class ForceIndexInput extends IndicatorInput {
close: number[];
volume: number[];
period: number;
}
export declare class ForceIndex extends Indicator {
result: number[];
generator: IterableIterator<number | undefined>;
constructor(input: ForceIndexInput);
static calculate: typeof forceindex;
nextValue(price: CandleData): number | undefined;
}
export declare function forceindex(input: ForceIndexInput): number[];
declare class CCIInput extends IndicatorInput {
high: number[];
low: number[];
close: number[];
period: number;
}
export declare class CCI extends Indicator {
result: number[];
generator: IterableIterator<number | undefined>;
constructor(input: CCIInput);
static calculate: typeof cci;
nextValue(price: CandleData): number | undefined;
}
export declare function cci(input: CCIInput): number[];
declare class AwesomeOscillatorInput extends IndicatorInput {
high: number[];
low: number[];
fastPeriod: number;
slowPeriod: number;
}
export declare class AwesomeOscillator extends Indicator {
generator: IterableIterator<number | undefined>;
constructor(input: AwesomeOscillatorInput);
static calculate: typeof awesomeoscillator;
nextValue(price: CandleData): number | undefined;
}
export declare function awesomeoscillator(input: AwesomeOscillatorInput): number[];
declare class VWAPInput extends IndicatorInput {
high: number[];
low: number[];
close: number[];
volume: number[];
}
export declare class VWAP extends Indicator {
result: number[];
generator: IterableIterator<number | undefined>;
constructor(input: VWAPInput);
static calculate: typeof vwap;
nextValue(price: CandleData): number | undefined;
}
export declare function vwap(input: VWAPInput): number[];
declare class VolumeProfileInput extends IndicatorInput {
high: number[];
open: number[];
low: number[];
close: number[];
volume: number[];
noOfBars: number;
}
export declare class VolumeProfile extends Indicator {
generator: IterableIterator<number | undefined>;
constructor(input: VolumeProfileInput);
static calculate: typeof volumeprofile;
nextValue(price: CandleData): number | undefined;
}
export declare function volumeprofile(input: VolumeProfileInput): number[];
declare class MFIInput extends IndicatorInput {
high: number[];
low: number[];
close: number[];
volume: number[];
period: number;
}
export declare class MFI extends Indicator {
generator: IterableIterator<number | undefined>;
constructor(input: MFIInput);
static calculate: typeof mfi;
nextValue(price: CandleData): number | undefined;
}
export declare function mfi(input: MFIInput): number[];
declare class StochasticRsiInput extends IndicatorInput {
values: number[];
rsiPeriod: number;
stochasticPeriod: number;
kPeriod: number;
dPeriod: number;
}
declare class StochasticRSIOutput {
stochRSI: number;
k: number;
d: number;
}
export declare class StochasticRSI extends Indicator {
result: StochasticRSIOutput[];
generator: IterableIterator<StochasticRSIOutput | undefined>;
constructor(input: StochasticRsiInput);
static calculate: typeof stochasticrsi;
nextValue(input: StochasticRsiInput): StochasticRSIOutput;
}
export declare function stochasticrsi(input: StochasticRsiInput): StochasticRSIOutput[];
declare class AvgGainInput extends IndicatorInput {
period: number;
values: number[];
}
export declare class AverageGain extends Indicator {
generator: IterableIterator<number | undefined>;
constructor(input: AvgGainInput);
static calculate: typeof averagegain;
nextValue(price: number): number | undefined;
}
export declare function averagegain(input: AvgGainInput): number[];
declare class AvgLossInput extends IndicatorInput {
values: number[];
period: number;
}
export declare class AverageLoss extends Indicator {
generator: IterableIterator<number | undefined>;
constructor(input: AvgLossInput);
static calculate: typeof averageloss;
nextValue(price: number): number | undefined;
}
export declare function averageloss(input: AvgLossInput): number[];
declare class SDInput extends IndicatorInput {
period: number;
values: number[];
}
export declare class SD extends Indicator {
generator: IterableIterator<number | undefined>;
constructor(input: SDInput);
static calculate: typeof sd;
nextValue(price: number): number | undefined;
}
export declare function sd(input: SDInput): number[];
declare class HighestInput extends IndicatorInput {
values: number[];
period: number;
}
export declare class Highest extends Indicator {
generator: IterableIterator<number | undefined>;
constructor(input: HighestInput);
static calculate: typeof highest;
nextValue(price: number): number | undefined;
}
export declare function highest(input: HighestInput): number[];
declare class LowestInput extends IndicatorInput {
values: number[];
period: number;
}
export declare class Lowest extends Indicator {
generator: IterableIterator<number | undefined>;
constructor(input: LowestInput);
static calculate: typeof lowest;
nextValue(price: number): number | undefined;
}
export declare function lowest(input: LowestInput): number[];
declare class SumInput extends IndicatorInput {
values: number[];
period: number;
}
export declare class Sum extends Indicator {
generator: IterableIterator<number | undefined>;
constructor(input: SumInput);
static calculate: typeof sum;
nextValue(price: number): number | undefined;
}
export declare function sum(input: SumInput): number[];
declare class RenkoInput extends IndicatorInput {
period?: number;
brickSize?: number;
useATR?: boolean;
low?: number[];
open?: number[];
volume?: number[];
high?: number[];
close?: number[];
timestamp?: number[];
}
export declare function renko(input: RenkoInput): CandleList;
declare class HeikinAshiInput extends IndicatorInput {
low?: number[];
open?: number[];
volume?: number[];
high?: number[];
close?: number[];
timestamp?: number[];
}
export declare class HeikinAshi extends Indicator {
result: CandleList;
generator: IterableIterator<CandleData | undefined>;
constructor(input: HeikinAshiInput);
static calculate: typeof heikinashi;
nextValue(price: CandleData): CandleData | undefined;
}
export declare function heikinashi(input: HeikinAshiInput): CandleList;
/**
* Basic configuration interface for CandlestickFinder base class.
* Only contains the scale parameter used by approximateEqual function.
*/
export interface ICandlestickConfig {
/** Scale parameter for approximateEqual function precision (default: 0.001) */
scale?: number;
}
/**
* Configuration interface for MorningStar pattern.
* Only requires scale parameter since this pattern uses direct price comparisons.
*/
export interface IMorningStarConfig extends ICandlestickConfig {
}
export declare function morningstar(data: StockData, config?: IMorningStarConfig): any;
/**
* Configuration interface for BullishEngulfingPattern.
* Only requires scale parameter since this pattern uses direct price comparisons.
*/
export interface IBullishEngulfingConfig extends ICandlestickConfig {
}
export declare function bullishengulfingpattern(data: StockData, config?: IBullishEngulfingConfig): any;
/**
* Configuration interface for BullishHarami pattern.
* Only requires scale parameter since this pattern uses direct price comparisons.
*/
export interface IBullishHaramiConfig extends ICandlestickConfig {
}
export declare function bullishharami(data: StockData, config?: IBullishHaramiConfig): any;
/**
* Configuration interface for BullishHaramiCross pattern.
* Only requires scale parameter since this pattern uses direct price comparisons.
*/
export interface IBullishHaramiCrossConfig extends ICandlestickConfig {
}
export declare function bullishharamicross(data: StockData, config?: IBullishHaramiCrossConfig): any;
/**
* Configuration interface for Doji pattern.
* Includes body tolerance thresholds for determining when open equals close.
*/
export interface IDojiConfig extends ICandlestickConfig {
}
/**
* 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;
/**
* Configuration interface for MorningDojiStar pattern.
* Only requires scale parameter since this pattern uses direct price comparisons.
*/
export interface IMorningDojiStarConfig extends ICandlestickConfig, IDojiConfig {
}
export declare function morningdojistar(data: StockData, config?: IMorningDojiStarConfig): any;
/**
* Configuration interface for BullishMarubozu pattern.
* Only uses the scale parameter for approximateEqual function precision.
*/
export interface IBullishMarubozuConfig extends ICandlestickConfig {
/** Scale parameter for approximateEqual function precision (default: 0.001) */
scale?: number;
}
export declare function bullishmarubozu(data: StockData, config?: IBullishMarubozuConfig): any;
/**
* Configuration interface for PiercingLine pattern.
* Only requires scale parameter since this pattern uses direct price comparisons.
*/
export interface IPiercingLineConfig extends ICandlestickConfig {
}
/**
* Detects PiercingLine candlestick pattern.
*
* A PiercingLine is a bullish reversal pattern that occurs at the end of a downtrend.
* It consists of a bearish candle followed by a bullish candle that opens below the
* previous day's low but closes above the midpoint of the previous day's body.
*
* @param data - Stock data containing OHLC values
* @param config - Configuration options for the pattern detection
* @returns True if PiercingLine pattern is detected, false otherwise
*
* @example
* ```typescript
* const data = { open: [...], high: [...], low: [...], close: [...] };
* const isPattern = piercingline(data, { scale: 0.001 });
* ```
*/
export declare function piercingline(data: StockData, config?: IPiercingLineConfig): any;
/**
* Configuration interface for ThreeWhiteSoldiers pattern.
* Only uses the scale parameter for approximateEqual function precision.
*/
export interface IThreeWhiteSoldiersConfig extends ICandlestickConfig {
/** Scale parameter for approximateEqual function precision (default: 0.001) */
scale?: number;
}
export declare function threewhitesoldiers(data: StockData, config?: IThreeWhiteSoldiersConfig): any;
/**
* Configuration interface for BullishHammerStick pattern.
* Includes thresholds for shadow and body analysis.
*/
export interface IBullishHammerConfig extends ICandlestickConfig {
/** Shadow size threshold as percentage of total range (default: 0.001 = 0.1%) */
shadowSizeThresholdPercent?: number;
/** Minimum body comparison as percentage of total range (default: 0.0001 = 0.01%) */
minBodyComparisonPercent?: number;
}
export declare function bullishhammerstick(data: StockData, options?: IBullishHammerConfig): any;
/**
* Configuration interface for BullishInvertedHammerStick pattern.
* Extends base config with hammer-specific threshold properties.
*/
export interface IBullishInvertedHammerStickConfig extends ICandlestickConfig {
/** Shadow size threshold as percentage of total range (default: 0.001 = 0.1%) */
shadowSizeThresholdPercent?: number;
/** Minimum body comparison as percentage of total range (default: 0.0001 = 0.01%) */
minBodyComparisonPercent?: number;
/** Minimum shadow size as percentage of range (default: 0.001 = 0.1%) */
minShadowSizePercent?: number;
}
export declare function bullishinvertedhammerstick(data: StockData, config?: IBullishInvertedHammerStickConfig): any;
/**
* Configuration interface for BearishHammerStick pattern.
* Extends base config with hammer-specific threshold properties.
*/
export interface IBearishHammerStickConfig extends ICandlestickConfig {
/** Shadow size threshold as percentage of total range (default: 0.3 = 3%) */
shadowSizeThresholdPercent?: number;
/** Minimum body comparison as percentage of total range (default: 0.0001 = 0.01%) */
minBodyComparisonPercent?: number;
}
export declare function bearishhammerstick(data: StockData, config?: IBearishHammerStickConfig): any;
/**
* Configuration interface for BearishInvertedHammerStick pattern.
* Includes thresholds for shadow size analysis.
*/
export interface IBearishInvertedHammerConfig extends ICandlestickConfig {
/** Shadow size threshold as percentage of total range (default: 0.001 = 0.1%) */
shadowSizeThresholdPercent?: number;
}
export declare function bearishinvertedhammerstick(data: StockData, config?: IBearishInvertedHammerConfig): any;
/**
* Configuration interface for HammerPattern.
* Only requires scale parameter since this pattern uses direct price comparisons.
*/
export interface IHammerPatternConfig extends ICandlestickConfig, IBullishHammerConfig, IBullishInvertedHammerStickConfig, IBearishHammerStickConfig, IBearishInvertedHammerConfig {
}
export declare function hammerpattern(data: StockData, config?: IHammerPatternConfig): any;
/**
* Configuration interface for HammerPatternUnconfirmed.
* Extends HammerPattern configuration.
*/
export interface IHammerPatternUnconfirmedConfig extends IHammerPatternConfig, IBullishHammerConfig, IBullishInvertedHammerStickConfig, IBearishHammerStickConfig, IBearishInvertedHammerConfig {
}
export declare function hammerpatternunconfirmed(data: StockData, config?: IHammerPatternUnconfirmedConfig): any;
/**
* Configuration interface for TweezerBottom pattern.
* Only requires scale parameter since this pattern uses direct price comparisons.
*/
export interface ITweezerBottomConfig extends ICandlestickConfig {
}
/**
* Detects TweezerBottom candlestick pattern.
*
* A TweezerBottom is a bullish reversal pattern that occurs at the end of a downtrend.
* It consists of two or more candles with approximately equal lows, suggesting
* support at that price level.
*
* @param data - Stock data containing OHLC values
* @param config - Configuration options for the pattern detection
* @returns True if TweezerBottom pattern is detected, false otherwise
*
* @example
* ```typescript
* const data = { open: [...], high: [...], low: [...], close: [...] };
* const isPattern = tweezerbottom(data, { scale: 0.001 });
* ```
*/
export declare function tweezerbottom(data: StockData, config?: ITweezerBottomConfig): any;
/**
* Configuration interface for Bullish patterns composite.
* Only requires scale parameter since this is a composite pattern.
*/
export interface IBullishConfig extends ICandlestickConfig, IBullishEngulfingConfig, IBullishHaramiConfig, IBullishHaramiCrossConfig, IMorningStarConfig, IMorningDojiStarConfig, IBullishMarubozuConfig, IPiercingLineConfig, IThreeWhiteSoldiersConfig, IBullishHammerConfig, IBullishInvertedHammerStickConfig, IHammerPatternConfig, IHammerPatternUnconfirmedConfig, ITweezerBottomConfig {
}
/**
* Detects any bullish candlestick pattern in the provided stock data.
*
* This function checks for multiple bullish candlestick patterns including:
* - Bullish Engulfing Pattern
* - Bullish Harami and Bullish Harami Cross
* - Morning Star and Morning Doji Star
* - Bullish Marubozu
* - Three White Soldiers
* - Bullish Hammer Stick and Bullish Inverted Hammer Stick
* - Hammer Pattern and Hammer Pattern Unconfirmed
* - Downside Tasuki Gap, Piercing Line, and Tweezer Bottom
*
* @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)
* @returns True if any bullish pattern is detected, false otherwise
*
* @example
* ```typescript
* // Using default configuration
* const hasBullishPattern = bullish(stockData);
*
* // Using custom configuration
* const hasBullishPattern = bullish(stockData, {
* scale: 0.002
* });
*
* // Backward compatibility with scale parameter
* const hasBullishPattern = bullish(stockData, { scale: 0.002 });
* ```
*/
export declare function bullish(data: StockData, config?: IBullishConfig): any;
/**
* Configuration interface for BearishEngulfingPattern.
* Only requires scale parameter since this pattern uses direct price comparisons.
*/
export interface IBearishEngulfingConfig extends ICandlestickConfig {
}
/**
* Detects Bearish Engulfing candlestick pattern in the provided stock data.
*
* A Bearish Engulfing pattern consists of two candlesticks where a large bearish candle
* completely engulfs the previous smaller bullish candle. This pattern indicates a potential
* reversal from bullish to bearish sentiment.
*
* @param data - Stock data containing OHLC values for at least 2 periods
* @param config - Configuration object for pattern detection
* @param config.scale - Scale parameter for approximateEqual function precision (default: 0.001)
* @returns True if Bearish Engulfing pattern is detected, false otherwise
*
* @example
* ```typescript
* // Using default configuration
* const hasBearishEngulfingPattern = bearishengulfingpattern(stockData);
*
* // Using custom configuration
* const hasBearishEngulfingPattern = bearishengulfingpattern(stockData, {
* scale: 0.002
* });
*
* // Backward compatibility with scale parameter
* const hasBearishEngulfingPattern = bearishengulfingpattern(stockData, { scale: 0.002 });
* ```
*/
export declare function bearishengulfingpattern(data: StockData, config?: IBearishEngulfingConfig): any;
/**
* Configuration interface for BearishHarami pattern.
* Only requires scale parameter since this pattern uses direct price comparisons.
*/
export interface IBearishHaramiConfig extends ICandlestickConfig {
}
export declare function bearishharami(data: StockData, config?: IBearishHaramiConfig): any;
/**
* Configuration interface for BearishHaramiCross pattern.
* Only requires scale parameter since this pattern uses direct price comparisons.
*/
export interface IBearishHaramiCrossConfig extends ICandlestickConfig {
}
export declare function bearishharamicross(data: StockData, config?: IBearishHaramiCrossConfig): any;
/**
* Configuration interface for EveningDojiStar pattern.
* Only requires scale parameter since this pattern uses direct price comparisons.
*/
export interface IEveningDojiStarConfig extends ICandlestickConfig, IDojiConfig {
}
export declare function eveningdojistar(data: StockData, config?: IEveningDojiStarConfig): any;
/**
* Configuration interface for EveningStar pattern.
* Only requires scale parameter since this pattern uses direct price comparisons.
*/
export interface IEveningStarConfig extends ICandlestickConfig {
}
export declare function eveningstar(data: StockData, config?: IEveningStarConfig): any;
/**
* 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;
}
/**
* 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;
/**
* Configuration interface for ThreeBlackCrows pattern.
* Only uses the scale parameter for approximateEqual function precision.
*/
export interface IThreeBlackCrowsConfig extends ICandlestickConfig {
/** Scale parameter for approximateEqual function precision (default: 0.001) */
scale?: number;
}
export declare function threeblackcrows(data: StockData, config?: IThreeBlackCrowsConfig): any;
/**
* Configuration interface for HangingMan pattern.
* Includes thresholds for movement and confirmation analysis.
*/
export interface IHangingManConfig extends ICandlestickConfig {
/** Minimum threshold for absolute measurements (default: 0.01) */
minimumThreshold?: number;
/** Absolute minimum for very small values (default: 0.001) */
absoluteMinimum?: number;
/** Movement threshold multiplier for confirmation (default: 1.0) */
movementThresholdBase?: number;
/** Movement threshold scale factor (default: 0.3) */
movementThresholdScale?: number;
}
export declare function hangingman(data: StockData, config?: IHangingManConfig): any;
/**
* Configuration interface for HangingManUnconfirmed pattern.
* Extends HangingMan configuration.
*/
export interface IHangingManUnconfirmedConfig extends IHangingManConfig, IBullishHammerConfig, IBearishHammerStickConfig {
}
/**
* Detects HangingManUnconfirmed candlestick pattern in the provided stock data.
*
* A HangingManUnconfirmed is a bearish reversal pattern that appears at the end of an uptrend.
* Unlike the confirmed version, this pattern doesn't require confirmation from the next candle.
* It consists of:
* 1. An uptrend in the first 3 candles
* 2. A hammer-like candle (small body with long lower shadow) at the 4th position
*
* This pattern suggests potential bearish reversal but is less reliable than the confirmed version.
*
* @param data - Stock data containing OHLC values for at least 4 periods
* @param config - Configuration object for pattern detection
* @param config.scale - Scale parameter for approximateEqual function precision (default: 0.001)
* @param config.minimumThreshold - Minimum threshold for absolute measurements (default: 0.01)
* @param config.absoluteMinimum - Absolute minimum for very small values (default: 0.001)
* @param config.movementThresholdBase - Movement threshold multiplier for confirmation (default: 1.0)
* @param config.movementThresholdScale - Movement threshold scale factor (default: 0.3)
* @returns True if HangingManUnconfirmed pattern is detected, false otherwise
*
* @example
* ```typescript
* // Using default configuration
* const hasHangingManUnconfirmedPattern = hangingmanunconfirmed(stockData);
*
* // Using custom configuration
* const hasHangingManUnconfirmedPattern = hangingmanunconfirmed(stockData, {
* scale: 0.002,
* minimumThreshold: 0.02,
* movementThresholdBase: 1.5
* });
*
* // Backward compatibility with scale parameter
* const hasHangingManUnconfirmedPattern = hangingmanunconfirmed(stockData, { scale: 0.002 });
* ```
*/
export declare function hangingmanunconfirmed(data: StockData, config?: IHangingManUnconfirmedConfig): any;
/**
* Configuration interface for ShootingStar pattern.
* Only requires scale parameter since this pattern uses direct price comparisons.
*/
export interface IShootingStarConfig extends ICandlestickConfig {
}
export declare function shootingstar(data: StockData, config?: IShootingStarConfig): any;
/**
* Configuration interface for ShootingStarUnconfirmed pattern.
* Extends ShootingStar configuration.
*/
export interface IShootingStarUnconfirmedConfig extends IShootingStarConfig {
}
/**
* Detects ShootingStarUnconfirmed candlestick pattern in the provided stock data.
*
* A ShootingStarUnconfirmed is a bearish reversal pattern that appears at the end of an uptrend.
* Unlike the confirmed version, this pattern doesn't require confirmation from the next candle.
* It consists of:
* 1. An uptrend in the first 3 candles
* 2. An inverted hammer-like candle (small body with long upper shadow) at the 4th position
*
* This pattern suggests potential bearish reversal but is less reliable than the confirmed version.
*
* @param data - Stock data containing OHLC values for at least 4 periods
* @param config - Configuration object for pattern detection
* @param config.scale - Scale parameter for approximateEqual function precision (default: 0.001)
* @returns True if ShootingStarUnconfirmed pattern is detected, false otherwise
*
* @example
* ```typescript
* // Using default configuration
* const hasShootingStarUnconfirmedPattern = shootingstarunconfirmed(stockData);
*
* // Using custom configuration
* const hasShootingStarUnconfirmedPattern = shootingstarunconfirmed(stockData, {
* scale: 0.002
* });
*
* // Backward compatibility with scale parameter
* const hasShootingStarUnconfirmedPattern = shootingstarunconfirmed(stockData, { scale: 0.002 });
* ```
*/
export declare function shootingstarunconfirmed(data: StockData, config?: IShootingStarUnconfirmedConfig): any;
/**
* Configuration interface for TweezerTop pattern.
* Only requires scale parameter since this pattern uses direct price comparisons.
*/
export interface ITweezerTopConfig extends ICandlestickConfig {
}
/**
* Detects TweezerTop candlestick pattern.
*
* A TweezerTop is a bearish reversal pattern that occurs at the end of an uptrend.
* It consists of two or more candles with approximately equal highs, suggesting
* resistance at that price level.
*
* @param data - Stock data containing OHLC values
* @param config - Configuration options for the pattern detection
* @returns True if TweezerTop pattern is detected, false otherwise
*
* @example
* ```typescript
* const data = { open: [...], high: [...], low: [...], close: [...] };
* const isPattern = tweezertop(data, { scale: 0.001 });
* ```
*/
export declare function tweezertop(data: StockData, config?: ITweezerTopConfig): any;
/**
* Configuration interface for Bearish patterns composite.
* Only requires scale parameter since this is a composite pattern.
*/
export interface IBearishConfig extends ICandlestickConfig, IBearishEngulfingConfig, IBearishHaramiConfig, IBearishHaramiCrossConfig, IEveningStarConfig, IEveningDojiStarConfig, IBearishMarubozuConfig, IThreeBlackCrowsConfig, IBearishHammerStickConfig, IBearishInvertedHammerConfig, IHangingManConfig, IHangingManUnconfirmedConfig, IShootingStarConfig, IShootingStarUnconfirmedConfig, ITweezerTopConfig {
}
/**
* Detects any bearish candlestick pattern in the provided stock data.
*
* This function checks for multiple bearish candlestick patterns including:
* - Bearish Engulfing Pattern
* - Bearish Harami and Bearish Harami Cross
* - Evening Star and Evening Doji Star
* - Bearish Marubozu
* - Three Black Crows
* - Bearish Hammer Stick and Bearish Inverted Hammer Stick
* - Hanging Man and Shooting Star patterns
* - Tweezer Top
*
* @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)
* @returns True if any bearish pattern is detected, false otherwise
*
* @example
* ```typescript
* // Using default configuration
* const hasBearishPattern = bearish(stockData);
*
* // Using custom configuration
* const hasBearishPattern = bearish(stockData, {
* scale: 0.002
* });
*
* // Backward compatibility with scale parameter
* const hasBearishPattern = bearish(stockData, { scale: 0.002 });
* ```
*/
export declare function bearish(data: StockData, config?: IBearishConfig): any;
/**
* Configuration interface for AbandonedBaby pattern.
* Only requires scale parameter since this pattern uses direct price comparisons.
*/
export interface IAbandonedBabyConfig extends ICandlestickConfig, IDojiConfig {
}
/**
* Detects Abandoned Baby candlestick pattern in the provided stock data.
*
* An Abandoned Baby is a rare three-candle reversal pattern consisting of:
* 1. A bearish candle
* 2. A doji that gaps down from the first candle
* 3. A bullish candle that gaps up from the doji
* This pattern indicates a strong reversal from bearish to bullish sentiment.
*
* @param data - Stock data containing OHLC values for at least 3 periods
* @param config - Configuration object for pattern detection
* @param config.scale - Scale parameter for approximateEqual function precision (default: 0.001)
* @returns True if Abandoned Baby pattern is detected, false otherwise
*
* @example
* ```typescript
* // Using default configuration
* const hasAbandonedBabyPattern = abandonedbaby(stockData);
*
* // Using custom configuration
* const hasAbandonedBabyPattern = abandonedbaby(stockData, {
* scale: 0.002
* });
*
* // Backward compatibility with scale parameter
* const hasAbandonedBabyPattern = abandonedbaby(stockData, { scale: 0.002 });
* ```
*/
export declare function abandonedbaby(data: StockData, config?: IAbandonedBabyConfig): any;
/**
* Configuration interface for DarkCloudCover pattern.
* Only requires scale parameter since this pattern uses direct price comparisons.
*/
export interface IDarkCloudCoverConfig extends ICandlestickConfig {
}
export declare function darkcloudcover(data: StockData, config?: IDarkCloudCoverConfig): any;
/**
* Configuration interface for DownsideTasukiGap pattern.
* Only requires scale parameter since this pattern uses direct price comparisons.
*/
export interface IDownsideTasukiGapConfig extends ICandlestickConfig {
}
/**
* Detects DownsideTasukiGap candlestick pattern in the provided stock data.
*
* A DownsideTasukiGap is a three-candle continuation pattern that occurs during a downtrend.
* It consists of:
* 1. A bearish candle
* 2. A second bearish candle that gaps down from the first
* 3. A bullish candle that opens within the second candle's body and closes within the gap
*
* This pattern suggests that the downtrend will continue despite the temporary bullish reversal.
*
* @param data - Stock data containing OHLC values for at least 3 periods
* @param config - Configuration object for pattern detection
* @param config.scale - Scale parameter for approximateEqual function precision (default: 0.001)
* @returns True if DownsideTasukiGap pattern is detected, false otherwise
*
* @example
* ```typescript
* // Using default configuration
* const hasDownsideTasukiGapPattern = downsidetasukigap(stockData);
*
* // Using custom configuration
* const hasDownsideTasukiGapPattern = downsidetasukigap(stockData, {
* scale: 0.002
* });
*
* // Backward compatibility with scale parameter
* const hasDownsideTasukiGapPattern = downsidetasukigap(stockData, { scale: 0.002 });
* ```
*/
export declare function downsidetasukigap(data: StockData, config?: IDownsideTasukiGapConfig): any;
/**
* Configuration interface for DragonFlyDoji pattern.
* Only requires scale parameter since this pattern uses approximateEqual for body tolerance.
*/
export interface IDragonFlyDojiConfig extends ICandlestickConfig {
}
export declare function dragonflydoji(data: StockData, config?: IDragonFlyDojiConfig): any;
/**
* Configuration interface for GraveStoneDoji pattern.
* Includes thresholds for upper shadow analysis.
*/
export interface IGraveStoneDojiConfig extends ICandlestickConfig {
/** Minimum absolute upper shadow threshold (default: 0.1) */
minAbsoluteUpperShadowThreshold?: number;
}
export declare function gravestonedoji(data: StockData, config?: IGraveStoneDojiConfig): any;
/**
* Configuration interface for BullishSpinningTop pattern.
*/
export interface IBullishSpinningTopConfig extends ICandlestickConfig {
/** Scale parameter for approximateEqual function precision (default: 0.001) */
scale?: number;
/** Maximum body length for small body detection (default: 0.1) */
maxBodyLength?: number;
}
export declare function bullishspinningtop(data: StockData, config?: IBullishSpinningTopConfig): any;
/**
* Configuration interface for BearishSpinningTop pattern.
*/
export interface IBearishSpinningTopConfig extends ICandlestickConfig {
/** Scale parameter for approximateEqual function precision (default: 0.001) */
scale?: number;
/** Maximum body length for small body detection (default: 0.1) */
maxBodyLength?: number;
}
export declare function bearishspinningtop(data: StockData, config?: IBearishSpinningTopConfig): any;
/**
* Calcaultes the fibonacci retracements for given start and end points
*
* If calculating for up trend start should be low and end should be high and vice versa
*
* returns an array of retracements level containing [0 , 23.6, 38.2, 50, 61.8, 78.6, 100, 127.2, 161.8, 261.8, 423.6]
*
* @export
* @param {number} start
* @param {number} end
* @returns {number[]}
*/
export declare function fibonacciretracement(start: number, end: number): number[];
declare class IchimokuCloudInput extends IndicatorInput {
high: number[];
low: number[];
conversionPeriod: number;
basePeriod: number;
spanPeriod: number;
displacement: number;
}
declare class IchimokuCloudOutput {
conversion: number;
base: number;
spanA: number;
spanB: number;
}
export declare class IchimokuCloud extends Indicator {
result: IchimokuCloudOutput[];
generator: IterableIterator<IchimokuCloudOutput | undefined>;
constructor(input: IchimokuCloudInput);
static calculate: typeof ichimokucloud;
nextValue(price: CandleData): IchimokuCloudOutput;
}
export declare function ichimokucloud(input: IchimokuCloudInput): IchimokuCloudOutput[];
export declare class KeltnerChannelsInput extends IndicatorInput {
maPeriod: number;
atrPeriod: number;
useSMA: boolean;
multiplier: number;
high: number[];
low: number[];
close: number[];
}
export declare class KeltnerChannelsOutput extends IndicatorInput {
middle: number;
upper: number;
lower: number;
}
export declare class KeltnerChannels extends Indicator {
result: KeltnerChannelsOutput[];
generator: IterableIterator<KeltnerChannelsOutput | undefined>;
constructor(input: KeltnerChannelsInput);
static calculate: typeof keltnerchannels;
nextValue(price: KeltnerChannelsInput): KeltnerChannelsOutput | undefined;
}
export declare function keltnerchannels(input: KeltnerChannelsInput): KeltnerChannelsOutput[];
export declare class ChandelierExitInput extends IndicatorInput {
period: number;
multiplier: number;
high: number[];
low: number[];
close: number[];
}
export declare class ChandelierExitOutput extends IndicatorInput {
exitLong: number;
exitShort: number;
}
export declare class ChandelierExit extends Indicator {
generator: IterableIterator<ChandelierExitOutput | undefined>;
constructor(input: ChandelierExitInput);
static calculate: typeof chandelierexit;
nextValue(price: ChandelierExitInput): ChandelierExitOutput | undefined;
}
export declare function chandelierexit(input: ChandelierExitInput): number[];
declare class CrossInput extends IndicatorInput {
lineA: number[];
lineB: number[];
constructor(lineA: number[], lineB: number[]);
}
export declare class CrossUp extends Indicator {
lineA: number[];
lineB: number[];
result: boolean[];
generator: IterableIterator<true | false>;
constructor(input: CrossInput);
static calculate: typeof crossUp;
static reverseInputs(input: CrossInput): void;
nextValue(valueA: number, valueB: number): true | false;
}
export declare function crossUp(input: CrossInput): boolean[];
declare class CrossInput$1 extends IndicatorInput {
lineA: number[];
lineB: number[];
constructor(lineA: number[], lineB: number[]);
}
export declare class CrossDown extends Indicator {
lineA: number[];
lineB: number[];
result: boolean[];
generator: IterableIterator<true | false>;
constructor(input: CrossInput$1);
static calculate: typeof crossDown;
static reverseInputs(input: CrossInput$1): void;
nextValue(valueA: number, valueB: number): true | false;
}
export declare function crossDown(input: CrossInput$1): boolean[];
export declare function setConfig(key: any, value: any): void;
export declare function getConfig(key: any): any;
export {};