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

期货期权交流percenttrailing止盈语句,如何按at market方式下单

作者:MC 来源:cxh99.com 发布时间:2017年08月07日
  • 咨询内容: percenttrailing止盈语句代码如下:

    [IntrabarOrderGeneration=true];
    input:target(10),Percent(30);//,BS(NumericSimple);

    vars:intrabarpersist mp(0),intrabarpersist flagB(0),intrabarpersist flagS(0), intrabarpersist valueh(0),intrabarpersist valuel(999999);

    once cleardebug;
    mp=marketposition;
    if mp<>mp[1] then
    begin
            valueh=0;
            valuel=999999;
            flagb=0;
            flags=0;
    end;

    if mp>0 and valueh<=h then
    valueh=h;

    if mp<0 and valuel>=l then
    valuel=l;

    if (mp>0 and valueh-entryprice>target) then
    flagB=1;
    if mp<0 and entryprice-valuel>target then
    flags=1;


    if mp=1 and flagB=1 then
    sell("L_trailing") next bar at valueh-Percent*(valueh-entryprice)/100 stop;


    if mp=-1 and flagS=1 then
    buytocover("S_trailing") next bar at  valuel+percent*(entryprice-valuel)/100 stop;


    我在实际使用时遇到了一个情况:市场价格变动太快,导致止盈指令发出后没有成交。
    我的诉求是用at market的方式下单,请问老师应该如何改动上述语句才能达到目的,谢谢!



     

  • MC技术部: 把stop单的发单价格做成条件判断,最后交易语句写成市价
打印本文打印本文 关闭窗口关闭窗口