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

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

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

  • 咨詢(xún)內(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編輯過(guò)]

     

  • 金字塔客服:

    說(shuō)明詳細(xì)一些,另外測(cè)試過(guò)了?

    搞好了加精

     

  • 用戶(hù)回復(fù): 測(cè)試過(guò)了  稍后加上說(shuō)明

     

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

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

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

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


    function GetHoldStr(sAccount)'定義所需變量 dim i dim BuyHold dim BuyCost dim SellHold dim SellCost dim CurCode dim CurMarket   On Error resume Next'索取持倉(cāng)合約數(shù) HoldingCount=Order.Holding2(sAccount)'遍歷所有持倉(cāng),索取多空頭和持倉(cāng)合約  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'取得多頭持倉(cāng),按照事件返回的手?jǐn)?shù)和相關(guān)信息進(jìn)行平多    if BuyHold>0 then      call order.sell(1,BuyHold,0,0,CurCode,CurMarket,sAccount,0)    end if'取得空頭持倉(cāng),按照事件返回的手?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ù): ]點(diǎn)擊瀏覽該文件:userform1.rar



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

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



    sub application_vbaend()'刪除定時(shí)器,釋放資源    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'索取持倉(cāng)合約數(shù) HoldingCount=Order.Holding2(sAccount)'遍歷所有持倉(cāng),索取多空頭和持倉(cāng)合約  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'取得多頭持倉(cāng),按照事件返回的手?jǐn)?shù)和相關(guān)信息進(jìn)行平多    if BuyHold>0 then      call order.sell(1,BuyHold,0,0,CurCode,CurMarket,sAccount,0)    end if'取得空頭持倉(cāng),按照事件返回的手?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ù): ]點(diǎn)擊瀏覽該文件:userform2.rar

     

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

 

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

可聯(lián)系技術(shù)人員 QQ: 1145508240  有需要幫忙請(qǐng)點(diǎn)擊這里留言!!!進(jìn)行 有償 編寫(xiě)!不貴!點(diǎn)擊查看價(jià)格!


【字體: 】【打印文章】【查看評(píng)論

相關(guān)文章

    沒(méi)有相關(guān)內(nèi)容
主站蜘蛛池模板: 91小鲜肉| 国产高清精品自在久久 | 国产人妖性一区二区 | 黄网站视频在线观看 | 欧美视频在线播放 | 亚洲影视一区 | 亚洲国产日韩欧美综合久久 | 大学生一级毛片全黄真人 | 日本道在线播放 | 国产午夜精品鲁丝片 | 午夜三级福利 | 国产大片线上免费观看 | 日本高清中文字幕在线观穿线视频 | 日本在线不卡免费 | 91香蕉国产线观看免 | 久久久国产成人精品 | 夜夜操狠狠操 | 亚洲成人精品在线 | 91短视频版高清在线观看免费 | 最近新中文字幕大全高清 | 国产日产综合 | 国产色手机在线观看播放 | 成年人在线视频观看 | 另类免费视频 | 成人短视频在线 | 国产成人久久精品激情91 | 98在线视频噜噜噜国产 | 国产成人精品免费大全 | 99精品全国免费7观看视频 | 最近中文字幕在线播放 | 婷婷黄色网 | 亚欧日韩毛片在线看免费网站 | 91av中文| 欧美一级片免费在线观看 | np多肉高h被强 | av毛片在线看 | 日本亚洲欧美美色 | 手机在线观看你懂得 | 小明永久视频免费播放 | 婷婷激情狠狠综合五月 | 免费一级特黄欧美大片久久网 |