|
這應該要用到Custom Backtester
Custom Backtester才是AB強大的地方
可是不是那麼容易
我隨便寫寫的 不一定會動
你參考看看
SetCustomBacktestProc("");
SetTradeDelays(0, 0, 0, 0);
// Money Management
if (Status("action") == actionPortfolio) {
bo = GetBacktesterObject();
bo.PreProcess();
for (bar = 0; bar < BarCount; bar++) {
CurrentEquity = bo.Equity;
for (sig = bo.GetFirstSignal(bar); sig; sig = bo.GetNextSignal(bar)) {
SetForeign(sig.Symbol);
if (bar == 2) {
sig.PosSize = CurrentEquity * 0.2;
}
RestorePriceArrays();
}
bo.ProcessTradeSignals(bar);
}
bo.PostProcess();
}
Buy = ..........; |
|