MCPInstall

ta-lib

C-optimized technical analysis with 150+ functions and 61 candlestick pattern recognition functions via TA-Lib

Installs
497
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/agiprolabs/claude-trading-skills --skill ta-lib
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads ta-lib automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

ta-lib — C-Optimized Technical Analysis

TA-Lib (Technical Analysis Library) is a C library with a Python wrapper providing 150+ technical analysis functions and 61 candlestick pattern recognition functions. It is the industry standard for performance-critical indicator computation, used in production trading systems where pandas-ta or pure-Python alternatives are too slow.

What TA-Lib Is

TA-Lib was originally written in C for financial market data analysis. The Python wrapper (TA-Lib on PyPI, imported as talib) provides:

  • 150+ indicator functions across overlap, momentum, volume, volatility, cycle, and math categories
  • 61 candlestick pattern recognition functions — the most comprehensive pattern library available
  • C-speed computation — 10-100x faster than pure-Python equivalents on large datasets
  • Two APIs: a function API (pass arrays directly) and an abstract API (pass dict of arrays)
  • NumPy native — all inputs and outputs are NumPy arrays

Installation

TA-Lib requires the underlying C library to be installed first:

# macOS
brew install ta-lib
uv pip install TA-Lib numpy pandas

# Ubuntu/Debian
sudo apt-get install -y ta-lib
uv pip install TA-Lib numpy pandas

# From source (any platform)
wget https://github.com/ta-lib/ta-lib/releases/download/v0.6.4/ta-lib-0.6.4-src.tar.gz
tar -xzf ta-lib-0.6.4-src.tar.gz
cd ta-lib-0.6.4
./configure --prefix=/usr/local
make && sudo make install
uv pip install TA-Lib numpy pandas

If the C library is not installed, import talib will fail with an ImportError. The scripts in this skill include fallback logic for environments without TA-Lib installed.

When to Use TA-Lib vs pandas-ta

CriterionTA-Libpandas-ta
SpeedC-optimized, 10-100x fasterPure Python, slower on large data
Candlestick patterns61 built-in patternsLimited pattern support
InstallationRequires C librarypip install only
API styleNumPy arraysDataFrame .ta accessor
Indicator count150+130+
StreamingSingle-value update possibleRecompute entire series
DependenciesC lib + numpypandas only

Use TA-Lib when:

  • Processing millions of bars or running backtests at scale
  • You need candlestick pattern recognition (TA-Lib is unmatched here)
  • You are building a production pipeline where latency matters
  • You need cycle indicators (Hilbert Transform family)

Use pandas-ta when:

  • You want DataFrame-native convenience
  • Installation simplicity matters (no C dependency)
  • You need indicators not in TA-Lib (pandas-ta has some extras)

Quick Start

import numpy as np
import talib

# Create sample data
close = np.random.randn(100).cumsum() + 50
high = close + np.abs(np.random.randn(100))
low = close - np.abs(np.random.randn(100))
open_ = close + np.random.randn(100) * 0.5
volume = np.random.randint(1000, 10000, 100).astype(float)

# Function API — pass arrays directly
rsi = talib.RSI(close, timeperiod=14)
macd, signal, hist = talib.MACD(close, fastperiod=12, slowperiod=26, signalperiod=9)
upper, middle, lower = talib.BBANDS(close, timeperiod=20, nbdevup=2, nbdevdn=2)
atr = talib.ATR(high, low, close, timeperiod=14)

# Candlestick patterns — return +100 (bullish), -100 (bearish), or 0
doji = talib.CDLDOJI(open_, high, low, close)
hammer = talib.CDLHAMMER(open_, high, low, close)
engulfing = talib.CDLENGULFING(open_, high, low, close)

Function API vs Abstract API

Function API (Recommended)

Call functions directly with NumPy arrays:

import talib

rsi = talib.RSI(close, timeperiod=14)
sma = talib.SMA(close, timeperiod=20)
upper, mid, lower = talib.BBANDS(close)

Abstract API

Pass a dictionary of arrays and get results by name:

from talib import abstract

inputs = {"open": open_, "high": high, "low": low, "close": close, "volume": volume}

# Call by function name
rsi = abstract.RSI(inputs, timeperiod=14)
macd = abstract.MACD(inputs)  # returns (macd, signal, hist)

The abstract API is useful for dynamic indicator selection (e.g., looping over a list of indicator names).

Function Groups

TA-Lib organizes functions into these groups:

Overlap Studies

Moving averages and envelope indicators that overlay price charts.

sma = talib.SMA(close, timeperiod=20)
ema = talib.EMA(close, timeperiod=12)
upper, mid, lower = talib.BBANDS(close, timeperiod=20, nbdevup=2, nbdevdn=2)
sar = talib.SAR(high, low, acceleration=0.02, maximum=0.2)
mama, fama = talib.MAMA(close, fastlimit=0.5, slowlimit=0.05)

Momentum Indicators

Oscillators and trend-strength measures.

rsi = talib.RSI(close, timeperiod=14)
macd, signal, hist = talib.MACD(close, fastperiod=12, slowperiod=26, signalperiod=9)
slowk, slowd = talib.STOCH(high, low, close)
cci = talib.CCI(high, low, close, timeperiod=14)
willr = talib.WILLR(high, low, close, timeperiod=14)
adx = talib.ADX(high, low, close, timeperiod=14)
mfi = talib.MFI(high, low, close, volume, timeperiod=14)

Volume Indicators

Volume-based analysis functions.

obv = talib.OBV(close, volume)
ad = talib.AD(high, low, close, volume)
adosc = talib.ADOSC(high, low, close, volume, fastperiod=3, slowperiod=10)

Volatility Indicators

Measures of price variability.

atr = talib.ATR(high, low, close, timeperiod=14)
natr = talib.NATR(high, low, close, timeperiod=14)
trange = talib.TRANGE(high, low, close)

Pattern Recognition (Candlestick)

61 functions that detect candlestick patterns. All return integer arrays:

  • +100 = bullish pattern detected
  • -100 = bearish pattern detected
  • 0 = no pattern
# Single patterns
doji = talib.CDLDOJI(open_, high, low, close)
hammer = talib.CDLHAMMER(open_, high, low, close)
engulfing = talib.CDLENGULFING(open_, high, low, close)

# Scan all 61 patterns at once
candle_names = talib.get_function_groups()["Pattern Recognition"]
for name in candle_names:
    func = getattr(talib, name)
    result = func(open_, high, low, close)
    hits = np.nonzero(result)[0]
    if len(hits) > 0:
        print(f"{name}: {len(hits)} detections")

See references/candlestick_patterns.md for the full list of 61 patterns with reliability ratings and crypto relevance.

Math Transform & Math Operators

Mathematical functions (sin, cos, ln, etc.) and operators (add, sub, mult, div) on arrays. Rarely used directly but available.

Crypto Considerations

24/7 Markets

  • Candlestick patterns designed for traditional markets with opening/closing gaps may behave differently on crypto's continuous markets
  • Gap-based patterns (morning star, evening star) are less reliable without session gaps
  • Body-ratio patterns (doji, hammer, engulfing) still work well on any timeframe

Timeframe Selection

  • 1m-5m: Patterns are noisy; combine with volume confirmation
  • 15m-1h: Good for intraday signals on high-cap tokens
  • 4h-1d: Most reliable for pattern recognition
  • Tip: Higher timeframes produce fewer but more reliable pattern signals

NaN Handling

TA-Lib returns NaN for the initial lookback period of each indicator. Always account for this:

rsi = talib.RSI(close, timeperiod=14)
# First 14 values will be NaN
valid_rsi = rsi[~np.isnan(rsi)]

Solana Token Data

When using TA-Lib with Solana token OHLCV data:

  • Ensure arrays are float64 dtype — TA-Lib requires this
  • Sort by timestamp ascending before passing to TA-Lib
  • Handle gaps in low-liquidity token data before computing indicators
# Convert to float64 for TA-Lib compatibility
close = df["close"].values.astype(np.float64)
high = df["high"].values.astype(np.float64)
low = df["low"].values.astype(np.float64)

Integration with Other Skills

With pandas-ta

pandas-ta can use TA-Lib as a backend when installed, getting C-speed through the pandas-ta API:

import pandas_ta as ta
# pandas-ta auto-detects TA-Lib and uses it for supported indicators
# Set explicitly:
ta.Imports["talib"] = True  # Force TA-Lib backend
df.ta.rsi(length=14)  # Uses TA-Lib under the hood if available

With vectorbt

vectorbt integrates with TA-Lib for fast backtesting:

import vectorbt as vbt

# Use TA-Lib indicators in vectorbt
rsi = vbt.talib("RSI").run(close, timeperiod=14)
entries = rsi.real_crossed_below(30)
exits = rsi.real_crossed_above(70)

With Birdeye/DexScreener Data

Fetch OHLCV data from API skills, then process with TA-Lib:

# After fetching OHLCV from birdeye-api or dexscreener-api
close = np.array(ohlcv_data["close"], dtype=np.float64)
rsi = talib.RSI(close, timeperiod=14)

Listing Available Functions

import talib

# All function groups
groups = talib.get_function_groups()
for group, funcs in groups.items():
    print(f"{group}: {len(funcs)} functions")

# All function names
all_funcs = talib.get_functions()
print(f"Total: {len(all_funcs)} functions")

# Info about a specific function
info = talib.abstract.Function("RSI").info
print(info["display_name"], info["group"])

Files

FileDescription
references/function_reference.mdMost useful functions by category with syntax and parameters
references/candlestick_patterns.mdAll 61 candlestick patterns grouped by type with reliability ratings
scripts/compute_indicators.pyComputes common indicators with TA-Lib/fallback comparison
scripts/pattern_scanner.pyScans OHLCV data for all 61 candlestick patterns

FAQ

What does the ta-lib skill do?

C-optimized technical analysis with 150+ functions and 61 candlestick pattern recognition functions via TA-Lib

How do I install ta-lib?

Run npx skills add https://github.com/agiprolabs/claude-trading-skills --skill ta-lib in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/ta-lib/ (personal) or .claude/skills/ta-lib/ (project).

Which AI agents can use ta-lib?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is ta-lib safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains ta-lib?

It is published by agiprolabs in agiprolabs/claude-trading-skills. It has 497 recorded installs.

More from agiprolabs/claude-trading-skills

View all →

walk-forward-validation

agiprolabs/claude-trading-skills

Walk-forward validation framework for trading strategies and ML models with time-series-aware splits, overfit detection, and regime-aware validation

Business & Finance714 installs

risk-management

agiprolabs/claude-trading-skills

Portfolio-level risk controls, drawdown management, exposure limits, and circuit breakers for crypto trading

Business & Finance637 installs

pandas-ta

agiprolabs/claude-trading-skills

Technical analysis with 130+ indicators using pandas-ta for crypto market data

Data & Databases593 installs

position-sizing

agiprolabs/claude-trading-skills

Trade sizing methods including fixed fractional, volatility-adjusted, Kelly criterion, and liquidity-constrained sizing

Business & Finance581 installs

regime-detection

agiprolabs/claude-trading-skills

Market regime identification using volatility clustering, trend detection, and statistical methods for adaptive trading

Business & Finance578 installs

kelly-criterion

agiprolabs/claude-trading-skills

Kelly criterion optimal sizing with fractional variants, edge estimation, and practical application for crypto trading

Business & Finance534 installs

Popular business & finance skills

View category →

sales-enablement

coreyhaines31/marketingskills

When the user wants to create sales collateral, pitch decks, one-pagers, objection handling docs, or demo scripts. Also use when the user mentions 'sales deck,' 'pitch deck,' 'one-pager,' 'leave-behind,' 'objection handling,' 'deal-specific ROI analysis,' 'demo script,' 'talk track,' 'sales playbook,' 'proposal template,' 'buyer persona card,' 'battle card,' 'battlecard,' 'competitive one-pager,' 'win-loss analysis,' 'why are we losing deals,' 'loss reasons,' 'how do I respond to this objection,' 'prospect just said,' 'help my sales team,' 'sales materials,' or 'what should I give my sales reps,' 'cold call script,' or 'voicemail script.' Use this for any document or asset that helps a sales team close deals. For public competitor comparison pages, see competitors. For running buyer interviews or churn research, see customer-research. For marketing website copy, see copywriting. For cold outreach emails, see cold-email. For the offer being sold (bonuses, guarantees, pricing structure),

Business & Finance119.5K installs

revops

coreyhaines31/marketingskills

When the user wants help with revenue operations, lead lifecycle management, or marketing-to-sales handoff processes. Also use when the user mentions 'RevOps,' 'revenue operations,' 'lead scoring,' 'outbound pipeline stages,' 'lead routing,' 'MQL,' 'SQL,' 'pipeline stages,' 'deal desk,' 'CRM automation,' 'marketing-to-sales handoff,' 'data hygiene,' 'leads aren't getting to sales,' 'pipeline management,' 'lead qualification,' or 'when should marketing hand off to sales.' Use this for anything involving the systems and processes that connect marketing to revenue. For cold outreach emails, see cold-email. For email drip campaigns, see emails. For pricing decisions, see pricing.

Business & Finance114.1K installs

sales-funnel-blueprint

autonnel/autonnel-skills

Turn an offer into a concrete multi-step sales funnel spec - page-by-page structure, price ladder, copy outline and the metrics each step must hit. Use when asked to build a sales funnel, marketing funnel, landing page flow, lead magnet funnel, webinar funnel, tripwire or VSL funnel, when planning a product launch page flow, or when someone asks "what pages do I need" for selling something online.

Business & Finance104.5K installs

pricing

coreyhaines31/marketingskills

When the user wants help with pricing decisions, packaging, or monetization strategy. Also use when the user mentions 'pricing,' 'pricing tiers,' 'freemium,' 'free trial,' 'packaging,' 'price increase,' 'value metric,' 'Van Westendorp,' 'willingness to pay,' 'monetization,' 'how much should I charge,' 'my pricing is wrong,' 'pricing page,' 'annual vs monthly,' 'per seat pricing,' 'should I offer a free plan,' 'pricing page teardown,' 'pricing page audit,' 'is my pricing page AI-readable,' or 'can AI read my pricing.' Use this whenever someone is figuring out what to charge, how to structure their plans, or wants to audit a pricing page (for humans and for the AI agents that shortlist tools). For in-app upgrade screens, see paywalls. For offer construction (bonuses, guarantees, value framing, naming) on services/courses/coaching/high-ticket B2B, see offers.

Business & Finance80K installs

cross-border-ecommerce

nexscope-ai/ecommerce-skills

Cross-border e-commerce expansion advisor. Scores target markets on 8 weighted dimensions (market size, ecommerce penetration, competition, regulatory complexity, logistics infrastructure, payment ecosystem, cultural distance, IP protection), compares 5 fulfillment models with cost and transit data, provides country-by-country tax/duty compliance guides (EU VAT/IOSS, UK VAT, US sales tax, CA GST, AU GST, JP consumption tax), maps local payment preferences by market, and builds a phased expansion roadmap. No API key required.

Business & Finance62.9K installs

pricing-strategy

coreyhaines31/marketingskills

When the user wants help with pricing decisions, packaging, or monetization strategy. Also use when the user mentions 'pricing,' 'pricing tiers,' 'freemium,' 'free trial,' 'packaging,' 'price increase,' 'value metric,' 'Van Westendorp,' 'willingness to pay,' 'monetization,' 'how much should I charge,' 'my pricing is wrong,' 'pricing page,' 'annual vs monthly,' 'per seat pricing,' or 'should I offer a free plan.' Use this whenever someone is figuring out what to charge or how to structure their plans. For in-app upgrade screens, see paywall-upgrade-cro.

Business & Finance61.2K installs