|
本帖最後由 kilroy 於 14-2-9 22:34 編輯
skyler 發表於 14-2-9 21:43
感謝kilroy 大的分享
以您的測試範例測試就OK了
Hi,
backtest settings 裡,positions 設定為 long and short 是要讓回測時跑多單和空單的回測
buyprice, shortprice, sellprice, coverprice 是設定進場出場價格
匯出歷史資料的部分,請參考下列範例
/*
Export intraday and EOD data to TXT files
One file for each stock
In the first line insert the directory you want to save them to, make sure the
directory exists
Select your charts to export with the "Apply to" filter in AA window
Select the timeframe period you want to save as using the AA "Settings"
Press Scan button
by Graham Kavanagh 05 Feb 2004
*/
fh = fopen( "C:\\"+Name()+".txt", "w");
if( fh )
{
fputs( "Date,Time,Open,High,Low,Close,Volume \n", fh );
y = Year();
m = Month();
d = Day();
r = Hour();
e = Minute();
n = Second();
for( i = 0; i < BarCount; i++ )
{
//fputs( Name() + "," , fh );
ds = StrFormat("%02.0f-%02.0f-%02.0f,",
y[ i ], m[ i ], d[ i ] );
fputs( ds, fh );
ts = StrFormat("%02.0f:%02.0f:%02.0f,",
r[ i ],e[ i ],n[ i ] );
fputs( ts, fh );
qs = StrFormat("%.4f,%.4f,%.4f,%.4f,%.0f\n",
O[ i ],H[ i ],L[ i ],C[ i ],V[ i ] );
fputs( qs, fh );
}
fclose( fh );
}
Buy = 1;
選好你要匯出的週期,按 scan,檔案就跑出來了
路徑在語法裡
參考看看了
|
評分
-
查看全部評分
|