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

怎樣用VBS實現指定賬戶權益低于90萬時強行平倉? [金字塔]

  • 咨詢內容:

    如題

     

  • 金字塔客服:

    樓主可以打開幫助參考下VBA中的Order對象

    另外軟件內下單設置——止盈止損中中也是可以設置的

     

  • 用戶回復:

     

  • 網友回復:

    使用VBA編寫的代碼量較大,在此無法給你編寫完整的,給出你一個實現的想法思路

     

    1、你應該了解金字塔VBA的定時器功能,定期1秒檢測帳戶的動態權益,有關定時器的部分論壇已經很多討論了,你可以自行搜索一下

    2、這里給你摘抄部分的判斷動態權益全部強平的部分代碼

     

    IsAlarm = 0'是否已經有過預警動作

     dynamicpower= order.Account2(6,account)'得到賬戶動態權益
     cash= order.Account2(3,account)'得到賬戶里的現金余額

    '//////////////////////////////////////////////////////////////////////////////////////////達到全平警戒線 強平資金:103,5000        當前權益只有103.5W的時候強平當前所有持倉
     if dynamicpower<Forced_liquidation_capital and Count1 + Count2 > 0 then
         application.PlaySoundFile "OrderNotify.wav"
            IsAlarm = 1
      Forced=1
      
      if count1 > 0 Or Count2 > 0 then
       application.MsgOut "強平"&Account&"賬戶所有持倉"
       application.MsgOut "動態權益: "&dynamicpower
       application.MsgOut "強平資金: "&Forced_liquidation_capital
      
       Document.DebugFile "C:\OrderLog.txt","執行了強平:"&Account&"賬戶所有持倉", 1
      End if
      
    '//////////////////////////////////////////////////////////////////////////////////////////全平操作
      dim BuyHoding
      dim BuyCost
      dim BuyTodayHoding
      dim SellHoding
      dim SellCost
      dim SellTodayHoding
      dim PNL
      dim UseMargin
      dim Code
      dim Market
        

     for i=0 to count1 - 1

      Result = Order.HoldingInfo2(i,BuyHoding,BuyCost,BuyTodayHoding,SellHoding,SellCost,SellTodayHoding,PNL,UseMargin ,Code,Market)
      If Result <> 1 Then
       exit sub
      End If
     
         set Report1 = marketdata.GetReportData(Code,Market)
         'application.MsgOut Report1.NewPrice

        if  BuyHoding<>0 then
         call order.Sell(1,BuyHoding,Report1.NewPrice,0,Code,Market,account,0)
         application.MsgOut "品種:"&Code & "   平多:"&BuyHoding &"  賬戶:"&account
        end if
      if  SellHoding<>0 then
         call order.Sellshort(1,SellHoding,Report1.NewPrice,0,Code,Market,account,0)
         application.MsgOut  "品種:"&Code & "    平空:"&SellHoding&"  賬戶:"&account   
      end if  
     next
     
     for i=0 to count2 - 1

      Result = Order.HoldingInfo(i, BuyHoding, BuyCost, BuyTodayHoding, SellHoding, SellCost, PNL, Code, Market)
      If Result <> 1 Then
       exit sub
      End If
     
         set Report1 = marketdata.GetReportData(Code,Market)
         'application.MsgOut Report1.NewPrice

        if  BuyHoding>0 then
         call order.Sell(1,BuyHoding,Report1.NewPrice,0,Code,Market,account,0)
         application.MsgOut "品種:"&Code & "   平多:"&BuyHoding &"  賬戶:"&account
      end if
      if  BuyHoding<0 then
         call order.Sellshort(1,BuyHoding,Report1.NewPrice,0,Code,Market,account,0)
         application.MsgOut "品種:"&Code & "   平空:"&abs(BuyHoding) &"  賬戶:"&account

      end if  
     next
        
    end if

 

如果以上指標公式不適用于您常用的行情軟件

或者您想改編成選股公式,以便快速選出某種形態個股的話,

可以聯系我們相關技術人員 QQ: 262069696  點擊在線交流進行 有償 改編!

 


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

相關文章

    沒有相關內容
主站蜘蛛池模板: 久久毛片免费看一区二区三区| 欧美性xxxxx极品娇小| 欧美成人午夜影院| 无套内射无矿码免费看黄| 在线观看网址入口2020国产| 国产伦子系列麻豆精品| 亚洲日韩中文字幕一区| 中国一级毛片在线观看| 免费看污成人午夜网站| 爆乳美女脱内衣18禁裸露网站| 日本人内谢69xxxx| 国产精品好好热在线观看| 卡通动漫精品一区二区三区| 亚洲情a成黄在线观看| 久久国产精品久久| 91黑丝国产线观看免费| 野花社区视频在线观看| 男男同志chinese中年壮汉| 欧美午夜片欧美片在线观看| 成人精品一区二区三区中文字幕| 国产精品免费精品自在线观看| 四虎影视大全免费入口| 亚洲国产精品久久久久久| 中文字幕久久久| poren日本| 精品国产污污免费网站入口 | 色婷婷在线影院| 欧美亚洲人成网站在线观看 | 两个体校校草被c出水| 韩国成人在线视频| 毛片免费在线播放| 性无码专区无码| 国产做无码视频在线观看浪潮| 亚洲欧洲无码一区二区三区| 一本久久a久久精品vr综合| 韩国三级中文字幕hd久久精品| 欧美精品www| 天天在线欧美精品免费看| 国产AV人人夜夜澡人人爽麻豆 | 亚洲一区二区三区播放在线 | igao激情在线视频免费|