RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
kd:=K>D and c>o ;//开多平空条件
pd:=c<o;
kk:=k<d and c<o;//开空平多条件
pk:=c>o;
if TISREMAIN(3)<>0 AND kd then
BEGIN
tcancel(1,0);
tbuy(kd and tholding=0,1,lmt,c-30*MINDIFF);
END
if TISREMAIN(1)<>0 AND kk then
BEGIN
tcancel(1,0);
tbuyshort (kk and tholding=0,1,lmt,c+30*MINDIFF);
END
if TISREMAIN(1)<>0 AND pd and tholding2<>0 and tholding=0 then
BEGIN
tcancel(1,0);
END
if TISREMAIN(3)<>0 AND pk and tholding2<>0 and tholding=0 then
BEGIN
tcancel(1,0);
END
if PK and TISREMAIN(0)=0 then BEGIN
tsellshort( tholding<0,0,lmt,DYNAINFO(28));
tbuy(kd and tholding=0,1,lmt,c-30*MINDIFF);
END
if KD and TISREMAIN(0)=0 then BEGIN
tbuy( tholding=0,1,lmt,c-30*MINDIFF);
END
IF pd and TISREMAIN(0)=0 then begin
tsell( tholding>0 ,0,lmt,DYNAINFO(34));
tbuyshort (kk and tholding=0,1,lmt,c+30*MINDIFF);
END
IF KK and TISREMAIN(0)=0 then begin
tbuyshort (tholding=0,1,lmt,c+30*MINDIFF);
end
修改的需求是什么?
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
kd:=K>D and c>o;//开多平空条件
pd:=c<o;
kd1:TISREMAIN(3)<>0 or TISREMAIN(2)<>0;
kk:=k<d and c<o;//开空平多条件
pk:=c>o;
kk1:TISREMAIN(4)<>0 or TISREMAIN(1)<>0;
if kd1 AND kd then
BEGIN
//MSGOUT(1,'kd满足撤单')
tcancel(1,0);
END
if TISREMAIN(1)<>0 AND kk then
BEGIN
//MSGOUT(1,'kk满足撤单')
tcancel(1,0);
END
if TISREMAIN(1)<>0 AND pd then
BEGIN
//MSGOUT(1,'pd满足撤单')
tcancel(1,0);
END
if TISREMAIN(3)<>0 AND pk then
BEGIN
//MSGOUT(1,'pk满足撤单')
tcancel(1,0);
END
if kd and TISREMAIN(0)=0 AND THOLDING<=0 then
BEGIN
tsellshort(1,0,lmt,DYNAINFO(28));
tbuy(1,1,lmt,c-30*MINDIFF);
END
IF kk and TISREMAIN(0)=0 AND THOLDING>=0 then
begin
tsell(1,0,lmt,DYNAINFO(34));
tbuyshort(1,1,lmt,c+30*MINDIFF);
END
//是否是平仓反手完全是依据策略条件来的
//请用户注意下自己的条件以及思路,不能一一对应的话是做不到平仓反手的哦
以上程序模拟运行时
没有平多平空指令
发现持有空单时,发出平空信号时,并不平空
反之也是
IF kk and TISREMAIN(0)=0 AND THOLDING>=0 then
begin
tsell(1,0,lmt,DYNAINFO(34));
tbuyshort(1,1,lmt,c+30*MINDIFF);
END
//在里面加个输出语句,输出下TISREMAIN(0)的值
李老师,将这个放在最后是否可以
if PK and TISREMAIN(0)=0 then BEGIN
tsellshort( tholding<0,0,lmt,DYNAINFO(28));
END
IF pd and TISREMAIN(0)=0 then begin
tsell( tholding>0 ,0,lmt,DYNAINFO(34));
END
这不是单纯的反手指令,
开多开空是一个条件,平多平空又是另一个条件