您现在的位置:程序化交易>> 期货公式>> 金字塔等>> 金字塔知识>>正文内容

为什么用自己写的窗口下单,会弹出确认框? [金字塔]

  • 咨询内容: 请教 为什么用自己写的窗口下单,会弹出确认框?
    昨天还没有,今天改了几句代码就这样

    此主题相关图片如下:13.jpg

     

  • 金字塔客服:

    if not hangqing is nothing then

             ctp=Order.StockType(symbol,matketID)
             if ctp=1 then
                strDate = Cstr(hangqing.Date)
                'test_tuoke_Label5.caption = strDate
                
                dim num
        dim orderid
        dim ConSign
        dim Filled
        dim R1
        dim Action
        dim OrderType
        dim LmtPrice
        dim Account
        dim Kaiping
        num = Order.OrderInfoByCode2(hangqing.Label,hangqing.marketName, orderid, ConSign, Filled, R1, Action, OrderType, LmtPrice, Account, Kaiping)
        application.MsgOut num
        if num > 1 then
         if lastOrderID = orderid then
          CancelCount = CancelCount + 1
         else
          CancelCount = 0
          lastOrderID = orderid
         end if
         if (CancelCount > 2) then
          call Document.DebugFile("D:\OrderLog.Txt", "CancelOrder:%.2f",orderid )
          call Order.CancelOrder(orderid)
          CancelCount = 0
         end if
        end if
             
                if CountIndex > 5 then
                 dim BuyHoding
         dim BuyTodayHoding
         dim SellHoding
         dim SellTodayHoding
         dim BuyCost
         dim SellCost
         dim PNL
         Dim UseMargin
                 call Order.HoldingInfoByCode2(hangqing.label,hangqing.marketname,BuyHoding,BuyCost,BuyTodayHoding,SellHoding,SellCost,SellTodayHoding,PNL,UseMargin)
                 if BuyHoding > 0 then
                  application.MsgOut  hangqing.LowerLimitPrice
                  application.MsgOut  hangqing.NewPrice
                  msg = "Sell= " & hangqing.LowerLimitPrice
                  msg = msg & "  BuyHoding=" & BuyHoding
                  msg = msg & "  num= " & num
                  call Document.DebugFile("D:\OrderLog.Txt", msg,1)
                  call Order.Sell(0,BuyHoding,hangqing.LowerLimitPrice,0,hangqing.label,hangqing.marketname,"",0)
                  CountIndex = 0
                  
                 end if
                end if
                txt = " Buy= " & hangqing.UpperLimitPrice
                call Document.DebugFile("D:\OrderLog.Txt", txt, 1)
                call Order.Buy(0,lots,hangqing.UpperLimitPrice,0,hangqing.label,hangqing.marketname,"",0)
                CountIndex = CountIndex + 1
                
             elseif ctp=0 then
              msgbox "IB账户不支持交易"
       end if
       
      end if  

     

  • 用户回复: if not hangqing is nothing then
       'test_tuoke_Label1.caption = hangqing.NewPrice
             ctp=Order.StockType(symbol,matketID)
             if ctp=1 then
                strDate = Cstr(hangqing.Date)
                'test_tuoke_Label5.caption = strDate
               
                'dim num
        'dim orderid
        'dim ConSign
        'dim Filled
        'dim R1
        'dim Action
        'dim OrderType
        'dim LmtPrice
        'dim Account
        'dim Kaiping
        'num = Order.OrderInfoByCode2(hangqing.Label,hangqing.marketName, orderid, ConSign, Filled, R1, Action, OrderType, LmtPrice, Account, Kaiping)
        'if num > 1 then
         'if lastOrderID = orderid then
          'CancelCount = CancelCount + 1
         'else
          'CancelCount = 0
          'lastOrderID = orderid
         'end if
         'if (CancelCount > 2) then
          'call Document.DebugFile("D:\OrderLog.Txt", "CancelOrder:%.2f",orderid )
          'call Order.CancelOrder(orderid)
          'CancelCount = 0
         'end if
        'end if
             
                if CountIndex > 5 then
                 dim BuyHoding
         dim BuyTodayHoding
         dim SellHoding
         dim SellTodayHoding
         dim BuyCost
         dim SellCost
         dim PNL
         Dim UseMargin
                 call Order.HoldingInfoByCode2(hangqing.label,hangqing.marketname,BuyHoding,BuyCost,BuyTodayHoding,SellHoding,SellCost,SellTodayHoding,PNL,UseMargin)
                 if SellHoding > 0 then
                  application.MsgOut  hangqing.UpperLimitPrice
                  application.MsgOut  hangqing.NewPrice
                  msg = "SellShort= " & hangqing.UpperLimitPrice
                  msg = msg & "  SellHoding=" & SellHoding
                  msg = msg & "  num= " & num
                  call Document.DebugFile("D:\OrderLog.Txt", msg,0)
                  call Order.SellShort(0,SellHoding,hangqing.UpperLimitPrice,0,hangqing.label,hangqing.marketname,"",1)
                  'msgbox hangqing.UpperLimitPrice
                  'msgbox SellHoding
                  CountIndex = 0 
                 end if
                end if
                txt = " BuyShort= " & hangqing.NewPrice
                call Document.DebugFile("D:\OrderLog.Txt", txt, 0)
                call Order.BuyShort(0,lots,hangqing.NewPrice,0,hangqing.label,hangqing.marketname,"",1)
                CountIndex = CountIndex + 1
                
             elseif ctp=0 then
              msgbox "IB账户不支持交易"
       end if
      end if

     

  • 网友回复:

    2楼的代码直接下单,3楼的代码就会弹出一楼的提示。

    是在搞不懂这连个代码有什么区别。

    注销部分是撤单的部分,应该不影响。

     

  • 网友回复: 非交易时段下单时,就是会弹出对话框的,因为需要对话框弹出让你来调整预埋单还有价格

 

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

可联系技术人员 QQ: 1145508240  有需要帮忙请点击这里留言!!!进行 有偿 编写!不贵!点击查看价格!


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

相关文章

    没有相关内容