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

求助:轉化代碼 [金字塔]

  • 咨詢內容:  

    這是一個HURET指數的代碼,請求您:

    1、能不能轉化成金字塔中能夠計算和運行的代碼嗎?

    2、這個是VB代碼,這個和金字塔語言的轉換的關鍵是什么呢?

     

    'This program calculates an estimate of the Hurst coefficient.

    'Written by Martin Sewell <martin@martinsewell.com>


    Sub Hurst()


        Dim Data()

        Dim Array1()

        Dim Array2()

        Dim Mean

        Dim Result()

       

        Dim NoOfDataPoints As Integer

       

        Dim NoOfPlottedPoints As Integer

        Dim PlottedPointNo As Integer

       

        Dim NoOfPeriods As Integer

        Dim PeriodNo As Integer

       

        Dim N As Integer

        Dim i As Integer

        Dim m As Integer

        Dim logten

        Dim R

        Dim S

        Dim RS

        Dim SumSquared

       

        logten = Log(10)

       

        'Delete any previous results

        Worksheets("Data").Range("C3").Value = Null

        Worksheets("Data").Range("D:D").Value = Null

        Worksheets("Data").Range("E:E").Value = Null

       

        'Get total number of data points

        NoOfDataPoints = Worksheets("Data").Range("C1").Value

       

        ReDim Data(NoOfDataPoints)

       

        'Get data, ignoring any spaces

        i = 1

        counter = 1

        Do While counter <= NoOfDataPoints

            Set curCell = Worksheets("Data").Cells(i, 1)

            If Application.WorksheetFunction.IsNumber(curCell.Value) Then

                Data(counter) = curCell.Value

                counter = counter + 1

            End If

            i = i + 1

        Loop

       

        NoOfPlottedPoints = NoOfDataPoints - 2

        ReDim Result(NoOfPlottedPoints, 2)

       

        'Begin main loop

        For N = 3 To NoOfDataPoints

           

            totalR = 0

            totalS = 0

           

            NoOfPeriods = NoOfDataPoints - N + 1

           

            For PeriodNo = 1 To NoOfPeriods

                ReDim Array1(N)

                ReDim Array2(N)

               

                For i = 1 To N

                    Array1(i) = Data((PeriodNo - 1) + i)

                    Array2(i) = 0

                Next i


                Summ = 0

                SumSquared = 0

                For i = 1 To N

                    Summ = Summ + Array1(i)

                    SumSquared = SumSquared + ((Array1(i)) * (Array1(i)))

                   

                Next i

                Mean = Summ / N


                'STDEV

                'S = Sqr((SumSquared - (Summ * Summ) / N) / (N - 1))

                

                'STDEVP

                S = Sqr((SumSquared - (Summ * Summ) / N) / N)

               

                For i = 1 To N

                    Array1(i) = Array1(i) - Mean

                Next i

               

                For i = 1 To N

                    For j = 1 To i

                        Array2(i) = Array2(i) + Array1(j)

                    Next j

                Next i

               

                Maxi = Array2(1)

                Mini = Array2(1)

                For i = 1 To N

                    If Array2(i) > Maxi Then Maxi = Array2(i)

                    If Array2(i) < Mini Then Mini = Array2(i)

                Next i

               

                R = Maxi - Mini

                totalR = totalR + R

                totalS = totalS + S

               

            Next PeriodNo

         

            R = totalR / NoOfPeriods

            S = totalS / NoOfPeriods

            RS = R / S

         

          PlottedPointNo = N - 2

            Result(PlottedPointNo, 1) = (Log(N)) / logten

            Result(PlottedPointNo, 2) = (Log(RS)) / logten

             

        Next N

           

        Sumx = 0

        Sumy = 0

        Sumxy = 0

        Sumxx = 0

       

        For i = 1 To NoOfPlottedPoints

            Worksheets("Data").Cells(i + 6, 4).Value = Result(i, 1)

            Worksheets("Data").Cells(i + 6, 5).Value = Result(i, 2)

            Sumx = Sumx + Result(i, 1)

            Sumy = Sumy + Result(i, 2)

            Sumxy = Sumxy + (Result(i, 1)) * (Result(i, 2))

            Sumxx = Sumxx + (Result(i, 1)) * (Result(i, 1))

        Next i

       

        'Calculate Hurst coefficient

        H = (Sumxy - ((Sumx * Sumy) / NoOfPlottedPoints)) / (Sumxx - ((Sumx * Sumx) / NoOfPlottedPoints))

        Worksheets("Data").Range("C3").Value = H

       

    End Sub

     

  • 金字塔客服: 能不能把思路寫出來?

 

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

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

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

 


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

相關文章

    沒有相關內容
主站蜘蛛池模板: 久久亚洲国产视频| 啊灬啊灬别停啊灬用力啊免费| [中文][3d全彩]舞房之夜| 无码国产色欲XXXXX视频| 亚洲免费在线看| 疯狂吃奶freesex| 国产91po在线观看免费观看| 久久综合88熟人妻| 毛片基地看看成人免费| 国产性一交一乱一伦一色一情| 91精品国产一区| 天天色综合图片| 中文乱码字幕午夜无线观看| 欧美性猛交xxxx乱大交丰满 | ww视频在线观看| 扒开双腿爽爽爽视频www| 亚洲欧美天堂综合久久| 秋霞鲁丝片无码av| 四虎影视在线永久免费观看| 触手怪入侵男生下面bl的漫画| 国色天香中文字幕视频| 久久亚洲精品中文字幕无码| 极品精品国产超清自在线观看 | 成人动漫综合网| 久久一日本道色综合久| 欧美精品一区二区三区免费观看| 免费夜色污私人影院在线观看| 练瑜伽的时候进入| 国产a三级三级三级| 花季传媒app免费版网站下载安装| 国产又色又爽在线观看| 91免费国产在线观看| 天堂8中文在线最新版在线| 一级毛片在播放免费| 成年免费A级毛片免费看无码| 亚洲午夜久久久影院伊人| 永久免费在线观看视频| 亚洲视频在线免费看| 狠狠躁日日躁夜夜躁2022麻豆| 你是我的城池营垒免费观看完整版| 男生和女生一起差差在线观看|