# 高级指标 TechKit 包含 66 个超出标准 TA-Lib 集合的高级指标。 ## 风险指标 ### Sharpe Ratio ```{eval-rst} .. list-table:: :widths: 25 75 * - **Function** - ``SHARPE(period, risk_free_rate=0)`` * - **Formula** - Sharpe = (mean_return - risk_free) / std_return × √252 ``` ### Sortino Ratio ```{eval-rst} .. list-table:: :widths: 25 75 * - **Function** - ``SORTINO(period, risk_free_rate=0)`` * - **Formula** - Sortino = (mean_return - risk_free) / downside_std × √252 ``` ### Value at Risk (VaR) ```{eval-rst} .. list-table:: :widths: 25 75 * - **Function** - ``VAR_HISTORICAL(period, confidence=0.95)`` * - **Description** - Historical VaR at specified confidence level ``` ### Conditional VaR (CVaR / Expected Shortfall) ```{eval-rst} .. list-table:: :widths: 25 75 * - **Function** - ``CVAR(period, confidence=0.95)`` * - **Description** - Expected loss beyond VaR threshold ``` ### Maximum Drawdown ```{eval-rst} .. list-table:: :widths: 25 75 * - **Function** - ``MAX_DRAWDOWN(period)`` * - **Formula** - MDD = (peak - trough) / peak ``` --- ## 波动率模型 ### GARCH(1,1) ```{eval-rst} .. list-table:: :widths: 25 75 * - **Function** - ``GARCH(period)`` * - **Formula** - σ²_t = ω + α × ε²_{t-1} + β × σ²_{t-1} ``` ### EWMA Volatility ```{eval-rst} .. list-table:: :widths: 25 75 * - **Function** - ``EWMA_VOL(lambda=0.94)`` * - **Formula** - σ²_t = λ × σ²_{t-1} + (1-λ) × r²_{t-1} ``` ### Parkinson Volatility ```{eval-rst} .. list-table:: :widths: 25 75 * - **Function** - ``PARKINSON_VOL(period)`` * - **Description** - High-low range based volatility estimator ``` ### Garman-Klass Volatility ```{eval-rst} .. list-table:: :widths: 25 75 * - **Function** - ``GARMAN_KLASS_VOL(period)`` * - **Description** - OHLC-based volatility estimator ``` --- ## 谐波模式 ### Gartley Pattern ```{eval-rst} .. list-table:: :widths: 25 75 * - **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 ```{eval-rst} .. list-table:: :widths: 25 75 * - **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 ```{eval-rst} .. list-table:: :widths: 25 75 * - **Function** - ``HARMONIC_CRAB()`` ``` ### Bat Pattern ```{eval-rst} .. list-table:: :widths: 25 75 * - **Function** - ``HARMONIC_BAT()`` ``` --- ## 图表模式识别 ### Head and Shoulders ```{eval-rst} .. list-table:: :widths: 25 75 * - **Function** - ``PATTERN_HEAD_SHOULDERS(tolerance=0.02)`` * - **Description** - Detects head and shoulders top/bottom patterns ``` ### Double Top/Bottom ```{eval-rst} .. list-table:: :widths: 25 75 * - **Function** - ``PATTERN_DOUBLE_TOP(tolerance=0.02)`` * - **Function** - ``PATTERN_DOUBLE_BOTTOM(tolerance=0.02)`` ``` ### Triangle Patterns ```{eval-rst} .. list-table:: :widths: 25 75 * - **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 |