# 美股低波動擇時（2 倍槓桿 ETF）

回測期間 2016-05-02 〜 2026-11-24 · 資料截至 2026-11-25

[到 FinLab Studio 重現這支策略](https://studio.finlab.finance/chat?lang=zh\&research_context=%7B%22v%22%3A1%2C%22source_url%22%3A%22https%3A%2F%2Ffinlab.finance%2Fstrategies%2Fus-low-volatility-strategy%22%2C%22task%22%3A%22%E9%87%8D%E8%B7%91%E3%80%8C%E7%BE%8E%E8%82%A1%E4%BD%8E%E6%B3%A2%E5%8B%95%E6%93%87%E6%99%82%EF%BC%882+%E5%80%8D%E6%A7%93%E6%A1%BF+ETF%EF%BC%89%E3%80%8D%E7%9A%84%E5%9B%9E%E6%B8%AC%E3%80%82%E9%80%99%E9%A0%81%E7%9A%84%E7%AD%96%E7%95%A5%E7%A8%8B%E5%BC%8F%EF%BC%88%E7%94%A8+requests+%E8%AE%80%E5%8F%96%EF%BC%89%EF%BC%9Ahttps%3A%2F%2Ffinlab.finance%2Fblog%2Fus-low-volatility-strategy%2Fstrategy.py%22%2C%22intent%22%3A%22backtest%22%2C%22market%22%3A%22us%22%2C%22period%22%3A%7B%22start%22%3A%222016-01-01%22%2C%22end%22%3A%222026-11-24%22%7D%2C%22published%22%3A%7B%22annual_return%22%3A0.2903%2C%22start%22%3A%222016-05-02%22%2C%22end%22%3A%222026-11-24%22%7D%7D) [完整研究與三項驗證](https://finlab.finance/blog/us-low-volatility-strategy)

QQQ 站上 200 日均線且 126 日報酬為正時，持有 QLD、SSO 中動能較強的一檔；否則持有 IEF、GLD、SHY 中最強的一檔。月換股、6% 停損。2016 年 5 月至 2026 年 10 月回測年化報酬 29.3%、日夏普 1.29、最大回撤 -22.2%；同視窗 QQQ 含息年化 20.7%、日夏普 0.95、最大回撤 -35.1%。鄰近參數、前後兩段、每邊 0.1% 交易成本三項驗證皆通過。

**投資警語：本文僅供教學參考，不構成投資建議。過去績效不代表未來表現，投資有風險。**

## 回測績效

* 年化報酬率

  29.0%

* 夏普比率（日資料）

  1.29

* 最大回撤

  -22.2%

* 總報酬率

  1377%

回測不計手續費與交易稅（finlab 套件 sim() 的美股預設成本），夏普比率用日報酬計算、未扣無風險利率。策略淨值自資料可得日（2016-05-02）起算。

## 淨值曲線（對數座標）

美股低波動擇時（2 倍槓桿 ETF） vs QQQ 買進持有（含息）

美股低波動擇時（2 倍槓桿 ETF）QQQ 買進持有（含息）

## 與 QQQ 買進持有（含息）對照

| 對象                 | 年化報酬率 | 夏普比率（日資料） | 最大回撤   | 回測期間                    |
| ------------------ | ----- | --------- | ------ | ----------------------- |
| 美股低波動擇時（2 倍槓桿 ETF） | 29.0% | 1.29      | -22.2% | 2016-05-02 〜 2026-11-24 |
| QQQ 買進持有（含息）       | 19.3% | 0.90      | -35.1% | 2016-05-02 〜 2026-11-24 |

## 完整策略程式碼

安裝 finlab 套件後即可直接執行重現（finlab.login() 會自動引導登入，不需手動填 token）。想用 AI 輔助安裝與跑第一次回測，可以走[安裝教學](https://finlab.finance/setup)。

展開程式碼（strategy.py）

```
"""US low-volatility defensive compounder -> moderate-leverage ETF strategy (FinLab).

A trend/momentum regime filter on QQQ decides between two books: in risk-on it
holds the stronger of two 2x leveraged index ETFs (QLD / SSO); in risk-off it
rotates into the strongest defensive ETF (IEF / GLD / SHY). Using 2x instead of
3x leverage lowers volatility drag and path dependency. Reproduces the backtest
in the article. Complete the AI-assisted setup flow at https://finlab.finance/en/setup before running this file.

    python strategy.py              # backtest
    python strategy.py --validate   # robustness checks from the article
"""
import sys

import finlab
from finlab import data
from finlab.backtest import sim
from finlab.dataframe import FinlabDataFrame

RISK_ASSETS = ["QLD", "SSO"]              # 2x leveraged index ETFs (held in risk-on)
DEFENSIVE_ASSETS = ["IEF", "GLD", "SHY"]  # treasuries / gold / cash-like (risk-off)


def build_position(trend_window=200, momentum_window=126):
    data.set_market("us_fund")
    close = data.get("us_fund_price:adj_close")[["QQQ"] + RISK_ASSETS + DEFENSIVE_ASSETS]

    # 1. Risk-on regime: QQQ above its 200-day average AND positive 126-day return.
    qqq_trend = close["QQQ"] > close["QQQ"].rolling(trend_window, min_periods=trend_window // 2).mean()
    qqq_momentum = close["QQQ"] / close["QQQ"].shift(momentum_window) - 1
    risk_on = qqq_trend & (qqq_momentum > 0)

    # 2. In risk-on: hold the stronger 2x ETF by 189-day-minus-21-day momentum.
    risk_score = FinlabDataFrame(
        close[RISK_ASSETS].pct_change(189, fill_method=None)
        - close[RISK_ASSETS].pct_change(21, fill_method=None)
    )
    risky = risk_score.is_largest(1) & risk_on.to_frame().reindex(risk_score.index).iloc[:, 0]

    # 3. In risk-off: hold the strongest defensive ETF by 63-day-minus-21-day momentum.
    defensive_score = FinlabDataFrame(
        close[DEFENSIVE_ASSETS].pct_change(63, fill_method=None)
        - close[DEFENSIVE_ASSETS].pct_change(21, fill_method=None)
    )
    defensive = (
        defensive_score.is_largest(1) & (~risk_on).to_frame().reindex(defensive_score.index).iloc[:, 0]
    )

    position = (
        risky.reindex(close.index).fillna(False).astype(float)
        .join(defensive.reindex(close.index).fillna(False).astype(float), how="outer")
        .fillna(0)
        .T.groupby(level=0).max().T
    )
    return position.loc["2016-01-01":]


def run_backtest(position, fee_ratio=None):
    data.set_market("us_fund")
    return sim(
        position,
        resample="M",           # rebalance monthly
        position_limit=1,       # max weight per asset; the strategy holds 1 ETF at a time
        stop_loss=0.06,         # 6% touched stop on the held ETF
        touched_exit=True,
        trade_at_price="close",
        fee_ratio=fee_ratio,    # None = finlab's US default (0 commission, 0 tax)
        upload=False,
    )


# ---------------------------------------------------------------------------
# Robustness checks behind the article's validation section:
#     python strategy.py --validate
# "Beats QQQ" means a higher daily Sharpe than buying and holding QQQ
# (dividend-adjusted) over exactly the same dates.
# ---------------------------------------------------------------------------
COST_PER_SIDE = 0.001  # 0.1% per buy and per sell, for spread and slippage


def daily_sharpe(equity):
    returns = equity.pct_change().dropna()
    return returns.mean() / returns.std() * 252 ** 0.5


def sharpe_vs_qqq(equity):
    qqq = data.get("us_fund_price:adj_close")["QQQ"].reindex(equity.index).ffill()
    return daily_sharpe(equity), daily_sharpe(qqq)


def validate():
    # 1. Neighbouring parameters: the original value and one step either side.
    wins = 0
    for trend_window in (150, 200, 250):
        for momentum_window in (63, 126, 189):
            report = run_backtest(build_position(trend_window=trend_window, momentum_window=momentum_window))
            strategy, qqq = sharpe_vs_qqq(report.creturn)
            wins += strategy > qqq
            print(f"QQQ>{trend_window}d MA {momentum_window}d momentum: Sharpe {strategy:.2f} vs QQQ {qqq:.2f}")
    print(f"{wins}/9 parameter sets beat QQQ")

    # 2. First half and second half of the backtest, each on its own.
    position = build_position()
    equity = run_backtest(position).creturn
    middle = equity.index[len(equity) // 2]
    for label, part in (("first half", equity.loc[:middle]), ("second half", equity.loc[middle:])):
        strategy, qqq = sharpe_vs_qqq(part)
        print(f"{label} {part.index[0].date()} to {part.index[-1].date()}: "
              f"Sharpe {strategy:.2f} vs QQQ {qqq:.2f}")

    # 3. Trading costs: finlab's US default is zero, so charge 0.1% per side.
    report = run_backtest(position, fee_ratio=COST_PER_SIDE)
    strategy, qqq = sharpe_vs_qqq(report.creturn)
    print(f"with 0.1% per side: CAGR {report.get_stats()['cagr']:.1%}, "
          f"Sharpe {strategy:.2f} vs QQQ {qqq:.2f}")


def build_report():
    return run_backtest(build_position())


def main():
    finlab.login()  # finlab guides you through login automatically
    if "--validate" in sys.argv:
        validate()
        return
    report = build_report()
    print(report.get_stats())
    report.display()


if __name__ == "__main__":
    main()
```

[下載 strategy.py](https://finlab.finance/blog/us-low-volatility-strategy/strategy.py) [下載 data.csv（淨值曲線）](https://finlab.finance/blog/us-low-volatility-strategy/data.csv)

[到 FinLab Studio 重現這支策略](https://studio.finlab.finance/chat?lang=zh\&research_context=%7B%22v%22%3A1%2C%22source_url%22%3A%22https%3A%2F%2Ffinlab.finance%2Fstrategies%2Fus-low-volatility-strategy%22%2C%22task%22%3A%22%E9%87%8D%E8%B7%91%E3%80%8C%E7%BE%8E%E8%82%A1%E4%BD%8E%E6%B3%A2%E5%8B%95%E6%93%87%E6%99%82%EF%BC%882+%E5%80%8D%E6%A7%93%E6%A1%BF+ETF%EF%BC%89%E3%80%8D%E7%9A%84%E5%9B%9E%E6%B8%AC%E3%80%82%E9%80%99%E9%A0%81%E7%9A%84%E7%AD%96%E7%95%A5%E7%A8%8B%E5%BC%8F%EF%BC%88%E7%94%A8+requests+%E8%AE%80%E5%8F%96%EF%BC%89%EF%BC%9Ahttps%3A%2F%2Ffinlab.finance%2Fblog%2Fus-low-volatility-strategy%2Fstrategy.py%22%2C%22intent%22%3A%22backtest%22%2C%22market%22%3A%22us%22%2C%22period%22%3A%7B%22start%22%3A%222016-01-01%22%2C%22end%22%3A%222026-11-24%22%7D%2C%22published%22%3A%7B%22annual_return%22%3A0.2903%2C%22start%22%3A%222016-05-02%22%2C%22end%22%3A%222026-11-24%22%7D%7D)

在 Studio 裡用同一套真實資料調整條件、重跑回測。

本頁策略與回測結果僅供教學與研究用途，詳見[服務條款](https://finlab.finance/terms)。

來源：https://finlab.finance/strategies/us-low-volatility-strategy｜資料日期：2016-05-02/2026-11-24
