您现在的位置:程序化交易>> 期货公式>> 交易开拓者(TB)>> 开拓者知识>>正文内容

帮忙看下这有一段撤单指令的编写问题 [开拓者 TB]

  • 咨询内容: 本帖最后由 fushengchenken 于 2016-1-29 16:02 编辑

    这段程序代码是在1分钟的K线上运行的平仓指令,请帮我看下这段撤单和从新平仓的指令的问题

    If(A_TotalPosition>0 And A_GetOpenOrderCount!=0)
    {
      A_DeleteOrder();
      MyExitDelete=MyExitDelete+1;
      SetGlobalVar(14,MyExitDelete);
      If(MyExitDelete>0)
      {
      A_SendOrder(Enum_Sell,Enum_Exit,A_BuyPosition(),Close-ExitSlippage*MinMove*PriceScale);
      MyBuyExit=MyBuyExit+1;
      SetGlobalVar(8,MyBuyExit);
      MyExitTime=Time;
      SetGlobalVar(11,MyExitTime);
      }
      If(A_GetLastOpenOrderIndex(Enum_Sell,Enum_Exit)==InvalidInteger)
      {
      MyEntryTime=0;
      SetGlobalVar(10,MyEntryTime);
      }
    }

    我想实现的目标是:
    1.一但有多单持仓并且有未成交的多单就立刻撤单,并将 MyExitDelete+1做为全局变量做一个记录。
    2.如果一但有过一次撤单以后立刻再次平仓多单,并且用A_GetLastOpenOrderIndex(Enum_Buy,Enum_Exit)==InvalidInteger指令来判断平仓指令是否成功。一旦确认平仓成功了,再将MyEntryTime清0.
    3.我要让这个指令重复运行,以达到不断的平仓撤单,再平仓再撤单直到平仓成功,这样一个效果。

    目前遇到一些始终解决不掉,又找不到问题的原因的地方,希望TB的技术人员帮忙看看:
    问题1:我咨询过你们TB的服务人员,他们告诉我TB的运行机制是会在一分钟的K线的最后一个TICK合并下一个1分钟的K线合并计算?我不知道这个叙述清楚没有。这里面有个问题我下面截取一张图表来咨询。遇到的问题是为什么在账户都完全没有持仓的情况下,程序总会在每个1分钟的最后一个TICK上面撤单一次?(见下图1红色加粗数据)

    问题2:
    QQ截图20160129143856.png (6.58 KB, 下载次数: 0) 2016-1-29 14:38:41 上传

     

  • TB技术人员: 图1见红色加粗部分
    Time=0.1124 MyTimeSecondValue=58 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
    Time=0.1124 MyTimeSecondValue=58 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
    Time=0.1124 MyTimeSecondValue=0 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=1 MySellExit=0 MyExitTime=0.1124 MyExitDelete=1 Date=2016-01-29

     

  • TB客服:
    图1见红色加粗部分
    Time=0.1125 MyTimeSecondValue=57 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
    Time=0.1125 MyTimeSecondValue=57 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
    Time=0.1125 MyTimeSecondValue=58 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
    Time=0.1125 MyTimeSecondValue=58 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
    Time=0.1125 MyTimeSecondValue=59 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
    Time=0.1125 MyTimeSecondValue=59 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=1 MySellExit=0 MyExitTime=0.1125 MyExitDelete=1 Date=2016-01-29

     

  • 网友回复: 图1见红色加粗部分
    Time=0.1126 MyTimeSecondValue=53 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
    Time=0.1126 MyTimeSecondValue=54 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
    Time=0.1126 MyTimeSecondValue=55 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
    Time=0.1126 MyTimeSecondValue=56 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
    Time=0.1126 MyTimeSecondValue=58 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
    Time=0.1126 MyTimeSecondValue=59 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=1 MySellExit=0 MyExitTime=0.1126 MyExitDelete=1 Date=2016-01-29

     

  • 网友回复: 本帖最后由 fushengchenken 于 2016-2-1 11:05 编辑

    图2见红色加粗部分
    Time=0.1333 MyTimeSecondValue=31 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
    Time=0.1333 MyTimeSecondValue=31 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
    Time=0.1333 MyTimeSecondValue=31 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
    Time=0.1333 MyTimeSecondValue=32 MyBuyEntry=0 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
    Time=0.1333 MyTimeSecondValue=32 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0.1333 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
    Time=0.1333 MyTimeSecondValue=33 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0.1333 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
    Time=0.1333 MyTimeSecondValue=33 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0.1333 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
    Time=0.1333 MyTimeSecondValue=34 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0.1333 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
    Time=0.1333 MyTimeSecondValue=35 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0.1333 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
    Time=0.1333 MyTimeSecondValue=35 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0.1333 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
    Time=0.1333 MyTimeSecondValue=36 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0.1333 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
    Time=0.1333 MyTimeSecondValue=36 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0.1333 MyEntryDelete=0 MyBuyExit=0 MySellExit=0 MyExitTime=0 MyExitDelete=0 Date=2016-01-29
    Time=0.1333 MyTimeSecondValue=37 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=1 MySellExit=0 MyExitTime=0.1333 MyExitDelete=0 Date=2016-01-29
    Time=0.1333 MyTimeSecondValue=38 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=2 MySellExit=0 MyExitTime=0.1333 MyExitDelete=1 Date=2016-01-29

    Time=0.1333 MyTimeSecondValue=39 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=2 MySellExit=0 MyExitTime=0.1333 MyExitDelete=1 Date=2016-01-29
    Time=0.1333 MyTimeSecondValue=39 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=2 MySellExit=0 MyExitTime=0.1333 MyExitDelete=1 Date=2016-01-29
    Time=0.1333 MyTimeSecondValue=40 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=2 MySellExit=0 MyExitTime=0.1333 MyExitDelete=1 Date=2016-01-29
    Time=0.1333 MyTimeSecondValue=41 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=2 MySellExit=0 MyExitTime=0.1333 MyExitDelete=1 Date=2016-01-29
    Time=0.1333 MyTimeSecondValue=41 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=2 MySellExit=0 MyExitTime=0.1333 MyExitDelete=1 Date=2016-01-29
    Time=0.1333 MyTimeSecondValue=44 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=2 MySellExit=0 MyExitTime=0.1333 MyExitDelete=1 Date=2016-01-29
    Time=0.1333 MyTimeSecondValue=46 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=2 MySellExit=0 MyExitTime=0.1333 MyExitDelete=1 Date=2016-01-29
    Time=0.1333 MyTimeSecondValue=46 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=2 MySellExit=0 MyExitTime=0.1333 MyExitDelete=1 Date=2016-01-29
    Time=0.1333 MyTimeSecondValue=47 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=2 MySellExit=0 MyExitTime=0.1333 MyExitDelete=1 Date=2016-01-29
    Time=0.1333 MyTimeSecondValue=48 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=2 MySellExit=0 MyExitTime=0.1333 MyExitDelete=1 Date=2016-01-29
    Time=0.1333 MyTimeSecondValue=49 MyBuyEntry=1 MySellEntry=0 MyEntryTime=0 MyEntryDelete=0 MyBuyExit=2 MySellExit=0 MyExitTime=0.1333 MyExitDelete=1 Date=2016-01-29

 

有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友

可联系技术人员 QQ: 511411198  点击这里给我发消息进行 有偿 编写!不贵!点击查看价格!


【字体: 】【打印文章】【查看评论

相关文章

    没有相关内容