RSV:= (CLOSE-LLV(LOW,N1))/(HHV(HIGH,N1)-LLV(LOW,N1))*100;
K:=SMA(RSV,M1,1);
D:=SMA(K,M2,1);
J:=3*K-2*D;
cond1:=CROSS(K,D);//开多条件
cond2:=CROSS(D,K);//开空条件
tbuy(time=090100,100,lmt,o,0);
tbuyshort(time=090100,100,lmt,o,0);
tsell(cond1,10,mkt);
tsellshort(cond2,10,mkt);
1)若其中有单子没有成交,撤单并且以市价平掉这笔单子。
2)当持仓为0时,在继续重复第一次开多开空同等数量。继续执行程序。
这样编写对否?
还有后台使用ORDERQUEUE可以否?
if TISREMAIN(0)>0 then begin
tsell(TCANCEL(1,0),10,mkt);
tsellshort(TCANCEL(1,0),10,mkt);
End
if THOLDING2=0 then begin
tbuy(CURRENTTIME,100,lmt,O,0);
tbuyshort(CURRENTTIME,100,lmt,O,0);
End
tsell(cond1,10,mkt);
tsellshort(cond2,10,mkt);
if CURRENTTIME=145800 then
tsell(1,0,mkt);
tsellshort(1,0,mkt);
1.单子没成交那你应该是撤单而不是平仓啊,你没成交哪里能够平单子
if tisremain(0)>0 then
tcancel(1,0);
end
2. orderqueue可以用在后台
3. 时间判断时,用time可以用=判断,可以time=090100;
但是用currenttime,你需要用一个时间段来控制,比如这样 currenttime>145800 and currenttime<=145900
tsellshort(cond2,10,mkt);
if CURRENTTIME=145800 then
tsell(1,0,mkt);
tsellshort(1,0,mkt);
这样可以了吗? 老大