你好,
我用逐筆洗價,1分K,配合下方程式,
如果一下單成功,就會記錄當下時間 ( basic_time = currentTime )
但是如果下單成功雖會記錄當下時間,但若已有部位時就把程式關掉,當再重新啟動時,
若偵側到有庫存,則已當下啟動的時間點來當作是basic_time的值。
我的問題是 :
我測試在有部位後重新啟動策略,
都無法執行到下列程式碼中「once( position <> 0 and basic_time = 0 )」的那段內容,
且都會印出多單進場中的basic_time = currentTime 的內容,
明明未達多單條件,但為何會去執行「多單進場」裡面 的print指令呢
請問我可能錯在哪裡?謝謝
//策略啟動時記錄當下時間
var:basic_time(0);
//→→多單進場:
if
position <= 0 and filled <= 0
and close cross Over entry_cost
then begin
SetPosition( quantity,entry_cost,label:="多單進場");
basic_time = currentTime ;
Print(file("C:\SysJust\XQLite\XS\Print\"),"《",SymbolName,"》",NumToStr(date,0),NumToStr(time,0),"起始時間:",NumToStr(basic_time,0));
end;
//只執行一次
once( position <> 0 and basic_time = 0 )
begin
basic_time = currentTime ;
Print(file("C:\SysJust\XQLite\XS\Print\"),"《",SymbolName,"》",NumToStr(date,0),NumToStr(time,0),"起始時間:",NumToStr(basic_time,0),"(#)");
end;
1 評論