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

等價K線交易之VBA源碼[其他期貨軟件]

思路

第一次運行宏的時候利用歷史數(shù)據(jù)給出一個結(jié)果。

然后根據(jù)實際情況給出實時的結(jié)果

 

提示:我這里已經(jīng)構(gòu)架了整體的思路,只是沒有寫交易指令部分。有需要的朋友,直接添加VBA交易指令即可交易!

這里只提供研究交流思路,模型不保證盈利!

 

  • 源碼內(nèi)容:

    i = 0
    open = 0
    m = 0
    k = 0
    j = 0
    dtyl = 0
    ktyl = 0
    qj = 5   //根據(jù)自己需要修改

    mj1close = 0
    mj2close = 0

    Sub dengjiaxian()
        ' 得到框架名稱為"Technic",窗格名稱為"Main"的窗格對象
        Set Grid = Technic.GetGridByName("Main")
        set minutedata = Grid.GetMinuteData
        Count =  minutedata.Count
        open = minutedata.newprice(0)
        mj1close = minutedata.newprice(0)
        mj2close = minutedata.newprice(0)

        for i = 1 to count-1
            close = minutedata.newprice(i)
            if close > open and close-open > qj then
               open = close
               if m = 0 then dtdbyk = 0 else dtdbyk = mj2close-close
               if m = 0-1 or m = 0 then
                  mj1close = close
                  dtyl = dtyl+dtdbyk
                  application.MsgOut Date &" " &Time&" "& "第"&i+1&"筆"&" "&"多:"&" "&close&" "&"單筆盈利"&" "&" "&dtdbyk&" "& "當(dāng)日空頭累計盈利為:" &dtyl
                  j = j+1
               end if
               m = 1
            elseif   close < open and open-close > qj then
               open = close
               if m = 0 then dtdbyk = 0 else ktdbyk = close - mj1close
               if m = 1 or m = 0 then
                  mj2close = close
                  ktyl = ktyl+ktdbyk
                  application.MsgOut Date &" " &Time&" "& "第"&i+1&"筆"&" "&"空:"&" "&close&" "&"單筆盈利"&" "&" "&ktdbyk&" "&"當(dāng)日多頭累計盈利為:" &ktyl
                  k = k+1
               end if
               m = 0-1
            end if
         next
    End Sub

    Sub APPLICATION_VBAStart()
     call Application.SetTimer(0,100) '創(chuàng)建一個0號定時器,間隔時間1秒
    End Sub

    Sub APPLICATION_Timer(ID)
        '定時器事件處理
         Application.ActivateFrame "Technic" '確保技術(shù)分析主框架處于激活狀態(tài)
        
        ' 得到框架名稱為"Technic",窗格名稱為"Main"的窗格對象
        Set Grid = Technic.GetGridByName("Main")
        set minutedata = Grid.GetMinuteData
        Count =  minutedata.Count
            close = minutedata.newprice(Count-1)
         if Count-1 > i then  
            if close > open and close-open > qj then
               open = close
               if m = 0 then dtdbyk = 0 else dtdbyk = mj2close-close
               if m = 0-1 or m = 0 then
                  mj1close = close
                  dtyl = dtyl+dtdbyk
                  application.MsgOut Date &" " &Time&" "& "第"&i+1&"筆"&" "&"多:"&" "&close&" "&"單筆盈利"&" "&" "&dtdbyk&" "& "當(dāng)日空頭累計盈利為:" &dtyl
                  application.MsgOut Date &" " &Time&" "& "多頭" &j& "次" &" "& "多頭盈利" &ktyl& "點"&" "& "空頭" &k& "次"&" "& "空頭盈利" &dtyl& "點" &" "& "總計" &k+j& "次"&" "& "總盈利" &ktyl+dtyl& "點"
                  j = j+1
               end if
               m = 1
            elseif   close < open and open-close > qj then
               open = close
               if m = 0 then dtdbyk = 0 else ktdbyk = close - mj1close
               if m = 1 or m = 0 then
                  mj2close = close
                  ktyl = ktyl+ktdbyk
                  application.MsgOut Date &" " &Time&" "& "第"&i+1&"筆"&" "&"空:"&" "&close&" "&"單筆盈利"&" "&" "&ktdbyk&" "&"當(dāng)日多頭累計盈利為:" &ktyl
                  application.MsgOut Date &" " &Time&" "& "多頭" &j& "次" &" "& "多頭盈利" &ktyl& "點"&" "& "空頭" &k& "次"&" "& "空頭盈利" &dtyl& "點" &" "& "總計" &k+j& "次"&" "& "總盈利" &ktyl+dtyl& "點"
                  k = k+1
               end if
               m = 0-1
            end if      
         end if
    End Sub

    sub rnjy()
        call dengjiaxian()
        call APPLICATION_Timer(ID)
    End Sub  

     

 

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

可聯(lián)系技術(shù)人員 QQ: 262069696  點擊在線交流進(jìn)行 有償 編寫!不貴!點擊查看價格!

 


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

相關(guān)文章

    沒有相關(guān)內(nèi)容
  主站蜘蛛池模板: 韩国在线免费视频| 一个人免费视频观看在线www| 海角社区视频在线| 国产三级在线观看播放| 8050午夜二级毛片全黄app| 成人免费视频国产| 国产女人18毛片水真多18精品| 久久久久免费精品国产小说| 波多野结衣bt| 四虎精品免费永久免费视频| 亚洲香蕉久久一区二区| 女女同性一区二区三区四区| 久久人人爽人人爽人人av东京热| 欧美最猛黑人xxxx| 国产在线视频国产永久视频| 99热综合在线| 成年女人18级毛片毛片免费| 亚洲av无码一区二区二三区| 激情人妻另类人妻伦| 四虎永久在线精品国产免费| 亚洲国产成人99精品激情在线| 天天在线天天综合网色| 久久99国产亚洲精品观看| 欧美v日韩v亚洲v最新| 免费一级欧美大片在线观看| 西西人体www44rt大胆高清| 国产精品久久久久久久伊一| 久久久国产乱子伦精品| 欧美日韩生活片| 免费看激情按摩肉体视频| 2021乱理片宅它网| 少妇人妻av无码专区| 久久成人午夜电影mp4| 欧美性大战xxxxx久久久| 免费一区区三区四区| 老司机精品在线| 国产视频一区二区在线观看| 一本大道无码人妻精品专区 | 国产女同疯狂摩擦系列1| 538在线视频观看| 大地资源在线资源官网|