打印本文打印本文 关闭窗口关闭窗口

后台编写问题请教

作者:金字塔 来源:cxh99.com 发布时间:2014年11月04日
  • 咨询内容:

    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

     

     

  • 网友回复:  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 begintbuy(1,100,lmt,O,0);tbuyshort(1,100,lmt,O,0);Endtsell(cond1,10,mkt);

    tsellshort(cond2,10,mkt);


    if CURRENTTIME=145800 then
    tsell(1,0,mkt);
    tsellshort(1,0,mkt);


    这样可以了吗? 老大

     

  • 网友回复: 这样可以了吗?
打印本文打印本文 关闭窗口关闭窗口