以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://www.weistock.com/bbs/index.asp)
--  高级功能研发区  (http://www.weistock.com/bbs/list.asp?boardid=5)
----  为什么用自己写的窗口下单,会弹出确认框?  (http://www.weistock.com/bbs/dispbbs.asp?boardid=5&id=55909)

--  作者:qq代人发帖
--  发布时间:2013/8/29 10:04:56
--  为什么用自己写的窗口下单,会弹出确认框?
请教
为什么用自己写的窗口下单,会弹出确认框?
昨天还没有,今天改了几句代码就这样

图片点击可在新窗口打开查看此主题相关图片如下:13.jpg
图片点击可在新窗口打开查看

--  作者:jingcha
--  发布时间:2013/8/29 10:57:57
--  

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  


--  作者:jingcha
--  发布时间:2013/8/29 10:58:18
--  
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

--  作者:jingcha
--  发布时间:2013/8/29 10:59:46
--  

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

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

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


--  作者:王锋
--  发布时间:2013/8/29 11:22:48
--  
非交易时段下单时,就是会弹出对话框的,因为需要对话框弹出让你来调整预埋单还有价格
--  作者:jingcha
--  发布时间:2013/8/29 11:24:20
--  

这个和交易时段没关系,两段代码今天一直是这个情况。


--  作者:王锋
--  发布时间:2013/8/29 11:34:30
--  

Buy 方法

开多操作

Buy(Type,Vol,Price,StoplmtPrice,Code,Market,AccountID,Valid)

Type            委托类型,分别可为 0限价 1市价 2停损 3限价停损

Vol               委托数量

Price           委托价格,当Type为2和3时为停损价格

StoplmtPrice    停损限价,当Type为3时必须指定停损限价

Code            品种代码,如 "600215"

Market          品种市场,如"SH"表示上海市场

AccountID       指定帐户,为空表示当前帐户

Valid           为1表示下单时弹出确认对话框,为0表示直接下单到服务器


--  作者:jingcha
--  发布时间:2013/8/29 13:24:22
--  

谢谢!看到了。