Forward Testing 實盤驗證指南:從模擬帳戶到真實帳戶
📌 本文重點
建立完整的 EA 上線流程:Demo 帳戶 Forward Testing 方法論、績效評估標準、真實帳戶資金管理,以及如何判斷策略是否準備好進入實盤。
建立完整的 EA 上線流程:Demo 帳戶 Forward Testing 方法論、績效評估標準、真實帳戶資金管理,以及如何判斷策略是否準備好進入實盤。
為什麼回測還不夠?
回測是在已知的歷史數據上測試,而真實市場每天都在變化。Forward Testing 是指在真實市場條件下用模擬帳戶運行 EA,驗證策略在「未知」數據上的表現。
上線流程四階段
| 階段 | 時間 | 目標 | 通過標準 |
|---|---|---|---|
| 1. 策略回測 | — | 歷史驗證 | 獲利因子 >1.5,回撤 <20% |
| 2. Demo 帳戶測試 | 1–3 個月 | 真實市場驗證 | 至少 50 筆交易,與回測接近 |
| 3. 微型真實帳戶 | 1–2 個月 | 心理與執行測試 | 穩定獲利,無意外行為 |
| 4. 正式實盤 | 持續 | 全資金運行 | 持續監控,定期評估 |
Forward Testing 績效追蹤程式碼
struct ForwardStats
{
int totalTrades;
int winTrades;
double totalProfit;
double maxDD;
double peakEquity;
datetime startTime;
void Reset()
{
totalTrades=0; winTrades=0; totalProfit=0; maxDD=0;
peakEquity=AccountInfoDouble(ACCOUNT_EQUITY);
startTime=TimeCurrent();
}
double WinRate() { return totalTrades>0 ? (double)winTrades/totalTrades*100 : 0; }
int DaysRunning() { return (int)((TimeCurrent()-startTime)/86400); }
};
ForwardStats g_stats;
int OnInit() { g_stats.Reset(); Print("Forward Testing 開始"); return INIT_SUCCEEDED; }
void OnTradeTransaction(const MqlTradeTransaction &trans,
const MqlTradeRequest &req, const MqlTradeResult &res)
{
if (trans.type != TRADE_TRANSACTION_DEAL_ADD) return;
if (!HistoryDealSelect(trans.deal)) return;
if (HistoryDealGetInteger(trans.deal,DEAL_ENTRY) != DEAL_ENTRY_OUT) return;
double profit = HistoryDealGetDouble(trans.deal, DEAL_PROFIT);
g_stats.totalTrades++;
g_stats.totalProfit += profit;
if (profit > 0) g_stats.winTrades++;
// 更新最大回撤
double equity = AccountInfoDouble(ACCOUNT_EQUITY);
if (equity > g_stats.peakEquity) g_stats.peakEquity = equity;
double dd = g_stats.peakEquity - equity;
if (dd > g_stats.maxDD) g_stats.maxDD = dd;
// 每 10 筆輸出統計
if (g_stats.totalTrades % 10 == 0)
{
Print("=== Forward Test 統計(第", g_stats.DaysRunning(), "天)===");
Print("交易數:", g_stats.totalTrades, " 勝率:", DoubleToString(g_stats.WinRate(),1), "%");
Print("總盈虧: $", DoubleToString(g_stats.totalProfit,2));
Print("最大回撤: $", DoubleToString(g_stats.maxDD,2));
}
}
準備進入實盤的檢查清單
- ☑ Demo 測試至少 60 天,交易 ≥ 50 筆
- ☑ 實際勝率與回測相差 ≤ 15%
- ☑ 實際最大回撤未超過回測的 150%
- ☑ 沒有出現回測中未見的異常行為
- ☑ 策略在趨勢、橫盤、高波動環境都有表現
實盤資金管理建議
- 只用你願意全部損失的資金
- 實盤初期風險降至 Demo 的 50%
- 穩定獲利 3 個月後再考慮加碼
- 設定帳戶層面的每日最大虧損限制
- 每月比較實盤與回測指標,出現顯著偏差則暫停分析
本文由 James Lee 撰寫。內容僅供教育目的,不構成投資建議。