Principle:TA Lib Ta lib python Pattern Signal Interpretation
| Knowledge Sources | |
|---|---|
| Domains | Technical_Analysis, Pattern_Recognition |
| Last Updated | 2026-02-09 22:00 GMT |
Overview
A signal encoding scheme where candlestick pattern detection results are represented as integer values (-100, 0, +100) indicating bearish, neutral, or bullish signals.
Description
All 61 CDL pattern functions in TA-Lib use a consistent three-valued integer encoding for their output:
- +100: Strong bullish pattern detected
- 0: No pattern detected at this position
- -100: Strong bearish pattern detected
This encoding allows simple numerical operations:
- Filtering: Find pattern occurrences with np.where(signal != 0)
- Direction: Determine bullish/bearish by sign
- Aggregation: Sum multiple pattern signals for composite indicators
Usage
Apply this principle when interpreting any CDL function output. Filter for non-zero values to find pattern occurrences, and use the sign to determine direction.
Theoretical Basis
The signal encoding maps pattern detection to a discrete signal:
# Signal interpretation logic
for i in range(len(signal)):
if signal[i] > 0:
action = "BULLISH" # Consider buying
elif signal[i] < 0:
action = "BEARISH" # Consider selling
else:
action = "NEUTRAL" # No pattern, no action