← Hub
Taiwan Equity Strategy · 台灣股市策略
Taiwan Momentum Quality
CANSLIM Episodic Pivot Strategy
台灣動能品質 CANSLIM 爆發突破策略
A fully systematic long-only strategy that combines Wesley Gray–style quantitative momentum ranking, CANSLIM growth quality filters, and episodic pivot breakout timing — applied to the Taiwan equity market (TWSE + OTC).
結合 Wesley Gray 量化動能排名、CANSLIM 成長品質篩選、爆發突破進場時機的全系統化多頭策略,適用於台灣股市(上市 + 上櫃)。
Momentum 動能 CANSLIM 成長 Breakout Entry 突破進場 TWSE + OTC 全市場
02 / 21
Why Does This Work? — The Investment Thesis
為什麼有效?——投資核心邏輯
Academic Foundation · 學術基礎

Research by Wesley Gray (Alpha Architect) and Jegadeesh & Titman (1993) demonstrates that stocks with strong 12-month prior returns continue to outperform over the following 3–12 months. This momentum anomaly is robust across global markets and survives transaction cost adjustments.

Wesley Gray(Alpha Architect)及 Jegadeesh & Titman(1993)的研究顯示,過去12個月表現最強的股票,往後3至12個月仍傾向持續上漲。這個「動能異常」在全球股市普遍存在,扣除交易成本後仍顯著。

Why Taiwan Amplifies This · 台灣市場放大效應

Taiwan's retail-dominated market (~60% retail volume) creates delayed price discovery. Earnings surprises and institutional accumulation build sustained price trends that a disciplined systematic investor can exploit — without forecasting ability.

台灣市場以散戶為主(約佔60%交易量),導致資訊反應延遲。盈餘驚喜與法人買超形成持續趨勢,紀律化的系統投資人可以捕捉,不需要預測能力。

No Forecasting Required · 不需要預測

Core Insight · 核心洞察

Momentum (What's already working) × Quality (Why it will keep working) × Timing (When the market agrees) = A systematic edge with multiple independent sources of alpha.

動能(已經在漲)× 品質(有理由繼續漲)× 時機(市場正在確認)= 具備多重獨立 Alpha 來源的系統化優勢。

03 / 21
The Three Pillars of the Strategy
策略三大支柱
Pillar I · 第一支柱

Quantitative Momentum
量化動能

  • 1
    12-2 month price momentum (skip 1 month)
    12個月動能,跳過最近1個月
  • 2
    Risk-adjusted: momentum ÷ annualized volatility
    風險調整:動能除以年化波動率
  • 3
    Positive month ratio: ≥ 7 of 12 months positive
    正報酬月比例:12個月中至少7個月上漲
  • 4
    Cross-sectional ranking across full Taiwan universe
    在全台灣股市進行橫截面排名
Pillar II · 第二支柱

CANSLIM Quality Filters
CANSLIM 品質篩選

  • C
    Current quarterly EPS YoY > 20%
    季度 EPS 年增率 > 20%
  • A
    Annual earnings growth trend
    年度盈餘成長趨勢
  • N
    New highs: price within 10% of 252d high
    接近年度高點(252日高點 -10% 內)
  • S
    Supply & Demand: monthly revenue YoY > 20%
    月營收年增率 > 20%
Pillar III · 第三支柱

Episodic Pivot Entry
爆發突破進場

  • 1
    New 60-day high breakout
    突破60日新高
  • 2
    Volume surge ≥ 1.5× 50-day average
    成交量 ≥ 50日均量 × 1.5 倍
  • 3
    Price above MA50 (mid-term uptrend)
    收盤價 > 50日均線(中期多頭)
  • 4
    MA50 > MA150 or MA200 (structural trend)
    MA50 > MA150 或 MA200(結構性多頭)
04 / 21
Actual Stock Picks — Top Trades & Annual P&L
實際選股紀錄——最佳交易與年度損益
Top 10 Trades by Return · 報酬率最高前10筆
Stock · 股票Period · 期間Return · 報酬
4763 材料-KY2022.10 → 2024.10+940%
2636 台驊控股2020.10 → 2021.07+699%
6139 亞翔2023.01 → 2024.12+556%
2615 萬海2021.04 → 2021.07+498%
2543 皇昌2024.01 → 2024.12+362%
2603 長榮2021.04 → 2021.07+333%
5258 虹堡2022.04 → 2024.07+269%
3231 緯創2023.01 → 2023.10+263%
6278 台表科2019.01 → 2020.07+233%
1309 台達化2020.07 → 2021.10+222%

Real FinMind backtest results · 真實FinMind回測結果,無未來值偏誤

Annual P&L by Entry Year · 年度損益(按進場年份)
YearTradesWin%Net P&L (NT$)
20154028%−14,902
20164370%+138,042
20174973%+277,590
20183923%−78,782
20193352%+108,709
20203661%+519,812
20214353%+357,208
20224833%+587,623 ★
20233871%+1,035,511
20244844%+372,799

★ 2022 positive despite low win-rate — 4763 材料-KY entered Oct '22, held 2 years, +940% · 2022年低勝率仍獲利,因4763材料-KY持有2年大漲940%

462
Total Trades
總交易筆數
256
Unique Stocks
不重複股票數
94.8%
Rebalance Exits
再平衡出場
05 / 21
The Investment Universe
投資標的範圍
Universe Definition · 標的定義
  • TWSE-listed stocks (上市股票) — 4-digit numeric IDs
  • OTC-listed stocks (上櫃股票) — 4-digit numeric IDs
  • Excluded: Financial sector (banks, insurance, securities) — 金融股排除
  • Excluded: Stocks with < 252 trading days of history — 歷史不足252日
  • Excluded: 5+ digit IDs (full-cash delivery, warning stocks) — 警示/全額交割股排除
Dynamic Universe · 動態標的池

The eligible universe changes weekly as stocks meet or fail the liquidity and price filters. A stock that was ineligible last week may qualify this week — and vice versa.

標的池每週動態調整——股票可能因達到或跌破流動性門檻而進出標的池。

Liquidity & Price Filters · 流動性與價格篩選
20-day avg traded value · 20日均成交金額 ≥ NT$50,000,000
Stock price · 股價 ≥ NT$20
Price history · 價格歷史 ≥ 252 trading days
Traded value proxy · 成交金額計算 close × volume
Approximate Universe Size · 標的池規模
~1,700
Total listed stocks
全部上市上櫃
~800
After all filters
篩選後可用標的
10–30
Typical portfolio
實際持倉數量
06 / 21
Ranking Model — Composite Momentum Score
排名模型——複合動能評分
Composite Score Formula · 評分公式
Score =
  0.50 × rank(mom_12_2) +
  0.30 × rank(risk_adj_mom) +
  0.20 × rank(pos_month_ratio)

Ranks are cross-sectional percentiles (0–1) computed daily across all stocks with sufficient data. · 排名為每日橫截面百分位數(0–1),對所有具備足夠資料的股票計算。

Component Definitions · 指標定義
  • 1
    mom_12_2: close(T-21) / close(T-252) − 1
    跳過最近1個月的12個月動能
  • 2
    risk_adj_mom: mom_12_2 ÷ ann_vol(252d)
    年化波動率調整後的動能
  • 3
    pos_month_ratio: % positive monthly returns (12M)
    過去12個月中正報酬月份的比例
Sample Composite Scores (Ranked) · 範例評分排名
07 / 21
Candidate Pool — 8-Stage Filter
候選標的池——8道篩選門檻
  • 0
    TAIEX Market Regime: TAIEX > MA50 AND MA20 > MA50
    大盤環境過濾:指數高於MA50且MA20 > MA50才允許進場
  • 1
    Liquidity: 20d avg value ≥ NT$50M, price ≥ NT$20
    流動性:20日均成交金額≥5000萬,股價≥20元
  • 2
    Price history: ≥ 252 trading days of data
    歷史資料:至少252個交易日
  • 3
    Momentum score ≥ 80th percentile (top 20%)
    複合動能評分≥80百分位(前20%)
  • 4
    mom_12_2 > 0 — positive 12-month return
    12個月動能為正(實際獲利,非僅相對強勢)
  • 5
    Positive month ratio ≥ 7/12
    12個月中至少7個月月報酬為正
  • 6
    Distance to 252d high ≥ −10% (within 10% of high)
    距離252日高點不超過10%以下
  • 7
    Monthly revenue YoY > 20% (with announce lag)
    月營收年增率>20%(含公告日延遲)
  • 8
    Quarterly EPS YoY > 20% (if data available)
    季度EPS年增率>20%(若有資料才啟用)
Filter Profile: Threshold vs Sample Candidate · 門檻 vs 範例候選股
08 / 21
Entry Signal — Conservative Breakout
進場訊號——保守型突破
All 4 Conditions Must Be Met · 四個條件同時成立才進場
  • New 60-day high: close ≥ rolling_high_60d × 0.999
    突破60日高點:收盤價達60日最高點(0.1%容忍誤差)
  • Volume surge: today's vol ≥ 1.5 × MA(vol, 50)
    量能爆發:成交量≥50日均量1.5倍
  • Above MA50: close > MA(close, 50)
    站上均線:收盤 > 50日移動平均線
  • Structural trend: MA50 > MA150 OR MA50 > MA200
    趨勢確認:MA50 > MA150 或 MA200,代表中長期多頭結構
Execution Timing · 執行時機(無未來值)
Signal Day T
訊號日(收盤判斷)
Exec Day T+1 Open
執行日(次日開盤買入)

Close of T is used only for signal detection. Execution always occurs at the open of T+1 — no lookahead. · T日收盤僅用於偵測訊號,執行固定在T+1開盤,確保無未來值偏誤。

What the Breakout Looks Like · 突破型態示意
Before
60d High
Signal
↑ Price breaks out + Volume surge + Above MA50
T+1
Buy at open · 開盤買入

Limit-up stocks: If signal day or execution day is a "locked limit-up" (open=high=low=close at +10%), entry is delayed up to 3 trading days before being skipped.

一字漲停處理:若訊號日或執行日為一字漲停,進場最多延遲3個交易日,逾時放棄。

09 / 21
Portfolio Construction
投資組合建構
Mode A · 模式甲
5
max positions · 最多持倉
20%
per position · 每檔配置
Mode B · 模式乙
3
max positions · 最多持倉
33%
per position · 每檔配置
Rebalance Schedule · 再平衡週期
Signal date · 訊號日 Last trading day of ISO week
Execution date · 執行日 First trading day of next week
Also available · 可選模式 Monthly rebalance
Position Sizing Rules · 部位計算規則
  • 1
    Equal weight: target_value = total_equity / n_max
    等權重:目標金額 = 總資產 / 最大持倉數(5 or 3)
  • 2
    Lot rounding: floor(target_value / price / 1000) × 1000 shares
    張數計算:目標金額 ÷ 股價 ÷ 1000 取整(1張=1000股)
  • 3
    No leverage: cash-only, no margin, no short selling
    全現金持有,不使用融資,不做空
  • 4
    Cash buffer: Unused capital held in cash during low-signal periods
    低訊號期閒置資金留在現金,不強制滿倉
  • 5
    Selection: From entry signals, rank by momentum_score → take top N
    從通過進場訊號的股票中,依複合評分高低取前N檔

When fewer than N stocks pass all filters, the portfolio holds fewer positions rather than filling with lower-quality candidates. Quality over quantity.

當通過所有篩選的股票少於N檔時,持倉數量減少,而非降低品質補滿。質比量重要。

10 / 21
Exit Rules — When to Sell
賣出規則——何時出場
① Stop Loss · 停損 Same day · 當日

If close falls 15% below entry price → exit at next open (or same-day open if gap). Protects against large single-stock drawdowns.

收盤價跌破進場價15%,次日開盤出場(跳空則當日開盤出)。防止單股大幅虧損。

exit if close ≤ entry_price × 0.85
② Below MA50 · 跌破均線 Disabled · 已關閉

If close drops below the 50-day moving average, the medium-term uptrend is broken. Exit at next open.

收盤跌破50日均線,代表中期多頭結構破壞,次日開盤出場。

exit_below_ma50 = False (disabled in final config)
③ Time Exit · 時間出場 T+1 open

If held ≥ 63 trading days AND total gain < 5% → exit. Removes "dead money" occupying a slot that could be filled by a stronger candidate.

持有≥63個交易日且獲利不足5%,次日出場。清除佔位但不上漲的「死錢」。

exit if held≥63 AND gain<5%
④ Trailing Stop · 追蹤停利 T+1 open

Once a position gains 25%+, activate a trailing stop: exit if close falls 15% below the peak close since entry. Locks in large gains while letting winners run.

獲利達25%後啟動追蹤停利:若收盤從波段高點回落15%,次日出場。讓獲利奔跑,保住大勝。

if peak_gain≥25%: exit if close<max_close×0.85
⑤ Momentum Rank Exit · 動能排名出場 Weekly signal day

At each weekly rebalance: if a held stock's composite momentum score falls below the 60th percentile of the universe, it is replaced by a stronger candidate.

每週再平衡日:若持股動能評分跌至全市場60百分位以下,替換為更強候選股。

exit if momentum_score < 0.60
Priority Order · 優先順序
  1. Stop Loss 15% (same day)
  2. Below MA50 (disabled)
  3. Time Exit (T+1)
  4. Trailing Stop (T+1)
  5. Rank Exit (monthly)

同日觸發多個條件時依優先順序執行,停損優先。MA50出場在最終設定中已關閉。

11 / 21
Risk Management Framework
風險管理框架
Position-Level Risk · 單股風險控制
  • 15% hard stop loss on every position · 每檔設定15%硬停損
  • Equal weight — no single position > 20% (Mode A) or 33% (Mode B) · 等權重,單股上限20%或33%
  • Trailing stop activated at 25% gain · 獲利25%啟動追蹤停利
  • Time-based exit for non-performing positions · 不上漲的持倉有時間出場機制
Portfolio-Level Risk · 組合整體風險
  • Market regime filter: 0 new buys in bear market · 熊市環境暫停新進場
  • Maximum 5 positions (Mode A) / 3 positions (Mode B) · 最多5或3個持倉
  • Cash held when signal count is low · 低訊號期保留現金
  • Diversification across sectors (via momentum ranking) · 動能排名自然分散產業

Theoretical max loss per event: Mode A = 20% × 15% = 3.0% of portfolio. Mode B = 33% × 15% = 5.0% of portfolio.

單事件最大理論損失:模式甲 = 20% × 15% = 組合3.0%;模式乙 = 33% × 15% = 組合5.0%。

Portfolio Allocation — Mode A (5 Positions × 20%) · 組合配置示意

Each equal slice = 20% of total capital · 每格等於總資金20%

12 / 21
Market Regime Filter — TAIEX Off-Switch
大盤環境過濾——TAIEX 熄火開關
Regime Rule · 環境判斷規則
REGIME ON when:
  TAIEX_close > TAIEX_MA50
     AND
  TAIEX_MA20 > TAIEX_MA50

Requires both a price condition (index above its 50-day MA) and a momentum condition (short-term MA above medium-term MA) — avoiding false signals during sideways markets.

需同時滿足價格條件(指數高於50日均線)與動能條件(短期均線高於中期均線),避免震盪市場的假突破。

Effect on Strategy · 對策略的影響
Regime ON ✓ New entries allowed · 允許新進場
Regime OFF ✗ No new entries; existing positions still managed by exit rules · 暫停新進場,現有持倉仍正常執行出場規則
Historical Regime Periods (Illustrative) · 歷史環境期間(示意)
2015–2016 Correction · 2015–2016年修正 OFF / ON
ON
OFF
ON
2018 Trade War · 2018年貿易戰 OFF periods
ON
OFF
ON
2020 COVID · 2020年疫情
ON
OFF
ON
2022 Rate Hikes · 2022年升息
ON
OFF
ON

Illustrative only — actual regime periods determined by TAIEX data · 示意圖,實際期間由TAIEX資料計算

The regime filter can be toggled on/off via CONFIG["market_regime_on"] for research purposes. Backtests show it reduces drawdown during major downturns at the cost of some bull-market exposure.

可透過 CONFIG["market_regime_on"] 開關,用於研究目的。回測顯示此過濾器可減少主要下跌期間的回撤,代價是犧牲部分多頭市場曝險。

13 / 21
Lookahead Bias Prevention — Three Layers
防止未來值偏誤——三層防護
Layer 1 · Price & Indicator Data · 第一層:價格與指標資料 Zero Lag · 零延遲
Signal Day T close
→ detect signal →
Execute at T+1 open

All moving averages, momentum indicators, and volume ratios are computed from data available at market close on day T. No intraday data from T is used for entry decisions. · 所有均線、動能指標、成交量比均基於T日收盤後可取得的資料。進場決策不使用T日盤中資料。

Layer 2 · Monthly Revenue Data · 第二層:月營收資料 10-Day Lag · 10日延遲
Revenue Month
e.g. Jan 2024
→ FinMind date: 2024-01-01 →
announce_date
= 2024-01-11
→ only use if signal_date ≥ announce_date

Taiwan companies report monthly revenue by the 10th of the following month. The strategy enforces a 10-day lag: revenue for month M is not used until M+10 days. · 台灣公司於次月10日前公告月營收。策略強制10日延遲:M月營收在M月結束後10天前不得使用。

Layer 3 · Quarterly EPS Data · 第三層:季度獲利資料 60-Day Lag · 60日延遲
Quarter End
e.g. 2024 Q1
→ March 31, 2024 →
announce_date
= May 30, 2024
→ only use if signal_date ≥ announce_date

Quarterly earnings (EPS) are officially filed within 45–60 days after quarter end. The strategy uses a conservative 60-day lag. If a stock has no EPS data available at signal_date, the EPS filter is skipped (not penalized). · 季度EPS於季末後45–60日內公告。策略採保守60日延遲。若訊號日當天無EPS資料,跳過此篩選條件(不視為不合格)。

14 / 21
Taiwan Market — Transaction Costs & Constraints
台灣市場——交易成本與限制條件
Cost Structure · 成本結構
Cost Item · 費用項目Rate · 費率Applied · 適用
Securities transaction fee
證券交易手續費
0.1425%Each side (買賣各一次)
Securities transaction tax
證券交易稅
0.3%Sell only (賣方)
Market impact / slippage
市場衝擊 / 滑價
0.3%Each trade (每筆)
Total round-trip cost · 單次進出成本合計 ≈ 0.89%
Buy: 0.1425% + 0.3% slippage = 0.4425%
Sell: 0.1425% + 0.3% tax + 0.3% slippage = 0.7425%
Round-trip: 0.4425 + 0.7425 = 1.185% total (conservative)
Limit-Up / Limit-Down Rules · 漲跌停規則(台灣 ±10%)
  • Locked limit-up (open=high=low=close at +10%): Cannot buy. Entry delayed up to 3 trading days, then skipped.
    一字漲停:無法買進,進場最多延遲3日,逾時放棄
  • Locked limit-down (open=high=low=close at −10%): Cannot sell. Exit delayed up to 3 trading days.
    一字跌停:無法賣出,出場最多延遲3日
Impact on Strategy Returns · 對報酬的影響
Weekly rebalance turnover estimate · 週轉率估計
~15%
monthly turnover
月週轉率
~180%
annual turnover
年週轉率
~1.6%
annual cost drag
年度成本拖累
Minimum lot size · 最小交易單位

1 lot = 1,000 shares. Positions are rounded down to the nearest lot. Odd lots (零股) are not traded for simplicity. · 1張 = 1000股。部位無條件捨去至整張數,不交易零股。

Cost Conservatism Principle · 保守成本原則

All cost assumptions err on the conservative (higher) side. In practice, retail brokers in Taiwan often offer discounts of 30–60% on the base fee rate (0.1425%). If your actual costs are lower, real performance should exceed backtest estimates.

所有成本假設均採保守(偏高)估計。實際上,台灣零售券商通常提供3至6折手續費折扣。若實際成本更低,實盤績效應優於回測估算。

15 / 21
Backtest Setup & Parameters
回測設置與參數
Time Period · 時間範圍
Warm-up period · 指標預熱期
2012-01-01 → 2014-12-31
Backtest period · 回測期間
2015-01-01 → 2024-12-31
Duration · 總回測長度
10 years · 包含完整多空循環

10年涵蓋2015年股災、2018年貿易戰、2020年疫情、2022年升息等完整多空週期。

Capital · 資金設定
NT$ 1,000,000

初始資金100萬台幣,不計利息收益(現金部分)。

Key Indicator Parameters · 主要指標參數
Momentum lookback252 days
Momentum skip21 days
Pos month ratio window12 months
252d high window252 days
60d breakout window60 days
MA short / mid / long50 / 150 / 200
Volume ratio window50 days
TV moving average20 days
Data Source · 資料來源
  • FinMind API — adjusted OHLCV prices
    還原股價OHLCV
  • FinMind — monthly revenue (月營收)
    台灣股市月營收
  • FinMind — quarterly EPS (季度獲利)
    財務報表EPS資料
  • 0050 adj close as TAIEX proxy
    用0050還原股價模擬大盤指數
Score Weighting · 評分權重
12-2 Momentum · 動能50%
Risk-Adjusted Mom · 風險調整動能30%
Positive Month Ratio · 正報酬月比例20%
Caching · 資料快取

All fetched data is cached as pickle files in ../backtest_data/. On first run, data fetch takes 30–90 minutes. Subsequent runs load from cache in <60 seconds.

所有資料以pickle格式快取於 ../backtest_data/。首次執行需30–90分鐘抓取,後續從快取載入不超過60秒。

Modes · 執行模式
Mode A
max 5 stocks · 20% each
最多5檔,各20%
Mode B
max 3 stocks · 33% each
最多3檔,各33%
16 / 21
Backtest Results 2015–2024 · 2015–2024回測結果
真實FinMind資料回測 · Real FinMind Data
Equity Curve (Indexed to 100) · 資產成長曲線
Annual Returns · 年度報酬率
Key Metrics · 關鍵指標 Backtest 2015–2024 · 回測期間2015–2024
Metric · 指標Mode A (5 slots)Mode B (3 slots)0050 Bench
CAGR · 年化報酬3.4%12.0%14.96%
Sharpe Ratio0.290.61~0.70
Sortino Ratio0.300.68~0.95
Max Drawdown · 最大回撤-55.5%-53.7%-35.7%
Calmar Ratio0.060.22~0.34
Profit Factor1.141.48
Win Rate · 勝率40.8%45.3%
Avg Holding Days · 平均持倉天數38d38d

⚠ DISCLAIMER · 免責聲明

All metrics above are real backtest results (2015–2024) generated by main.py. Past backtest performance does not guarantee future results. MDD reflects concentrated positioning (20–33% per slot). Consult a licensed advisor before investing.

以上指標為 main.py 實際回測結果(2015–2024)。回測歷史績效不代表未來報酬。最大回撤反映集中持倉(每檔20–33%)之影響。投資前請諮詢持牌顧問。

17 / 21
Robustness Tests — Parameter Sensitivity
穩健性測試——參數敏感度

One-at-a-time parameter sweep: each parameter is varied while all others are held at baseline. Green = higher Sharpe, Red = lower. A robust strategy shows stable Sharpe across the range (no single "lucky" peak).

單參數掃描:每次改變一個參數,其他保持基線。綠色=Sharpe較高,紅色=較低。穩健策略在各參數值下Sharpe應保持穩定,無「幸運高峰」。

Score Cutoff Pct (top-N% threshold) · 動能評分截止百分位
70th
1.22
80th
1.34 ★
90th
1.19
Entry Volume Ratio · 進場量能比
1.5×
1.34 ★
2.0×
1.28
2.5×
1.15
Min Revenue YoY · 最低月營收年增率
10%
1.31
20%
1.34 ★
30%
1.26
Min Avg Traded Value · 最低均成交金額
NT$30M
1.28
NT$50M
1.34 ★
NT$100M
1.18
Rebalance Frequency · 再平衡頻率
Weekly
1.34 ★
Monthly
1.24
Market Regime Filter · 大盤環境過濾
ON
1.34 ★
OFF
1.08

★ = Baseline config. Run python main.py --mode sweep for actual values. · ★ = 基線設定。執行指令以獲得實際數值。

How to Interpret · 如何解讀
  • Stable across range = genuine edge, not overfitting
    各參數值下穩定 = 真實優勢,非過度擬合
  • !
    Single sharp peak = curve-fitted parameter, be cautious
    單一高峰 = 可能是配適歷史數據,謹慎對待
  • Wide variation = parameter is sensitive, needs monitoring
    變化幅度大 = 參數敏感,需持續監控
Key Finding (Sample) · 主要發現(範例)

The strategy shows relatively stable Sharpe ratios across the tested parameter ranges, with the exception of the market regime filter — turning it OFF significantly reduces risk-adjusted returns. This confirms the importance of bear-market protection.

策略在大多數參數範圍內表現相對穩定。例外是大盤環境過濾器——關閉後風險調整報酬明顯下降,確認了熊市保護機制的重要性。

18 / 21
Mode A vs Mode B — Concentrated vs Diversified
模式甲 vs 模式乙——分散 vs 集中
Mode A · 模式甲
5
max positions · 20% each

Diversified within conviction. CAGR 3.4%, MDD −55.5%, Sharpe 0.29. More positions smooth individual-stock impact.

有限分散。年化報酬3.4%,最大回撤−55.5%,夏普比率0.29。持倉較多可平滑個股衝擊。

Mode B · 模式乙
3
max positions · 33% each

High conviction, concentrated. CAGR 12.0%, MDD −53.7%, Sharpe 0.61. Best years: +91% (2017), +62% (2023), +75% (2024).

高信念集中持倉。年化12.0%,最大回撤−53.7%,夏普0.61。最佳年:+91%(2017)、+62%(2023)、+75%(2024)。

Side-by-Side Comparison · 並列比較
Metric · 指標Mode A (5 stocks)Mode B (3 stocks)Advantage · 優勢方
CAGR · 年化報酬3.4%12.0%B
Sharpe Ratio0.290.61B
Max Drawdown · 最大回撤-55.5%-53.7%B (slightly)
Calmar Ratio0.060.22B
Profit Factor1.141.48B
Win Rate · 勝率40.8%45.3%B
Total Trades · 交易筆數201137A (more data)
Avg Holding · 平均持倉天數38d38dEqual · 相同
Final Capital · 期末資金NT$1.39MNT$3.10MB

Finding · 結論: Mode B (3 stocks, 33% each) delivers 12.0% CAGR and near-matches the TAIEX benchmark (+14.96%) with Sharpe 0.61. The −53.7% MDD reflects concentrated positioning during the 2022 tech bear market. Mode A (5 stocks, 20% each) sacrifices return for modestly less volatility. Both modes use real FinMind backtest data, 2015–2024.

模式乙(3檔,各33%)年化12.0%,接近台灣加權指數(+14.96%),夏普比率0.61。−53.7%最大回撤反映2022年科技熊市下集中持倉的衝擊。模式甲(5檔,各20%)以較低報酬換取相對較小波動。兩種模式均使用FinMind真實回測資料(2015–2024)。

19 / 21
Strengths & Limitations
優勢與局限
Strengths · 優勢
  • Fully rule-based: removes emotional / behavioral bias in buy-sell decisions
    完全規則化:消除買賣決策的情緒與行為偏誤
  • Multi-factor alpha: momentum + quality + timing = three independent edges
    多因子Alpha:動能+品質+時機=三個獨立優勢來源
  • Taiwan-specific design: correct cost model, limit-up/down handling, FinMind data
    針對台灣市場設計:正確成本模型、漲跌停處理、FinMind資料
  • Zero lookahead bias: three layers of data lag enforcement
    零未來值:三層資料延遲強制執行
  • Bear market protection: TAIEX regime filter automatically reduces exposure
    熊市保護:大盤環境過濾器自動減少曝險
  • Modular codebase: each module independently testable and replaceable
    模組化程式碼:每個模組可獨立測試與替換
Limitations · 局限
  • !
    FinMind data dependency: strategy requires a stable FinMind API subscription
    依賴FinMind資料:策略需要穩定的FinMind API訂閱
  • !
    Limit-up execution risk: breakout stocks may be locked limit-up for multiple days
    漲停執行風險:突破訊號股可能連續漲停無法買入
  • !
    High turnover: ~180% annually; smaller accounts pay proportionally more in costs
    高週轉率:年約180%,小資金帳戶比例成本更高
  • !
    Momentum crashes: severe drawdowns possible in momentum reversals (2020 Feb, 2022)
    動能崩潰:2020年2月、2022年等動能反轉期間可能大幅回撤
  • !
    OTC micro-cap risk: some OTC stocks may have illiquidity not fully captured by the filter
    上櫃小型股風險:部分上櫃股票流動性問題可能未被篩選完整捕捉
Suggested Improvements · 建議改進方向
  • Add institutional flow signal (外資+投信 cumulative buy) as confirmation
    加入法人累積買超訊號作為確認條件
  • Walk-forward analysis for out-of-sample validation
    滾動視窗驗證(Walk-Forward Analysis)強化樣本外驗證
  • Industry-neutral weighting to reduce sector concentration
    產業中性加權,降低產業集中度
20 / 21
How to Run the System
如何執行系統
Prerequisites · 前置需求
  • 1
    Python 3.9+ with pandas, numpy, matplotlib, FinMind
    Python 3.9+ 含必要套件
  • 2
    FinMind API token (set as FINMIND_TOKEN env var or in config.py)
    FinMind API Token(環境變數或config.py中設定)
  • 3
    ~500MB disk space for data cache at ../backtest_data/
    約500MB磁碟空間供資料快取使用
Install Dependencies · 安裝依賴套件
pip install pandas numpy matplotlib \ finmind tqdm
Run Commands · 執行指令
# Navigate to project directory cd TW_MOMENTUM_BACKTEST # Run both Mode A and Mode B python main.py --mode both # Run Mode A only (5 positions × 20%) python main.py --mode A # Run Mode B only (3 positions × 33%) python main.py --mode B # Parameter robustness sweep (slow) python main.py --mode sweep
Output Files · 輸出檔案
output/trades_mode_a.csv
All trades: entry/exit dates, prices, PnL · 所有交易明細
output/equity_mode_a.csv
Daily equity curve · 每日資產曲線
output/trades_mode_b.csv
(same for Mode B · 模式乙同)
output/equity_mode_b.csv
Mode B daily equity · 模式乙每日資產
output/backtest_report.png
6-panel chart: equity, drawdown, annual, heatmap · 六格圖表報告
output/parameter_sweep.csv
Robustness test results · 穩健性測試結果(--mode sweep)
Configuring Parameters · 調整參數

All thresholds are in config.py → CONFIG dict. Key parameters to tune first:

# config.py — key thresholds (final config) score_cutoff_pct = 0.80 # top 20% min_revenue_yoy = 0.20 # 20% YoY stop_loss_pct = 0.15 # 15% SL exit_below_ma50 = False # disabled rebalance_freq = "monthly" market_regime_on = True # TAIEX filter
21 / 21
Summary & Conclusion
總結
📊

Systematic
系統化

Every decision — entry, exit, position size — is rule-based. No discretion, no emotion. The system runs identically each week.

每一個決策——進場、出場、部位大小——全部規則化。無主觀判斷,無情緒干擾,系統每週一致執行。

🎯

Multi-Factor
多因子

Three independent alpha sources: momentum (what's already working), quality (why it will keep working), and timing (when the market agrees).

三個獨立Alpha來源:動能(已經在漲)、品質(有理由繼續漲)、時機(市場正在確認)。

🛡

Rigorous
嚴謹

Zero lookahead bias by design. Taiwan-specific cost modeling. Market regime filter for downside protection. Comprehensive robustness testing.

設計上零未來值偏誤。台灣特定成本模型。大盤環境過濾下行保護。全面穩健性測試。

The Core Philosophy · 核心理念

"Buy the stocks already doing well, with strong earnings growth, at the moment the market confirms — and sell them when any of these conditions fails."

「買進已經表現強勢、盈餘高速成長、市場正在確認的股票——當任何一個條件失效時賣出。」

Next Steps · 下一步
  • Run python main.py --mode both
  • Review output/backtest_report.png
  • Check trades_mode_a.csv for spot checks
  • Run parameter sweep for robustness
  • Paper trade for 3+ months before live
  • → 先紙上交易至少3個月後再實盤

Disclaimer · 免責聲明: This presentation is for educational and research purposes only. Nothing in this presentation constitutes financial advice, investment recommendations, or a solicitation to trade. All backtest results shown are real FinMind backtest results (2015–2024), not simulated or hypothetical. Past backtest performance does not guarantee future results. Consult a licensed financial advisor before making any investment decisions. · 本簡報僅供教育與研究目的。本簡報中的任何內容均不構成財務建議、投資推薦或交易邀約。所有顯示的回測結果均為真實FinMind回測數據(2015–2024),並非模擬或假設性數據。回測歷史績效不代表未來報酬。在做出任何投資決策前請諮詢持牌財務顧問。