大伊人青草狠狠久久-大伊香蕉精品视频在线-大伊香蕉精品一区视频在线-大伊香蕉在线精品不卡视频-大伊香蕉在线精品视频75-大伊香蕉在线精品视频人碰人

您現(xiàn)在的位置:程序化交易>> 期貨公式>> 金字塔等>> 金字塔知識>>正文內(nèi)容

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

  • 咨詢內(nèi)容: 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 [此貼子已經(jīng)被作者于2013-5-27 11:07:34編輯過]

     

  • 金字塔客服:

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

    搞好了加精

     

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

     

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

    第一種:'創(chuàng)建了一個窗體,加上一個按鈕來觸發(fā),導(dǎo)入附件后就能使用

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

    '該模塊主要用來保存宏主執(zhí)行主函數(shù),不要拿做他用


    function GetHoldStr(sAccount)'定義所需變量 dim i dim BuyHold dim BuyCost dim SellHold dim SellCost dim CurCode dim CurMarket   On Error resume Next'索取持倉合約數(shù) 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'取得多頭持倉,按照事件返回的手數(shù)和相關(guān)信息進行平多    if BuyHold>0 then      call order.sell(1,BuyHold,0,0,CurCode,CurMarket,sAccount,0)    end if'取得空頭持倉,按照事件返回的手數(shù)和相關(guān)信息進行平空    if SellHold>0 then       call order.sellshort(1,SellHold,0,0,CurCode,CurMarket,sAccount,0)       end if     Next  End If End function
     下載信息  [文件大小:   下載次數(shù): ]點擊瀏覽該文件:userform1.rar



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

    sub application_vbastart()   '設(shè)置定時器,每秒刷新       call application.SetTimer(1,1000)end sub
    sub application_timer(id)    application.MsgOut(right(now,8))    if  id=1 then         '輸入自己要日內(nèi)平倉時間 ,now函數(shù)返回的時間是有日期的 我們用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'索取持倉合約數(shù) 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'取得多頭持倉,按照事件返回的手數(shù)和相關(guān)信息進行平多    if BuyHold>0 then      call order.sell(1,BuyHold,0,0,CurCode,CurMarket,sAccount,0)    end if'取得空頭持倉,按照事件返回的手數(shù)和相關(guān)信息進行平空    if SellHold>0 then       call order.sellshort(1,SellHold,0,0,CurCode,CurMarket,sAccount,0)       end if     Next  End If End function
     下載信息  [文件大小:   下載次數(shù): ]點擊瀏覽該文件:userform2.rar

     

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

 

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

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


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

相關(guān)文章

    沒有相關(guān)內(nèi)容
主站蜘蛛池模板: 欧美综合另类 | 亚洲视频日韩 | 狠狠干夜夜操 | 色综合久久综合欧美综合图片 | 尤物福利在线 | 国产四虎精品 | 国产成人精品久久亚洲高清不卡 | 国产高清一级毛片在线不卡 | 92精品国产成人观看免费 | 视频一区国产精品 | 久久精品一 | 午夜操 | 婷婷在线视频国产综合 | 亚洲欧美色鬼久久综合 | 国产99视频在线观看 | 97碰公开在线观看免费视频 | 中文字幕色婷婷在线视频 | 欧美综合图片 | 欧美日韩综合在线视频免费看 | 天天干狠狠干 | 国产a区| 欧美图片一区二区三区 | 99视频精品国在线视频艾草 | 国产成人一区二区视频在线观看 | 四虎影视在线看免费观看 | 狠狠色噜噜狠狠狠8888米奇 | 四虎资源| 国产成人在线视频观看 | 小视频在线免费观看 | 久久免费区一区二区三波多野 | 激情综合在线观看 | 国产爱视频 | 精品视频香蕉尹人在线 | 老子影院午夜久久亚洲 | 九九精品99久久久香蕉 | 久久国内精品自在自线400部o | 老司机福利深夜亚洲入口 | 天天做人人爱夜夜爽2020毛片 | 91探花在线 | 国产大尺度福利视频在线 | 在线播放精品一区二区啪视频 |