# US low-volatility timing (2x leveraged ETFs)

Backtest period 2016-05-02 to 2026-11-24 · Data as of 2026-11-25

[Reproduce this strategy in FinLab Studio](https://studio.finlab.finance/en/chat?research_context=%7B%22v%22%3A1%2C%22source_url%22%3A%22https%3A%2F%2Ffinlab.finance%2Fen%2Fstrategies%2Fus-low-volatility-strategy%22%2C%22task%22%3A%22Rerun+the+backtest+for+%5C%22US+low-volatility+timing+%282x+leveraged+ETFs%29%5C%22.+This+page%27s+strategy+program%2C+read+with+requests%3A+https%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) [Full research and three robustness checks](https://finlab.finance/en/blog/us-low-volatility-strategy)

When QQQ is above its 200-day average with a positive 126-day return, holds the stronger of QLD and SSO; otherwise holds the strongest of IEF, GLD and SHY. Monthly rebalance, 6% stop. May 2016 to October 2026: 29.3% CAGR, daily Sharpe 1.29, max drawdown -22.2%, vs QQQ total return 20.7%, 0.95 and -35.1% over the same dates. Passes all three robustness checks: neighbouring parameters, both halves of the backtest, and 0.1% per-side trading costs.

**Disclaimer: for education only, not investment advice. Past performance does not guarantee future results, and investing involves risk.**

## Backtest performance

* CAGR

  29.0%

* Sharpe ratio (daily)

  1.29

* Max drawdown

  -22.2%

* Total return

  1377%

The backtest charges no commissions or taxes (the finlab sim() default for U.S. stocks), and the Sharpe ratio is computed from daily returns without subtracting a risk-free rate. The equity curve starts on the first date the strategy's data is available (2016-05-02).

## Equity curve (log scale)

US low-volatility timing (2x leveraged ETFs) vs QQQ buy-and-hold (total return)

US low-volatility timing (2x leveraged ETFs)QQQ buy-and-hold (total return)

## Compared with QQQ buy-and-hold (total return)

| Portfolio                                    | CAGR  | Sharpe ratio (daily) | Max drawdown | Backtest period          |
| -------------------------------------------- | ----- | -------------------- | ------------ | ------------------------ |
| US low-volatility timing (2x leveraged ETFs) | 29.0% | 1.29                 | -22.2%       | 2016-05-02 to 2026-11-24 |
| QQQ buy-and-hold (total return)              | 19.3% | 0.90                 | -35.1%       | 2016-05-02 to 2026-11-24 |

## Full strategy code

Install the finlab package and run it as is (finlab.login() walks you through sign-in, no token needed). For AI-assisted setup and a first backtest, follow the [setup guide](https://finlab.finance/en/setup).

Show code (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()
```

[Download strategy.py](https://finlab.finance/blog/us-low-volatility-strategy/strategy.py) [Download data.csv (equity curve)](https://finlab.finance/blog/us-low-volatility-strategy/data.csv)

[Reproduce this strategy in FinLab Studio](https://studio.finlab.finance/en/chat?research_context=%7B%22v%22%3A1%2C%22source_url%22%3A%22https%3A%2F%2Ffinlab.finance%2Fen%2Fstrategies%2Fus-low-volatility-strategy%22%2C%22task%22%3A%22Rerun+the+backtest+for+%5C%22US+low-volatility+timing+%282x+leveraged+ETFs%29%5C%22.+This+page%27s+strategy+program%2C+read+with+requests%3A+https%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)

Adjust the rules and rerun the backtest on the same real data in Studio.

The strategies and backtest results on this page are for education and research only; see the [Terms of Service](https://finlab.finance/en/terms).

Source: https://finlab.finance/en/strategies/us-low-volatility-strategy | Data dates: 2016-05-02/2026-11-24
