Candlestick Pattern Detector icon

Candlestick Pattern Detector

Detect candlestick patterns using technical analysis

Overview

This node detects various candlestick patterns in financial OHLCV (Open, High, Low, Close, Volume) data using technical analysis. It is useful for traders and analysts who want to automatically identify key candlestick signals that indicate potential market reversals, continuations, or indecision.

Typical use cases include:

  • Automated trading strategies that trigger actions based on recognized candlestick patterns.
  • Market analysis workflows where pattern detection helps confirm trends or reversals.
  • Visualizing detected patterns alongside price data for better decision-making.

For example, a user can input recent OHLCV data manually or from a previous node, select specific candlestick patterns like "Doji" or "Bullish Engulfing," and get results indicating which patterns were detected in the data.

Properties

Name Meaning
Patterns Select one or more candlestick patterns to detect. Options include common patterns such as Abandoned Baby, Bearish Engulfing, Bullish Hammer Stick, Doji, Morning Star, Shooting Star, etc.
Data Source Choose the source of OHLCV data: either manual JSON input or from a field in the input items of the workflow.
OHLCV Data When using manual input, provide OHLCV data as a JSON array of arrays, each inner array containing [open, high, low, close, volume].
Input Data Field When using input data source, specify the field name in the incoming items that contains the OHLCV data.
Options Collection of additional options:
- Return Type Determines the format of the output:
• Pattern Results Only — only detected pattern names and results.
• With OHLCV Data — includes original OHLCV data with results.
• With Metadata — includes calculation metadata.
- Include Pattern Strength Boolean flag to include strength indicators for detected patterns where available.
- Minimum Data Points Minimum number of OHLCV data points required to perform pattern detection (default 5).

Output

The node outputs an array of JSON objects, each representing the result for one input item. The main fields in the output JSON are:

  • detectedPatterns: Array of pattern names detected in the data.
  • patternResults: Object mapping each requested pattern to its detection result. This can be:
    • A boolean indicating presence at the last data point.
    • An array of booleans indicating detection across the dataset.
    • Or an error message if detection failed.
  • patternLocations: Details about where patterns were found, including start/end indices and total occurrences.
  • totalPatternsChecked: Number of patterns checked.
  • patternsDetected: Number of patterns detected.
  • Depending on the selected return type option:
    • ohlcvData: Original OHLCV data (if "With OHLCV Data" selected).
    • metadata: Calculation metadata including input length, timestamp, and patterns checked/detected (if "With Metadata" selected).
  • patternStrength (optional): Object with strength metrics for detected patterns, such as body size ratio and volume ratio.

If the node encounters errors during processing and "Continue On Fail" is enabled, it outputs an error object with the error message.

Dependencies

  • Uses the technicalindicators library for candlestick pattern detection functions.
  • Requires valid OHLCV data input either manually or from previous nodes.
  • No external API keys or services are needed.
  • No special environment variables or n8n credentials are required.

Troubleshooting

  • Failed to parse OHLCV data: Ensure the OHLCV JSON string is correctly formatted as an array of arrays with numeric values.
  • Input data field not found: Verify the specified input data field exists in the incoming items and contains valid OHLCV data.
  • Insufficient data points: The node requires a minimum number of data points (default 5) to perform detection; provide enough historical data.
  • Pattern function not found: If a selected pattern is not supported by the underlying library, an error will be reported for that pattern.
  • Empty or invalid OHLCV array: The data must be a non-empty array of arrays; otherwise, detection cannot proceed.

To resolve these issues, check your input data formatting, field names, and ensure you have sufficient data points.

Links and References

Discussion