高级指标

TechKit 包含 66 个超出标准 TA-Lib 集合的高级指标。

风险指标

Sharpe Ratio

Function

SHARPE(period, risk_free_rate=0)

Formula

Sharpe = (mean_return - risk_free) / std_return × √252

Sortino Ratio

Function

SORTINO(period, risk_free_rate=0)

Formula

Sortino = (mean_return - risk_free) / downside_std × √252

Value at Risk (VaR)

Function

VAR_HISTORICAL(period, confidence=0.95)

Description

Historical VaR at specified confidence level

Conditional VaR (CVaR / Expected Shortfall)

Function

CVAR(period, confidence=0.95)

Description

Expected loss beyond VaR threshold

Maximum Drawdown

Function

MAX_DRAWDOWN(period)

Formula

MDD = (peak - trough) / peak


波动率模型

GARCH(1,1)

Function

GARCH(period)

Formula

σ²_t = ω + α × ε²_{t-1} + β × σ²_{t-1}

EWMA Volatility

Function

EWMA_VOL(lambda=0.94)

Formula

σ²_t = λ × σ²_{t-1} + (1-λ) × r²_{t-1}

Parkinson Volatility

Function

PARKINSON_VOL(period)

Description

High-low range based volatility estimator

Garman-Klass Volatility

Function

GARMAN_KLASS_VOL(period)

Description

OHLC-based volatility estimator


谐波模式

Gartley Pattern

Function

HARMONIC_GARTLEY()

Ratios

XA → B: 0.618
AB → C: 0.382-0.886
BC → D: 1.27-1.618
XA → D: 0.786

Butterfly Pattern

Function

HARMONIC_BUTTERFLY()

Ratios

XA → B: 0.786
AB → C: 0.382-0.886
BC → D: 1.618-2.618
XA → D: 1.27-1.618

Crab Pattern

Function

HARMONIC_CRAB()

Bat Pattern

Function

HARMONIC_BAT()


图表模式识别

Head and Shoulders

Function

PATTERN_HEAD_SHOULDERS(tolerance=0.02)

Description

Detects head and shoulders top/bottom patterns

Double Top/Bottom

Function

PATTERN_DOUBLE_TOP(tolerance=0.02)

Function

PATTERN_DOUBLE_BOTTOM(tolerance=0.02)

Triangle Patterns

Function

PATTERN_TRIANGLE()

Types

Ascending, Descending, Symmetrical


完整高级指标列表

Category

Indicators

Risk Metrics

SHARPE, SORTINO, VAR_HISTORICAL, CVAR, MAX_DRAWDOWN, CALMAR, OMEGA

Volatility Models

GARCH, EWMA_VOL, PARKINSON_VOL, GARMAN_KLASS_VOL, YANG_ZHANG_VOL

Harmonic Patterns

GARTLEY, BUTTERFLY, CRAB, BAT, SHARK, CYPHER

Chart Patterns

HEAD_SHOULDERS, DOUBLE_TOP, DOUBLE_BOTTOM, TRIANGLE, WEDGE, FLAG, PENNANT

Support/Resistance

PIVOT_POINTS, FIBONACCI_RETRACEMENT, SUPPORT_RESISTANCE

Trend Analysis

SUPERTREND, ICHIMOKU, VWAP, ANCHORED_VWAP