
等级: 标准版
- 注册:
- 2022-6-27
- 曾用名:
|
以下收盘清仓的代码都试过了,但是把策略加载在1分钟以上的周期还是会在持仓同步的列表里发现有持仓
//收盘平仓
收盘平多:sell(t2 and holding>0, 0, thisclose);
收盘平空:sellshort(t2 and holding<0,0,thisclose);
//收盘前强平
cd:CLOSETIME(4)=CLOSETIME(0); //cd=1表示有夜盘,cd=0表示无夜盘
if cd=1 and (time=closetime(0) or time=closetime(1)) then begin
sell(1,0,THISCLOSE);
sellshort(1,0,THISCLOSE);
end
if cd=0 and time=CLOSETIME(0) then BEGIN
sell(1,0,THISCLOSE);
sellshort(1,0,THISCLOSE);
end
//下午收盘清仓
//if time=closetime(0) then
//begin
//sell(1,0,THISCLOSE);
//sellshort(1,0,THISCLOSE);
//end
////日夜清仓
//if time=closetime(0) or time=closetime(1) then
//begin
//sell(1,0,THISCLOSE);
//sellshort(1,0,THISCLOSE);
//end
//////////////下午收盘清仓
t2:=time>=closetime(0)-10*100;
收盘平多:sell(t2,lot,market);
收盘平空:sellshort(t2,lot,market);
//***********************************************
|
|