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

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

金字塔VBA判斷三角形向上突破源碼[金字塔模型]

  • 金字塔自帶的判斷三角形向上突破的一個VBA的范例
  • 轉載保留出處 www.weiqiv.net.cn

     

    Function TriangleShape(Formula,Cyc,SCyc,ECyc)
        'msgbox cyc & "-" & scyc & "-" & ecyc
     '該函數(shù)計算當前位置圖形是否是三角形突破,如果是則返回1,否則返回0。該函數(shù)只有在選股時才能使用。
     TriangleShape=0
     
     '如果是分時數(shù)據(jù)或者分筆成交那么直接返回
     If Formula.ParentGrid.DataType = 0 or Formula.ParentGrid.CycType = 10 Then
      Exit Function
     End If
     
     '得到K線數(shù)據(jù)對象
     Set History = Formula.ParentGrid.GetHistoryData()
     
     If History.Count < Cyc+3 Then
      Exit Function
     End If
     
     '為了加快處理速度,只有公式在執(zhí)行最后一個周期時使用。這就意味著只能在選股時使用該函數(shù)
     '如果你在公式測試中使用,請注釋掉以下語句
     If Formula.IndexData < History.Count-1 Then Exit Function
     
     '下面的代碼判斷當前圖形是否可能為三角形態(tài)
     '開始位置SCyc周期內的高低價格為三角形態(tài)的開始
     StartPos = Formula.IndexData - (Cyc+2)
     EndPos = Formula.IndexData-3
     High = History.High(StartPos)
     Low  = History.Low(StartPos)
     For I = StartPos To StartPos+SCyc
      If History.High(I) > High Then
       High = History.High(I)
      End If
      If History.Low(i) < Low Then
       Low = History.Low(I)
      End If
     Next
     
     'ECyc周期內的周期高低價格為三角的結束
     High2 = History.High(EndPos - ECyc)
     Low2  = History.Low(Endpos-ECyc)
     for i = endpos - ECyc to endpos
      If History.High(I) > High2 Then
       High2 = History.High(I)
      End If
      If History.Low(i) < Low2 Then
       Low2 = History.Low(I)
      End If
     next
     
     '最后圖形范圍為開始圖形的1/2的話,初步表明是可以做為三角形的結束
     if high2-low2 <= 0 then
      exit function
     end if
     
     If (High-Low) / (high2-low2) < 2 Then
      Exit Function
     End if
     
     if high2 > high or low2 < low then
      exit function
     end if
     
     '如果中間有超過三角形邊界的地方,三角圖形則不成立
     '用斜率計算圖形邊界
     '計算上邊界
     Slope = (high2-high) / (Endpos-StartPos)
     b = high - slope * startpos
     
     for i = startpos+SCyc to endpos
      temp = slope * i + b
      price = (history.open(i)+history.close(i))/2
      if temp < price then
       exit function
      end if
     next
     
     '計算下邊界
     slope = (low2-low) / (endpos - startpos)
     b = low - slope * startpos
     
     for i = startpos to endpos-3
      temp = slope * i + b
      price = (history.open(i)+history.close(i))/2
      if temp > price then
       exit function
      end if
     next 
     
     '如果3日后的價格突破了三角型結束的上邊線認為突破成功
     if history.close(Formula.IndexData) > high2 then
      TriangleShape = 1
     end if
     
     
    End Function

 

有思路,想編寫各種指標公式,程序化交易模型,選股公式,預警公式的朋友

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

 


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

相關文章

    沒有相關內容
  主站蜘蛛池模板: 99精彩视频| 天天干天天操天天插 | 四虎永久免费地址在线观看 | 97视频在线 | 国产69精品久久久久99 | 亚洲欧美日韩高清专区一区 | 欧美大片aaaa一级毛片 | 国产免费一区二区三区在线 | 天天做天天添婷婷我也去 | 久久久影院亚洲精品 | 日本a中文字幕 | 一级片视频免费看 | 久久九九有精品国产23百花影院 | 在线亚洲欧美日韩 | 欧美精品一区在线看 | 伊人影院在线视频 | 精品精品国产理论在线观看 | 毛茸茸成熟女性老太的女bbww | 波多野结中文字幕在线69视频 | 毛片破处 | 2020国产成人精品免费视频 | 京野结衣免费一区二区 | 99久热国产精品视频尤物不卡 | 狠狠狠狠狠狠狠狠 | 国产毛片一级国语版 | 操你妹影院 | 国产精品福利视频 | 国产精品久久久久久久久鸭 | 日本精品久久久久中文字幕 | 欧美人与动性xxxxbbbb | 玖玖国产精品 | 热久久在线观看 | 四虎影院的网址 | 伊人久久久久久久久香港 | 毛片一级毛片 | 欧美成人免费在线视频 | 久久综合图区亚洲综合图区 | 中文字幕一区日韩在线视频 | 欧美一级在线 | 国产亚洲精品视频中文字幕 | 亚洲欧美一二三区 |