Rss & SiteMap

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

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

标题:关于反手不开单的问题

1楼
zsg465341578 发表于:2013/11/8 15:52:48
老师你好,下面是我的交易代码示例,其中,平多条件(PD)想表达的意思是:如果开空条件已成立,即使持有多单也马上平多开空(PK亦然),这时候系统就只有平仓,没有开仓,请问是什么原因?

dif:=ema(c,112)-ema(c,26);
dea:=ema(dif,9);
macd:=2*(dif-dea);
cpx:=ma(c,14);
entertime:=time<150000 and time>091600;
exittime:=time>=151400;

//交易条件
kd:=cross(c,cpx) and cpx>ref(cpx,1) and macd>0 and entertime;//开多条件
kk:=cross(cpx,c) and cpx<ref(cpx,1) and  macd<0 and entertime;//开空条件
pd:=(macd<0 and cpx<ref(cpx,1)) or kk or exittime;//平多条件(如果开空条件成立,即使持有多单,马上平多开空
pk:=(macd>0 and cpx>ref(cpx,1)) or kd or exittime;//平空条件(如果开多条件成立,即使持有空单,马上平空开多

//交易系统 
if holding<>0 then begin
   sell(pd,0,limit,c),orderqueue;
   sellshort(pk,0,limit,c),orderqueue;
end

if holding=0 then begin
   buy(kd,1,limit,c),orderqueue;
   buyshort(kk,1,limit,c),orderqueue;
end
共1 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.02734 s, 2 queries.