Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共4 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:后台程序化一些问题

1楼
a383623133 发表于:2016/4/7 14:22:13
后台程序化运行时平仓的同时不会开仓,代码如下:急

jx:MA(C,30);

a:=(time>010000 and time<=045500 )  or (time>130000 and time<=152500) or (time>173000 and time<=185500);

KK:=cross(jx,c) and a;          //开空条件
PK:=cross(c,jx) ;          //平空条件
KD:=cross(c,jx) and a;          //开多条件
PD:=cross(jx,c) ;          //平多条件

平空:tSELLSHORT(PK,0,lmt,close);                  //平空信号
开多:tBUY(KD AND tbuyHOLDING(0)=0 and  tsellHOLDING(0)=0,10,lmt,close);          //开多信号
平多:tSELL(PD,0,lmt,close);                       //平多信号
开空:tBUYSHORT(KK AND tsellHOLDING(0)=0 and tbuyHOLDING(0)=0,10,lmt,close);     //开空信号
平多2:tSELL(tOPENPROFIT<-1000,0,mkt);  
平空2:tSELLSHORT(tOPENPROFIT<-1000,0,mkt);
if (time>045800 and time<=050000) or (time>152800 and time<=160000) or (time>185800 and time<=190000) then begin
   tsell(1,0,mkt);
   tsellshort(1,0,mkt);
end

2楼
jinzhe 发表于:2016/4/7 14:27:06
因为有持仓判断的,所以用顺序下单试试看
平空:tSELLSHORT(PK,0,lmt,close),orderqueue;                  //平空信号
开多:tBUY(KD AND tbuyHOLDING(0)=0 and  tsellHOLDING(0)=0,10,lmt,close),orderqueue;          //开多信号
平多:tSELL(PD,0,lmt,close),orderqueue;                       //平多信号
开空:tBUYSHORT(KK AND tsellHOLDING(0)=0 and tbuyHOLDING(0)=0,10,lmt,close),orderqueue;     //开空信号
平多2:tSELL(tOPENPROFIT<-1000,0,mkt),orderqueue;  
平空2:tSELLSHORT(tOPENPROFIT<-1000,0,mkt),orderqueue;
if (time>045800 and time<=050000) or (time>152800 and time<=160000) or (time>185800 and time<=190000) then begin
   tsell(1,0,mkt),orderqueue;
   tsellshort(1,0,mkt),orderqueue;
end
3楼
a383623133 发表于:2016/4/7 14:31:13
顺序下单是不是先平仓成交了才发开仓委托?还是平仓跟开仓同时发出?
4楼
jinzhe 发表于:2016/4/7 14:40:48

先成交之后,再发后面的单子,避免没成交导致持仓判断出错,再加一个sleep1秒,这样有充足时间去接收成交回报了

这个公式绝对不能用逐k线模式,一定要用序列模式

 

平空:tSELLSHORT(PK,0,lmt,close),orderqueue;                  //平空信号
sleep(1000);
开多:tBUY(KD AND tbuyHOLDING(0)=0 and  tsellHOLDING(0)=0,10,lmt,close),orderqueue;          //开多信号
sleep(1000);
平多:tSELL(PD,0,lmt,close),orderqueue;                       //平多信号
sleep(1000);
开空:tBUYSHORT(KK AND tsellHOLDING(0)=0 and tbuyHOLDING(0)=0,10,lmt,close),orderqueue;     //开空信号
平多2:tSELL(tOPENPROFIT<-1000,0,mkt),orderqueue;  
平空2:tSELLSHORT(tOPENPROFIT<-1000,0,mkt),orderqueue;
if (time>045800 and time<=050000) or (time>152800 and time<=160000) or (time>185800 and time<=190000) then begin
   tsell(1,0,mkt),orderqueue;
   tsellshort(1,0,mkt),orderqueue;
end
共4 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.01685 s, 3 queries.