以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  后台编写问题请教  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=64549)

--  作者:系统使用者
--  发布时间:2014/4/30 12:25:47
--  后台编写问题请教

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);


--  作者:系统使用者
--  发布时间:2014/4/30 12:28:20
--  
若编写错误,应该如何编写请赐教,谢谢
--  作者:jinzhe
--  发布时间:2014/4/30 13:28:33
--  

1.单子没成交那你应该是撤单而不是平仓啊,你没成交哪里能够平单子

if tisremain(0)>0 then

   tcancel(1,0);

end

 

2. orderqueue可以用在后台

 

 

3. 时间判断时,用time可以用=判断,可以time=090100;

但是用currenttime,你需要用一个时间段来控制,比如这样 currenttime>145800 and currenttime<=145900

 


--  作者:系统使用者
--  发布时间:2014/4/30 21:39:57
--  
 if tisremain(0)>0 then begin
   tcancel(0,0);
   tsell(1,10,mkt);
   tsellshort(1,10,mkt);
end
 if tisremain(0)>0 then begin
   tcancel(0,0);
   tsell(1,10,mkt);
   tsellshort(1,10,mkt);
end

if THOLDING2=0 and currenttime>144000 then begin
tbuy(1,100,lmt,O,0);
tbuyshort(1,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);


这样可以了吗? 老大


--  作者:系统使用者
--  发布时间:2014/5/3 22:46:17
--  
这样可以了吗?
--  作者:jinzhe
--  发布时间:2014/5/4 10:11:30
--  
if tisremain(0)>0 then begin
   tcancel(0,0);
end

tsell(cond1,10,mkt);

tsellshort(cond2,10,mkt);


if CURRENTTIME>=145800 and currenttime<=145900 then
tsell(1,0,mkt);
tsellshort(1,0,mkt);

end