时间是 九点到十四点五十五的 ,如果用在股指上请自行改一下。
variable:kd=0,kk=0;
if time>090000 and time<145500 then
begin
for n=1 to 5 do
begin
if TYPE(n)=1 then kd:=1;
else
begin
kd:=0;
exit for;
end
end
for n=1 to 5 do
begin
if TYPE(n)=3 then kk:=1;
else
begin
kk:=0;
exit for;
end
end
if kd=1 then
begin
sell(holding>0,0,market);
buyshort(holding=0,1,limit,ENTERPRICE);
kd:=0;
end
if kk=1 then
begin
sellshort(holding<0,0,market);
buy(holding=0,1,limit,ENTERPRICE);
kk:=0;
end
end
//周期:分笔成交
//版本:标准版
//合约:股指期货
long:=COUNT(BUYVOL,5)=5;
short:=COUNT(SELLVOL,5)=5;
//平空开多
if long and time>091500 and time<151000 then
begin
sellshort(holding<0,1,thisclose);
buy(holding=0,1,thisclose);
end
//平多开空
if short and time>091500 and time<151000 then
begin
sell(holding>0,1,thisclose);
buyshort(holding=0,1,thisclose);
end
//收盘前5分钟平仓
if time > 151000 then
begin
sell(holding > 0, 0, thisclose);
sellshort(holding < 0, 0, thisclose);
end
将"工具-选项"--常规里,盘中延迟刷新,调整小(最小可到100).
//周期:分笔成交
//版本:标准版
//合约:股指期货
long:=COUNT(BUYVOL,5)=5;
short:=COUNT(SELLVOL,5)=5;
//平空开多
if long and time>091500 and time<151000 then
begin
sellshort(holding<0,1,thisclose);
buy(holding=0,1,thisclose);
end
//平多开空
if short and time>091500 and time<151000 then
begin
sell(holding>0,1,thisclose);
buyshort(holding=0,1,thisclose);
end
//收盘前5分钟平仓
if time > 151000 then
begin
sell(holding > 0, 0, thisclose);
sellshort(holding < 0, 0, thisclose);
end