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

求助:轉(zhuǎn)化代碼 [金字塔]

  • 咨詢內(nèi)容:  

    這是一個(gè)HURET指數(shù)的代碼,請(qǐng)求您:

    1、能不能轉(zhuǎn)化成金字塔中能夠計(jì)算和運(yùn)行的代碼嗎?

    2、這個(gè)是VB代碼,這個(gè)和金字塔語(yǔ)言的轉(zhuǎn)換的關(guān)鍵是什么呢?

     

    '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

     

  • 金字塔客服: 能不能把思路寫(xiě)出來(lái)?

 

如果以上指標(biāo)公式不適用于您常用的行情軟件

或者您想改編成選股公式,以便快速選出某種形態(tài)個(gè)股的話,

可以聯(lián)系我們相關(guān)技術(shù)人員 QQ: 262069696  點(diǎn)擊在線交流進(jìn)行 有償 改編!

 


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

相關(guān)文章

    沒(méi)有相關(guān)內(nèi)容
主站蜘蛛池模板: 五月天婷婷综合网| 啊轻点灬大ji巴太粗太长了视 | 国产精品免费观看视频播放| 免费香蕉依人在线视频久| av潮喷大喷水系列无码| 日韩欧美亚洲天堂| 亚洲综合激情另类小说区| 艳妇乳肉豪妇荡乳AV| 婷婷六月久久综合丁香76| 久热中文字幕在线| 波多野结衣导航| 噗呲噗呲好爽轻点| 国产色丁香久久综合| 在线永久免费观看黄网站| 中文字幕亚洲综合久久综合| 波多野结衣在线免费电影| 国产ts人妖系列视频网站| 99精品人妻无码专区在线视频区| 日本护士xxxx视频| 亚洲国产精品久久人人爱| 男生被男生到爽动漫| 国产精品揄拍一区二区久久| 久久婷婷五月综合色欧美| 污污的网站免费在线观看| 又粗又硬又黄又爽的免费视频| 8x成人永久免费视频| 成人免费观看视频高清视频| 亚洲国产香蕉碰碰人人| 福利免费在线观看| 国产一级高清视频免费看| 亚洲五月综合网色九月色| 我的好妈妈6中字在线观看韩国| 亚洲av日韩av欧v在线天堂| 波多野结衣全部作品电影| 十八在线观观看免费视频| 露脸自拍[62p]| 国产特黄特色a级在线视| 99久久亚洲精品无码毛片| 日本视频在线免费| 人与禽交zozo| 美国十次狠狠色综合av|