人人爽天天爽夜夜爽qc-人人爽天天爽夜夜爽曰-人人天天爱天天做天天摸-人人天天夜夜-色网站在线-色网站在线看

您現在的位置:程序化交易>> 期貨公式>> 金字塔等>> 金字塔知識>>正文內容

修改了版主代碼,發出全平模塊(增加下信息資源) [金字塔]

  • 咨詢內容: function GetHoldStr(sAccount) dim i dim BuyHold dim BuyCost dim SellHold dim SellCost dim CurCode dim CurMarket   On Error resume Next
     HoldingCount=Order.Holding2(sAccount)  If HoldingCount>0 then   For i=0 to HoldingCount-1    Call Order.HoldingInfo2(i,BuyHolding,BuyCost,BuyTodayHolding,SellHolding,SellCost,SellTodayHolding,PNL,UseMargin,Code,Market,sAccount)    CurCode=Code    CurMarket=Market    BuyHold=BuyHolding    SellHold=SellHolding    HoldStr=HoldStr & CurCode    if BuyHold>0 then      call order.sell(1,BuyHold,0,0,CurCode,CurMarket,sAccount,0)    end if    if SellHold>0 then       call order.sellshort(1,SellHold,0,0,CurCode,CurMarket,sAccount,0)       end if     Next  End If End function [此貼子已經被作者于2013-5-27 11:07:34編輯過]

     

  • 金字塔客服:

    說明詳細一些,另外測試過了?

    搞好了加精

     

  • 用戶回復: 測試過了  稍后加上說明

     

  • 網友回復: '此模塊中sAccount為傳遞賬號,對按照某個時間(比如15:30)平全部倉位的用戶可以直接調用此模塊,用call語句就行。可以直接放在模塊中 '也可以復制代碼到大家做需要的窗體中進行調用。

    第一種:'創建了一個窗體,加上一個按鈕來觸發,導入附件后就能使用

    Sub UserForm1_CommandButton1_Click()'輸入賬號    call getholdstr(803156)    End Sub

    '該模塊主要用來保存宏主執行主函數,不要拿做他用


    function GetHoldStr(sAccount)'定義所需變量 dim i dim BuyHold dim BuyCost dim SellHold dim SellCost dim CurCode dim CurMarket   On Error resume Next'索取持倉合約數 HoldingCount=Order.Holding2(sAccount)'遍歷所有持倉,索取多空頭和持倉合約  If HoldingCount>0 then   For i=0 to HoldingCount-1    Call Order.HoldingInfo2(i,BuyHolding,BuyCost,BuyTodayHolding,SellHolding,SellCost,SellTodayHolding,PNL,UseMargin,Code,Market,sAccount)    CurCode=Code    CurMarket=Market    BuyHold=BuyHolding    SellHold=SellHolding    HoldStr=HoldStr & CurCode'取得多頭持倉,按照事件返回的手數和相關信息進行平多    if BuyHold>0 then      call order.sell(1,BuyHold,0,0,CurCode,CurMarket,sAccount,0)    end if'取得空頭持倉,按照事件返回的手數和相關信息進行平空    if SellHold>0 then       call order.sellshort(1,SellHold,0,0,CurCode,CurMarket,sAccount,0)       end if     Next  End If End function
     下載信息  [文件大小:   下載次數: ]點擊瀏覽該文件:userform1.rar



    第二種 適合用vba做日內的,'大家也可把function函數直接放到大家已經編輯好的代碼中加上定時器來讀取時間  (定時器到收盤15:00進行全平操作)  

    sub application_vbastart()   '設置定時器,每秒刷新       call application.SetTimer(1,1000)end sub
    sub application_timer(id)    application.MsgOut(right(now,8))    if  id=1 then         '輸入自己要日內平倉時間 ,now函數返回的時間是有日期的 我們用right方法去掉日期。就順利取得時分秒,^,^                   if right(now,8)>="13:23:30" then     '輸入自己的賬號               call GetHoldStr(888)                      end if                     end if end sub



    sub application_vbaend()'刪除定時器,釋放資源    call application.KillTimer(1)    end sub
    '插入模塊function GetHoldStr(sAccount)'定義所需變量 dim i dim BuyHold dim BuyCost dim SellHold dim SellCost dim CurCode dim CurMarket   On Error resume Next'索取持倉合約數 HoldingCount=Order.Holding2(sAccount)'遍歷所有持倉,索取多空頭和持倉合約  If HoldingCount>0 then   For i=0 to HoldingCount-1    Call Order.HoldingInfo2(i,BuyHolding,BuyCost,BuyTodayHolding,SellHolding,SellCost,SellTodayHolding,PNL,UseMargin,Code,Market,sAccount)    CurCode=Code    CurMarket=Market    BuyHold=BuyHolding    SellHold=SellHolding    HoldStr=HoldStr & CurCode'取得多頭持倉,按照事件返回的手數和相關信息進行平多    if BuyHold>0 then      call order.sell(1,BuyHold,0,0,CurCode,CurMarket,sAccount,0)    end if'取得空頭持倉,按照事件返回的手數和相關信息進行平空    if SellHold>0 then       call order.sellshort(1,SellHold,0,0,CurCode,CurMarket,sAccount,0)       end if     Next  End If End function
     下載信息  [文件大小:   下載次數: ]點擊瀏覽該文件:userform2.rar

     

  • 網友回復: 看來我那個帖子已經深入人心了,還能做舉一反三,進行修改了,擴展了,本人深感榮幸。希望有更多的人能熟練掌握vba開發。

 

有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友

可聯系技術人員 QQ: 1145508240  有需要幫忙請點擊這里留言!!!進行 有償 編寫!不貴!點擊查看價格!


【字體: 】【打印文章】【查看評論

相關文章

    沒有相關內容
主站蜘蛛池模板: 最新在线鲁丝片eeuss第1页 | 亚洲 午夜在线一区 | 日韩射| 91短视频在线观看免费最新91 | 一级日韩| 免费的性爱视频 | 亚洲伊人成综合人影院小说 | 最近中文字幕高清字幕 | 天天操天天玩 | 久99re视频9在线观看 | 日韩版码免费福利视频 | 久久狠狠干 | 日韩精品无码一区二区三区 | 国产麻豆精品在线观看 | 欧美人成a视频www | 免费人成激情视频在线观看 | 午夜视频在线免费看 | 国产成a人片在线观看视频 国产成人91 | 手机看片国产日韩 | 美女黄色在线 | 国产hd| 在线成人免费观看 | 特级一级毛片 | 欧美怡红院免费的全部视频 | 日韩精品一区二区三区国语自制 | 日本无遮挡亲吻膜下面免费 | 黄网站免费视频 | 成人国产在线观看 | 天天se天天cao | 丝袜足控免费网站 | 新神榜哪吒重生免费高清观看 | 一级做a毛片在线看 | 日韩欧美天堂 | 亚洲妇人成熟性成熟网站 | 欧美性与交视频在线观看 | 在线a毛片免费视频观看 | 夜夜爽66| 午夜影皖普通区 | 国产精品日韩欧美在线 | 欧美一级网址 | 福利视频h |