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

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

請問金字塔客服如何將這段策略放到VBA里面用 [金字塔]

  • 咨詢內(nèi)容:

    sub marketdata_reportnotify(reportdata) 
      dim multiplier
      dim mintick
      dim shortpercent
      dim longpercent
     
      dim buyhoding
      dim buytodayhoding
      dim sellhoding
      dim selltodayhoding
      dim buycost
      dim sellcost
      dim pnl
      dim usemargin
        
      dim orderid1
      dim consign1
      dim filled1
      dim remaining1
      dim ordertype1
      dim lmtprice1 
      
      dim orderid2
      dim consign2
      dim filled2
      dim remaining2
      dim ordertype2
      dim lmtprice2
      
       dim orderid3
      dim consign3
      dim filled3
      dim remaining3
      dim ordertype3
      dim lmtprice3
      
      dim orderid4
      dim consign4
      dim filled4
      dim remaining4
      dim ordertype4
      dim lmtprice4  
     
      lots=1
      account="888888" 
      
      code=reportdata.label
      market=reportdata.marketname
      
      t0=code&"_trend0"
      t1=code&"_trend1"
      
      mybarpos=code&"_barpos"  
      
      set md=marketdata.getminutedata(code,market)
      
      barpos=md.count-1
      
      if barpos<=document.getextdata(mybarpos) then 
      exit sub
      end if
      
      call document.setextdata(mybarpos,barpos)
      
      call document.setextdata(t1,document.getextdata(t0))
      
      if md.newprice(barpos)>md.newprice(barpos-1) then 
       call document.setextdata(t0,1)
      end if
      
      if md.newprice(barpos)<md.newprice(barpos-1) then 
       call document.setextdata(t0,-1)
      end if
     
      entrylongcond=document.getextdata(t0)=1 and document.getextdata(t1)=1 and md.newprice(barpos)>md.newprice(barpos-1)
      entryshortcond=document.getextdata(t0)=-1 and document.getextdata(t1)=-1 and md.newprice(barpos)<md.newprice(barpos-1)

    '  sleeptime=2
    '  
    '  actiontime=code&"_actiontime"
    '  
    '  if document.getextstring(actiontime)="" then 
    '    actiondiff=sleeptime
    '  else
    '    actiondiff=datediff("s",document.getextstring(actiontime),now)   
    '  end if 
    '  
    '  if actiondiff<sleeptime then 
    '    exit sub
    '  end if  
      
      call order.contract(code,market,multiplier,mintick,shortpercent,longpercent)
      call order.holdinginfobycode2(code,market,buyholding,buycost,buytodayholding,sellholding,sellcost,selltodayholding,pnl,usemargin,account)    

      call getpendingorder(orderid1,consign1,filled1,remaining1,0,ordertype1,lmtprice1,account,0,code,market)
      call getpendingorder(orderid2,consign2,filled2,remaining2,1,ordertype2,lmtprice2,account,2,code,market)
      call getpendingorder(orderid3,consign3,filled3,remaining3,1,ordertype3,lmtprice3,account,0,code,market)
      call getpendingorder(orderid4,consign4,filled4,remaining4,0,ordertype4,lmtprice4,account,2,code,market)
      
      'application.MsgOut("lmtprice1="&lmtprice1)
      application.MsgOut("lmtprice2="&lmtprice2)
      'application.MsgOut("lmtprice3="&lmtprice3)
      application.MsgOut("lmtprice4="&lmtprice4)
      
      a=orderid2>0 and md.askprice(barpos)<lmtprice2
      b=orderid4>0 and md.bidprice(barpos)>lmtprice4
      
      application.MsgOut("多頭追價(jià):"&a )
      application.MsgOut("空頭追價(jià):"&b )
      
      order.orderqueue=0
      
      offset=3*mintick   

      '多頭條件成立時(shí),將賣平和賣開未成交單撤單
      if entrylongcond then
       call order.cancelorder(orderid2)
       call order.cancelorder(orderid3)
       'call document.setextstring(actiontime,now)
      end if
      
      '空頭條件成立時(shí),將買開和買平未成交單撤單
      if entryshortcond then
       call order.cancelorder(orderid1)
       call order.cancelorder(orderid4)
       'call document.setextstring(actiontime,now)
      end if
      
      '多頭開倉
      if buyholding=0 then
       if entrylongcond then
        if orderid1=0 then
         call order.buy(0,lots,md.bidprice(barpos),0,code,market,account,0)
         'call document.setextstring(actiontime,now)
        end if
       end if 
      end if   
      
      '多頭平倉
      if buyholding>0 then   
       if entryshortcond then    
        if orderid2=0 then
         '多頭止盈
         call order.sell(0,buyholding,md.askprice(barpos),0,code,market,account,0)
         'call document.setextstring(actiontime,now)
        end if    
       end if 
       
       '多頭追價(jià)
       if orderid2>0 and md.askprice(barpos)<lmtprice2 then
        order.orderqueue=1
       call order.cancelorder(orderid2)
       call order.sell(0,buyholding,md.askprice(barpos),0,code,market,account,0)
       'call document.setextstring(actiontime,now)   
       end if
       
       '多頭止損
       if buycost-md.bidprice(barpos)>=offset then
        order.orderqueue=1
        call order.cancelorder(orderid2)
        call order.sell(0,buyholding,md.bidprice(barpos),0,code,market,account,0)
        'call document.setextstring(actiontime,now)
       end if    
      end if 
      
      '空頭開倉
      if sellholding=0 then   
       if entryshortcond then    
        if orderid3=0 then
         call order.buyshort(0,lots,md.askprice(barpos),0,code,market,account,0)
         'call document.setextstring(actiontime,now)
        end if  
       end if
      end if  
      
      '空頭平倉
      if sellholding>0 then
       if entrylongcond then    
        if orderid4=0 then
         '空頭止盈
         call order.sellshort(0,sellholding,md.bidprice(barpos),0,code,market,account,0)
         'call document.setextstring(actiontime,now)
        end if     
       end if 
       
       '空頭追價(jià)
       if orderid4>0 and md.bidprice(barpos)>lmtprice4 then
        order.orderqueue=1
       call order.cancelorder(orderid4)
       call order.sellshort(0,sellholding,md.bidprice(barpos),0,code,market,account,0)
       'call document.setextstring(actiontime,now)   
       end if
       
       '空頭止損
       if md.askprice(barpos)-sellcost>=offset then
        order.orderqueue=1
        call order.cancelorder(orderid4)
        call order.sellshort(0,sellholding,md.askprice(barpos),0,code,market,account,0)
        'call document.setextstring(actiontime,now)
       end if    
      end if
    end sub

    sub getpendingorder(myorderid,myconsign,myfilled,myremaining,myaction,myordertype,mylmtprice,myaccount,mykaiping,mycode,mymarket)
      dim orderid
      dim consign
      dim filled
      dim remaining
      dim action
      dim ordertype
      dim lmtprice
      dim account
      dim kaiping
      dim code
      dim market
      
      for i=0 to order.ordernum2-1
        call order.orderinfo2(i,orderid,consign,filled,remaining,action,ordertype,lmtprice,account,kaiping,code,market) 
            
        if code=mycode and market=mymarket and action=myaction and kaiping=mykaiping and account=myaccount then        
          myorderid=orderid
          myconsign=consign
          myfilled=filled
          myremaining=remaining
          myordertype=ordertype
          mylmtprice=lmtprice 
          exit for  
        else
          myorderid=0
          myconsign=0
          myfilled=0
          myremaining=0
          myordertype=0
          mylmtprice=0   
        end if
      next
    end sub

    sub test2()

    end sub


     

  • 金字塔客服:

    http://www.weistock.com/WeisoftHelp/vbarumenjiaocheng.htm

    看下這金字塔的vba如何進(jìn)入編輯界面

 

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

可聯(lián)系技術(shù)人員 QQ: 511411198  點(diǎn)擊這里給我發(fā)消息進(jìn)行 有償 編寫!不貴!點(diǎn)擊查看價(jià)格!


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

相關(guān)文章

    沒有相關(guān)內(nèi)容
主站蜘蛛池模板: 在线免费观看黄视频 | 波多野结衣国产一区二区三区 | 日韩伦理中文字幕 | 婷婷久操 | 久久午夜羞羞影院免费观看 | 成人在免费观看视频国产 | 黄漫画黄网站在线观看 | 国产高清一区二区三区免费视频 | 免费一级黄色毛片 | 中日韩视频在线看免费观看 | 成人动漫在线视频 | 久久综合丝袜长腿丝袜 | 荡娃艳妇系列小说 | 成年人免费观看网站 | 日韩精品一区二区三区不卡 | 最近最新视频中文字幕4 | 亚洲专区第一页 | 2017天天爽夜夜爽精品视频 | 成年人在线免费 | 欧洲色吧 | 免费国产好深啊好涨好硬视频 | 高清在线一区二区 | 九九99国产精品视频 | 人成午夜视频 | 天堂在线视频 | 在线精品国产成人综合第一页 | 999热在线精品观看全部 | 国产婷婷一区二区三区 | 成人污污视频 | 国产日韩欧美一区二区三区在线 | 国产一区二区三区播放 | 一级日韩一级欧美 | 天天摸夜夜摸成人免费视频 | 一级免费黄色录像 | 丁香天堂网 | 亚洲欧美日韩中文字幕在线 | 丝袜制服第一页 | 国产欧美日韩在线一区二区不卡 | 亚洲成人网页 | 成年人免费网 | 韩国一区|