您現(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編輯過]

     

  • 金字塔客服:

    說明詳細(xì)一些,另外測試過了?

    搞好了加精

     

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

     

  • 網(wǎng)友回復(fù): '此模塊中sAccount為傳遞賬號,對按照某個時間(比如15:30)平全部倉位的用戶可以直接調(diào)用此模塊,用call語句就行??梢灾苯臃旁谀K中 '也可以復(fù)制代碼到大家做需要的窗體中進(jìn)行調(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'取得多頭持倉,按照事件返回的手?jǐn)?shù)和相關(guān)信息進(jìn)行平多    if BuyHold>0 then      call order.sell(1,BuyHold,0,0,CurCode,CurMarket,sAccount,0)    end if'取得空頭持倉,按照事件返回的手?jǐn)?shù)和相關(guān)信息進(jìn)行平空    if SellHold>0 then       call order.sellshort(1,SellHold,0,0,CurCode,CurMarket,sAccount,0)       end if     Next  End If End function
     下載信息  [文件大?。?nbsp;  下載次數(shù): ]點擊瀏覽該文件:userform1.rar



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

    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'取得多頭持倉,按照事件返回的手?jǐn)?shù)和相關(guān)信息進(jìn)行平多    if BuyHold>0 then      call order.sell(1,BuyHold,0,0,CurCode,CurMarket,sAccount,0)    end if'取得空頭持倉,按照事件返回的手?jǐn)?shù)和相關(guān)信息進(jì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)深入人心了,還能做舉一反三,進(jìn)行修改了,擴(kuò)展了,本人深感榮幸。希望有更多的人能熟練掌握vba開發(fā)。

 

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

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


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

相關(guān)文章

    沒有相關(guān)內(nèi)容
主站蜘蛛池模板: 国产精品一区二区三乱码| 欧美人与动人物牲交免费观看| 国产男女猛烈无遮挡免费网站| 一区二区三区欧美日韩国产| 欧美一级欧美一级高清| 免费一级特黄欧美大片勹久久网 | 午夜在线观看视频免费成人| 欧美一级特黄乱妇高清视频| 女人扒开腿让男人捅| 久久久青草青青国产亚洲免观| 欧美成人免费一区二区| 免费永久看黄在线观看app| 豆奶视频最新官网| 国产精品国产欧美综合一区| www.嫩草影院| 无翼乌口工全彩无遮挡里 | 97碰在线视频| 国产视频福利在线| 一本大道久久a久久精品综合| 日本道精品一区二区三区| 亚洲国产精品无码久久一线| 看Aⅴ免费毛片手机播放| 国产乱子伦片免费观看中字| 亚洲伊人久久网| 国内精品国语自产拍在线观看55 | 中国女人一级毛片| 日韩一区精品视频一区二区| 亚洲日本一区二区一本一道| 男人边吃奶边爱边做视频刺激| 国产FREEXXXX性麻豆| 黄页网址免费大全观看| 国产精品无码专区在线播放 | 四虎精品成人免费影视| 国产91小视频| 国产精品爽爽va在线观看无码| avtt天堂网久久精品| 少妇高潮太爽了在线视频| 久久er这里只有精品| 日韩欧美精品综合一区二区三区| 亚洲成人激情小说| 特级aaaaaaaaa毛片免费视频 |