小編你好~
我的交易中心下單腳本,加了一個條件結果差了十倍,
我逐筆排除發現原因在於一行: condition9=.....,回測筆數就少了九成
腳本簡化後如下,將其中的雙斜線拿掉,結果從22414比變成1662比,差了2萬多筆....麻煩告知原因及處理方式,謝謝!
input:profitex(1000,"獲利多少出場%"),lostex(15,"虧損多少出場%");
input:time1(090000,"最早進場時間"),time2(090000,"最早出場時間"),hh(18,"TSE均線");
var:day_count(0);
var:intraBarPersist dayentry(0);
if date<>date[1] and (currenttime=090000 or currenttime=133000) then dayentry=0;
condition1= close <> getField("漲停價") ;
condition3= SymbolName <>"XXX" ;
//condition9= GetSymbolField("TSE.TW","收盤價","60")>average(GetSymbolField("TSE.TW","收盤價","60"),hh);
if date<>date[1] and position=0 and currenttime>=time1 and dayentry=0 and condition1
then begin
setposition(1,AddSpread(Close,+2));
day_count = 0;
end;
//-----出場區----
if filled[1]>0 and filled>0 and close <> getField("跌停價", "D") and currenttime>=time2 and
( close>=filledAvgPrice*(1+profitex*0.01) or close<=filledAvgPrice*(1-lostex*0.01) )
then begin
dayentry=1;
setposition(0,AddSpread(Close,-10));
end;
5 評論