Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Principle:TA Lib Ta lib python OHLC Data Preparation

From Leeroopedia


Knowledge Sources
Domains Data_Preparation, Technical_Analysis
Last Updated 2026-02-09 22:00 GMT

Overview

A data preparation pattern for providing four separate OHLC (Open, High, Low, Close) price arrays required by candlestick pattern recognition functions.

Description

Candlestick pattern recognition functions require four separate price arrays: open, high, low, and close. Unlike most technical indicators that operate on a single price series, candlestick patterns analyze the relationship between all four OHLC components to identify specific candle formations.

All four arrays must be:

  • float64 dtype numpy arrays
  • The same length
  • Aligned (element i in each array represents the same time period)

Usage

Apply this principle before calling any candlestick pattern recognition function (all 61 CDL* functions). Each CDL function requires all four OHLC arrays as separate positional arguments.

Theoretical Basis

OHLC data represents a candlestick:

  • Open: Price at the start of the period
  • High: Maximum price during the period
  • Low: Minimum price during the period
  • Close: Price at the end of the period

The candle body is defined by the difference between open and close. The wicks (shadows) extend from the body to the high and low.

# Candlestick component relationships
body = close - open  # positive = bullish, negative = bearish
upper_shadow = high - max(open, close)
lower_shadow = min(open, close) - low

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment