Rss & SiteMap

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

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

标题:请教一下

1楼
sun884588 发表于:2012/5/11 13:53:59

问题是这样的,我希望在后台完成套利

 

bb 和ss 分别是触发条件

 

if bb  then begin

    tsellshort(1,1,lmt,远期卖一+3,0,'802089','zjif09'),orderqueue;
    tsell(1,1,lmt,近期买一-3,0,'802089','zjif05'),orderqueue;
    tbuy(1,1,lmt,远期卖一+3,0,'802089','zjif09'),orderqueue;
    tbuyshort(1,1,lmt,近期买一-3,0,'802089','zjif05'),orderqueue;
   
  end

if ss  then begin

    tsell(1,1,lmt,远期买一-3,0,'802089','zjif09'),orderqueue;
   
    tsellshort(1,1,lmt,近期卖一+3,0,'802089','zjif05'),orderqueue;
   
    tbuyshort(1,1,lmt,远期买一-3,0,'802089','zjif09'),orderqueue;
   
    tbuy(1,1,lmt,近期卖一+3,0,'802089','zjif05'),orderqueue;
   
  end

 

 

即bb触发后,就执行bb的4个语句,反之在ss触发之后完成ss的4步动作。

 

现在这样情况下bb和ss的动作都是正常,也就是说条件本身是可以出现交易的。

但是我希望bb之后出现的bb 不再出现动作,即bb之后,4步工作完成后,不动作,一直等到ss出现再进行ss的动作。

ss同理,即ss出现后再出现的ss不动作,直到bb出现再工作。简单的说就是再后台使用类似tfilter函数的功能。

 

 

 

为了完成进行如下设计:

variable:a:=0;

if a>0 and ss then begin
    tsellshort(1,1,lmt,远期卖一+3,0,'802089','zjif09'),orderqueue;
    tsell(1,1,lmt,近期买一-3,0,'802089','zjif05'),orderqueue;
    a:=0;
 end
 
 if a<0 and bb then begin
    tsell(1,1,lmt,远期买一-3,0,'802089','zjif09'),orderqueue;
   
    tsellshort(1,1,lmt,近期卖一+3,0,'802089','zjif05'),orderqueue;
 
    a:=0;
 end
 
 
  if a=0 and bb then begin
    tbuy(1,1,lmt,远期卖一+3,0,'802089','zjif09'),orderqueue;
    tbuyshort(1,1,lmt,近期买一-3,0,'802089','zjif05'),orderqueue;
    a:=1;
 end

 if a=0 and ss then begin
   tbuyshort(1,1,lmt,远期买一-3,0,'802089','zjif09'),orderqueue;
   
    tbuy(1,1,lmt,近期卖一+3,0,'802089','zjif05'),orderqueue;
    a:=-1;
 end

 

 

即通过全局变量希望起到过滤作用。遗憾的是,它完全不工作的。我也不知道错在哪里请大家帮忙看看。哪里写的不对?

 

谢谢!!!

[此贴子已经被作者于2012-5-11 13:54:19编辑过]
2楼
just 发表于:2012/5/11 14:01:10

variable:a1=0,a2=0;

if bb and a1=0 then begin

    tsellshort(1,1,lmt,远期卖一+3,0,'802089','zjif09'),orderqueue;
    tsell(1,1,lmt,近期买一-3,0,'802089','zjif05'),orderqueue;
    tbuy(1,1,lmt,远期卖一+3,0,'802089','zjif09'),orderqueue;
    tbuyshort(1,1,lmt,近期买一-3,0,'802089','zjif05'),orderqueue;
   a1:=1;
  end

if ss and a2=0 then begin

    tsell(1,1,lmt,远期买一-3,0,'802089','zjif09'),orderqueue;
   
    tsellshort(1,1,lmt,近期卖一+3,0,'802089','zjif05'),orderqueue;
   
    tbuyshort(1,1,lmt,远期买一-3,0,'802089','zjif09'),orderqueue;
   
    tbuy(1,1,lmt,近期卖一+3,0,'802089','zjif05'),orderqueue;
    
a2:=1;
  end

 

3楼
sun884588 发表于:2012/5/11 14:09:13
黑侠感谢你的回复。目前在测试您的代码。

if bb and a1=0 then begin

a1:=1;

 

之后a1就是1了,再碰到bb还会执行吗???

4楼
sun884588 发表于:2012/5/11 14:11:13

刚才看了,出交易动作了,但是黑侠的代码也没有执行。我晕

 

5楼
just 发表于:2012/5/11 14:25:30
你把你的条件代码贴出来 我帮你看看。
6楼
sun884588 发表于:2012/5/11 15:01:15

估计是我自己写反了

周一再看看,谢谢你的回复

7楼
just 发表于:2012/5/11 15:03:27


bb:=count(c>o,2)=2;
ss:=count(c<o,2)=2;

if bb  then begin

    tsellshort(tholding>0,1,lmt,c,0,'800309','zjif09'),orderqueue;
    tsell(tholding>0,1,lmt,c,0,'800309','zjif05'),orderqueue;
    tbuy(tholding=0,1,lmt,c,0,'800309','zjif09'),orderqueue;
    tbuyshort(tholding=0,1,lmt,c,0,'800309','zjif05'),orderqueue;

  end

if ss  then begin

    tsell(tholding>0,1,lmt,c,0,'800309','zjif09'),orderqueue;
   
    tsellshort(tholding>0,1,lmt,c,0,'800309','zjif05'),orderqueue;
   
    tbuyshort(tholding=0,1,lmt,c,0,'800309','zjif09'),orderqueue;
   
    tbuy(tholding=0,1,lmt,c,0,'800309','zjif05'),orderqueue;

  end

 

共7 条记录, 每页显示 10 条, 页签: [1]


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