This directory contains runnable examples for each pattern module and utility in the Candlestick library.
-
Install dependencies in the project root:
npm install
-
Run any CommonJS example:
node examples/hammer.js node examples/patternChain.js node examples/newPatterns.js
-
Run ESM example:
node examples/esm-example.mjs
hammer.js— Hammer pattern detection (single and series)invertedHammer.js— Inverted Hammer pattern detectiondoji.js— Doji pattern detection
engulfing.js— Engulfing pattern detection (bullish/bearish)harami.js— Harami pattern detection (bullish/bearish)kicker.js— Kicker pattern detection (bullish/bearish)reversal.js— Reversal patterns: Hanging Man, Shooting Star
patternChain.js— Multi-pattern detection with patternChain APInewPatterns.js— New 3-candle patterns (Morning/Evening Star, Three Soldiers/Crows, Piercing Line, Dark Cloud Cover)newPatternsV2.js— v1.2.0 patterns (Marubozu, Spinning Top, Tweezers)streaming.js— Streaming API for large datasets with memory optimizationmetadata.js— Pattern metadata, filtering, and sortingesm-example.mjs— ESM module syntax example (import/export)
utils.js— Utility functions: bodyLen, wickLen, tailLen, isBullish, isBearish, hasGapUp, hasGapDown, findPattern
- These examples are for demonstration and learning purposes.
- The
examples/directory is excluded from npm packages but included in the repository for reference. - You can copy, modify, or extend these examples for your own use cases.
For more information, see the main README.md.