|
下面的代碼可以將close的大小排序和打分,然後輸出到一個文字檔裏。
首先我需要做的是選想backtest那個industry ,
但我想它自動backtest 所有的industry, 可以怎樣改呢?
Buy= 1;
Sell=0;
SetBacktestMode( backtestRegularRaw );
PositionScore = Close; // anything you like (will be sorted/ranked according to absolute value of pos score)
SetCustomBacktestProc("");
OutputFileName = "myoutput.txt";
if( Status("action" ) == actionPortfolio )
{
bo = GetBacktesterObject();
bo.PreProcess();
dt = DateTime();
fh = fopen( OutputFileName, "w" );
fputs( "Symbol, Score\n", fh );
for( i = 0; i < BarCount; i++ )
{
strdt = DateTimeToStr( dt[ i ] );
Line = "\nDate : " + strdt + "\n";
_TRACE( Line );
fputs( Line, fh );
for( sig = bo.GetFirstSignal(i); sig; sig = bo.GetNextSignal(i) )
{
Line = sig.Symbol + "," + sig.PosScore + "\n";
_TRACE( Line );
fputs( Line, fh );
}
bo.ProcessTradeSignals( i );
}
fclose( fh );
bo.PostProcess();
}
|
|