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

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

原來(lái)在3.3版本正常的代碼現(xiàn)在升級(jí)3.4后老是提示編譯缺少history對(duì)象 [金字塔]

  • 咨詢內(nèi)容: 原來(lái)在3.3版本正常的代碼現(xiàn)在升級(jí)3.4后老是提示編譯缺少history對(duì)象麻煩高手給看看是什么原因for pzindex=0 To 5 step 1  for zhouqi = 0 to 5 step 1   if zhouqi<2 or zhouqi>4 then    set History = marketdata.GetHistoryData(code(pzindex),market(pzindex),zhouqi)    Xa=today    set mkt = marketdata.GetMarketInfo2(market(pzindex))    if zhouqi<2 then Xa=cdate(today+mkt.opentime-cdate("1975-1-1")+cdate("00:0" & zhouqimin(zhouqi) & ":00"))    a=History.GetPosFromDate(Xa)    aaa=History.GetPosFromDate(cdate(today+mkt.closetime-cdate("1975-1-1")))    copentime=cdate(mkt.opentime-cdate("1975-1-1"))    if zhouqi<2 then Kn = mkt.TradeSeconds / 60 / zhouqimin(zhouqi)        if zhouqi=5 then     if cdate(time)>cdate(copentime) and History.Date(aaa)<>cdate(today) then strcon=strcon & code(pzindex) & " 當(dāng)天日線缺失" & vbCrLf    else     if History.Date(a)<cdate(today) then aa=aaa-a else aa=aaa-a+1     mins = DateDiff("n",cdate(copentime),cdate(time))     if mins>-1 and (cdate(time)<cdate("11:30:00") or cdate(time)>cdate("13:00:00")) then'中午休市時(shí)不檢查      if cdate(time)<cdate("11:30:00") then       mins = mins \ zhouqimin(zhouqi)+1      elseif cdate(time)>cdate("13:00:00") then       mins = mins \ zhouqimin(zhouqi)+1-90 \ zhouqimin(zhouqi)      end if      if mins<>aa and aa<Kn then       strcon=strcon & code(pzindex) & " 當(dāng)天" & zhouqimin(zhouqi) & "分鐘K線數(shù)目前為" & aa & ",應(yīng)為" & mins & vbCrLf      elseif aa>Kn then       strcon=strcon & code(pzindex) & " 當(dāng)天" & zhouqimin(zhouqi) & "分鐘K線數(shù)目前為" & aa & ",應(yīng)為" & Kn & vbCrLf      end if     end if    end if   end if  next next

     

  • 金字塔客服: 是不是因?yàn)橛幸贡P(pán)后  xa的寫(xiě)法有問(wèn)題了Xa=cdate(today+mkt.opentime-cdate("1975-1-1")+cdate("00:0" & zhouqimin(zhouqi) & ":00"))

     

  • 用戶回復(fù):

    是否方便給出一個(gè)完整可以運(yùn)行的代碼.

    不過(guò)從現(xiàn)象看應(yīng)該是取到的history對(duì)象為空導(dǎo)致的,你可以調(diào)試一下,看看調(diào)取那個(gè)品種的數(shù)據(jù)取不到了

     

  • 網(wǎng)友回復(fù):

    Sub Chashuju2()'盤(pán)中數(shù)據(jù)檢查
     today=Date()
     if Weekday(today)=1 or Weekday(today)=7 or  todaystop=1 then Exit Sub'星期6和7不檢查
     if cdate(time)>=cdate("08:59:00") and cdate(time)<=cdate("09:00:00") then '開(kāi)盤(pán)前8點(diǎn)59分先做一次賬戶檢查
      Set mail = CreateObject("WWSCommon.SmtpMail")
      strcon= ""
      if order.Account2(2,"你的ctp賬戶")<>1 then strcon = strcon & "交易帳號(hào)未登陸" & vbCrLf
      if application.ReceiveDataStatus = 0 then strcon = strcon & "金字塔數(shù)據(jù)接收未啟動(dòng)" & vbCrLf
         with mail
              .SenderName = "程序化監(jiān)督"
              .SenderAddress = "email@163.com"
              if strcomp(strcon,"")=0 then
               .Subject = "盤(pán)中檢測(cè)已準(zhǔn)備就緒" & cdate(date+time)
               strcon = "盤(pán)中檢測(cè)已準(zhǔn)備就緒"
              else
               .Subject = "盤(pán)中檢測(cè)異常" & cdate(date+time)
              end if
          end with
          call mail.AddReceiver("139","13688888888@139.com")
          call mail.AddTextContent(strcon)
          call mail.Sender("smtp.163.com","email@163.com","123456")
          Set mail = nothing
     end if
     if cdate(time)<cdate("09:15:00") or cdate(time)>cdate("15:15:00") then exit Sub'只在所交易的合約開(kāi)盤(pán)的時(shí)間內(nèi)做檢查,我交易合約是股指,所以定這個(gè)時(shí)間
     dim code(6)
     dim market(6)
     dim zhouqimin(2)
     strcon= ""
     if application.ReceiveDataStatus = 0 then application.ReceiveData(1)
     Application.PeekAndPump
     if order.Account2(2,"你的ctp賬戶")<>1 then strcon = strcon & "交易帳號(hào)未登陸" & vbCrLf
     if application.ReceiveDataStatus = 0 then strcon = strcon & "金字塔數(shù)據(jù)接收未啟動(dòng)" & vbCrLf
     code(0)=Document.GetExtString("股指交易合約")
     market(0)="ZJ"


     Holding = Document.GetExtData("IFHOLDING")
     dim BuyHoding
     dim BuyTodayHoding
     dim SellHoding
     dim SellTodayHoding
     dim BuyCost
     dim SellCost
     dim PNL
     Dim UseMargin
     Result = Order.HoldingInfoByCode2(code(0),market(0),BuyHoding,BuyCost,BuyTodayHoding,SellHoding,SellCost,SellTodayHoding,PNL,UseMargin,"你的ctp登陸資金賬號(hào)")
     If Result = 1 Then
      if Round(BuyHoding-SellHoding)<>Round(Holding) then
       strcon = strcon & code(0) & "持倉(cāng)不同步,實(shí)際持倉(cāng)" & Round(BuyHoding-SellHoding) & "手,應(yīng)為" & Holding & "手" & vbCrLf
      end if
     End If

     code(1)=Document.GetExtString("股指主力合約")
     market(1)="ZJ"
     code(2)="000001"
     market(2)="SH"
     code(3)="1Z2016"
     market(3)="SH"
     code(4)="1Z2056"
     market(4)="SH"
     code(5)="000300"
     market(5)="SH"
     zhouqimin(0)=1
     zhouqimin(1)=5
     for pzindex=0 To 5 step 1
      for zhouqi = 0 to 5 step 1
       if zhouqi<2 or zhouqi>4 then
        set History = marketdata.GetHistoryData(code(pzindex),market(pzindex),zhouqi)
        Xa=today
        set mkt = marketdata.GetMarketInfo2(market(pzindex))
        if zhouqi<2 then Xa=cdate(today+mkt.opentime-cdate("1975-1-1")+cdate("00:0" & zhouqimin(zhouqi) & ":00"))
        a=History.GetPosFromDate(Xa)
        aaa=History.GetPosFromDate(cdate(today+mkt.closetime-cdate("1975-1-1")))
        copentime=cdate(mkt.opentime-cdate("1975-1-1"))
        if zhouqi<2 then Kn = mkt.TradeSeconds / 60 / zhouqimin(zhouqi)
        
        if zhouqi=5 then
         if cdate(time)>cdate(copentime) and History.Date(aaa)<>cdate(today) then strcon=strcon & code(pzindex) & " 當(dāng)天日線缺失" & vbCrLf
        else
         if History.Date(a)<cdate(today) then aa=aaa-a else aa=aaa-a+1
         mins = DateDiff("n",cdate(copentime),cdate(time))
         if mins>-1 and (cdate(time)<cdate("11:30:00") or cdate(time)>cdate("13:00:00")) then'中午休市時(shí)不檢查
          if cdate(time)<cdate("11:30:00") then
           mins = mins \ zhouqimin(zhouqi)+1
          elseif cdate(time)>cdate("13:00:00") then
           mins = mins \ zhouqimin(zhouqi)+1-90 \ zhouqimin(zhouqi)
          end if
          if mins<>aa and aa<Kn then
           strcon=strcon & code(pzindex) & " 當(dāng)天" & zhouqimin(zhouqi) & "分鐘K線數(shù)目前為" & aa & ",應(yīng)為" & mins & vbCrLf
          elseif aa>Kn then
           strcon=strcon & code(pzindex) & " 當(dāng)天" & zhouqimin(zhouqi) & "分鐘K線數(shù)目前為" & aa & ",應(yīng)為" & Kn & vbCrLf
          end if
         end if
        end if
       end if
      next
     next
     
     secs = 100
     for i=0 to SigCount-1 step 1
      if states(i)=1 and (cdate(time)<cdate("11:30:00") or cdate(time)>cdate("13:00:00")) then'進(jìn)對(duì)已加載的公式檢查狀態(tài),中午休市不檢查
       secs = DateDiff("s",cdate(newtime(i)),cdate(time))
       if cdate(time)>cdate("09:31:00") and secs>60 then '由于我的所有公式均是1分鐘調(diào)用一次VBA函數(shù)READSIG,所以公式最近一次運(yùn)行時(shí)間應(yīng)該在60秒內(nèi),如果你的公式是5分鐘的,那么這個(gè)時(shí)間要加大
        strcon = strcon & "策略" & i & "已超過(guò)" & secs & "秒沒(méi)有執(zhí)行" & vbCrLf
       end if
      end if
     next
     
     if strcomp(strcon,"")=0 then
      errorcount=0
      if (cdate(time)<cdate("09:16:05") or (cdate(time)>cdate("13:00:00") and cdate(time)<cdate("13:01:05"))) and secs<120 then

    '固定在上午和下午開(kāi)盤(pán)后的第一次檢查時(shí)發(fā)郵件通知,即使是一切正常時(shí)
       Set mail = CreateObject("WWSCommon.SmtpMail")
          with mail
               .SenderName = "程序化監(jiān)督"
               .SenderAddress = "email@163.com"
               .Subject = "公式已開(kāi)始運(yùn)行" & cdate(date+time)
           end with
           call mail.AddReceiver("139","13688888888@139.com")
           call mail.AddTextContent("公式已開(kāi)始運(yùn)行")
           call mail.Sender("smtp.163.com","email@163.com","123456")
           Set mail = nothing
      end if
     else
      errorcount=errorcount+1
      if errorcount<3 or errorcount=5 then'連續(xù)異常時(shí),會(huì)有第1、第2、第5次通知;如果出現(xiàn)異常后,又恢復(fù)正常,異常通知次數(shù)會(huì)重新計(jì)算
       Set mail = CreateObject("WWSCommon.SmtpMail")
          with mail
               .SenderName = "程序化監(jiān)督"
               .SenderAddress = "email@163.com"
               .Subject = "盤(pán)中異常通知第" & errorcount & "次 " & cdate(date+time)
           end with
           call mail.AddReceiver("139","13688888888@139.com")
           call mail.AddTextContent(strcon)
           call mail.Sender("smtp.163.com","email@163.com","123456")
           Set mail = nothing
          end if
        end if
    End Sub

     

  • 網(wǎng)友回復(fù):

    or pzindex=0 To 5 step 1
      for zhouqi = 0 to 5 step 1
       if zhouqi<2 or zhouqi>4 then
        Application.MsgOut code(pzindex) & "--" & market(pzindex)
        set History = marketdata.GetHistoryData(code(pzindex),market(pzindex),zhouqi)
        Xa=today

     

    建議你多學(xué)習(xí)一下調(diào)試方法吧, 將code數(shù)組打印輸出一下你就能看到, 是因?yàn)槟銢](méi)有讀取到品種代碼引起的History 為空導(dǎo)致的

 

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

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


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

相關(guān)文章

    沒(méi)有相關(guān)內(nèi)容
主站蜘蛛池模板: 美国毛片一级e片黑人片 | 亚洲国产99在线精品一区69堂 | 精品久久视频 | 四虎8848精品永久在线观看 | 久久国产精品免费 | 免费一区二区三区久久 | 伊人久久精品亚洲午夜 | 亚洲精品tv久久久久久久久 | 精品国产第一国产综合精品 | 国产成人啪精品 | 免费观看一级特黄三大片视频 | 午夜伊人 | 久久成人在线观看 | 久久久www成人免费精品 | 久久这里只有精品首页 | 国产精品1区2区3区 国产精品1区2区3区在线播放 | 最新国产精品久久精品 | 女性一级全黄生活片 | 亚洲欧洲中文日产 | 狠狠久久综合伊人不卡 | 妖精视频一区二区三区 | 青草网址| a v在线男人的天堂观看免费 | www久久爱com| 欧美日韩中文字幕久久伊人 | 天天骑天天干 | 成人夜色视频在线观看网站 | 国产高清成人mv在线观看 | 久久精品国产免费一区 | 日韩中文字幕推理片 | 五月天婷婷网址 | 91亚洲国产三上悠亚在线播放 | 欧美成人七十二式性视频教程 | 亚洲高清资源在线观看 | 欧美洲精品亚洲精品中文字幕 | 午夜视频国产 | 欧美日韩亚洲综合久久久 | 国产大片91精品免费观看不卡 | 特级毛片免费视频播放 | 天啪天天久久天天综合啪 | 久久免费公开视频 |