我的意思是:不是反手的开多条件是h>hi,平空条件h>hi,平空后反多条件h>hi+2;不是反手的开空条件
是 l<lo,平多条件l<lo,平多后反空条件l<lo-2;这样上面那模型1请问老师如何修改
下载信息 [文件大小: 下载次数: ] | |
![]() |
if h>hi then buy(holding=0,1,market);
if h>hi then sellshort(1,0,market);
if H>hi+2 then begin
sellshort(1,0,market);
buy(holding=0,1,market);
end
开空的写法一样
那不就是我上面写的意思?你要反手就写一起,不要反手就拆开写
你代码里面一共4段都是反手语句,你按照我上面罗列出来的改改就行
if cc1>0 and l<lo then begin
pc:=min(max(holding,0),cang1);
if pc>0 then sell(1,pc,limitr,min(o,lo-0.2)-0.6);
end
if cc1>0 and l<lo then begin
kc:=cang1-pc;
if pc>0 then sell(1,pc,limitr,min(o,lo-0.2)-0.6);
if kc>0 then buyshort(1,kc,limitr,min(o,lo-0.2)-0.6);
cc1:=0;
goto skip@;
end
if cc1>0 and l<lo-2 then begin
pc:=min(max(holding,0),cang1);
kc:=cang1-pc;
if pc>0 then sell(1,pc,limitr,min(o,lo-0.2)-0.6);
if kc>0 then buyshort(1,kc,limitr,min(o,lo-0.2)-0.6);
cc1:=0;
goto skip@;
end
第一段的反手,就是这样改,你照着改下面的3段反手即可
if cc1>0 and l<lo then begin
kc:=cang1-pc;
if kc>0 then buyshort(1,kc,limitr,min(o,lo-0.2)-0.6);
cc1:=0;
goto skip@;
end
if cc1>0 and l<lo then begin
pc:=min(max(holding,0),cang1);
if pc>0 then sell(1,pc,limitr,min(o,lo-0.2)-0.6);
end
if cc1>0 and l<lo-2 then begin
pc:=min(max(holding,0),cang1);
kc:=cang1-pc;
if pc>0 then sell(1,pc,limitr,min(o,lo-0.2)-0.6);
if kc>0 then buyshort(1,kc,limitr,min(o,lo-0.2)-0.6);
cc1:=0;
goto skip@;
end