Posted by Mohammad Rahhal, Last modified by Mohammad Ghawanmeh on 28 July 2015 10:45 AM



Public Sub StochasticMomentumIndexOnArray(ByVal OpenAry As Variant, ByVal HighAry As Variant, ByVal LowAry As Variant, ByVal CloseAry As Variant, ByVal kPeriod As Integer, ByVal kSmooth As Integer, ByVal kDoubleSmooth As Integer, ByVal Dperiod As Integer, ByVal MA_Type As Integer, ByVal PctD_MA_Type As Integer, ByVal mode As StochasticMEnum, ByRef Result As Variant)

Procedure that calculate Stochastic Momentum Index based on custom array, and the result passed by result parameter as array, each index of the result array represent indicator value corresponds to that index of the source array.


Parameter  Description 
OpenAry The open array
HighAry The High array
LowAry The low array
CloseAry The close array
kPeriod Period % k
kSmooth Slowing % k
kDoubleSmooth kDoubleSmooth
Dperiod Period % D
MA_Type An integer value of type ENUM_MA_METHOD
PctD_MA_Type An integer value
Result The Result Array

Return value

Returns a double value.


Public Sub main()

        Dim HighAry ()

        Dim LowAry ()

        Dim OpenAry ()

        Dim CloseAry ()

        Dim result()

        Dim kPeriod

        Dim kSmooth

        Dim Dperiod    

        Dim kDoubleSmooth

        Dim MA_Type

        Dim PctD_MA_Type

        Dim mode

        kPeriod = 13

        kSmooth = 25

        Dperiod = 9

        PctD_MA_Type = 2

        MA_Type = 1

        mode = 1

        KDoubleSmooth = 0

        CopyHigh 0, 1, Bars (0), HighAry

        CopyLow 0, 1, Bars (0), LowAry

        CopyOpen 0, 1, Bars (0), OpenAry

        CopyClose 0, 1, Bars (0), CloseAry

        StochasticMomentumIndexOnArray OpenAry, HighAry, LowAry, CloseAry, CInt(KPeriod), CInt(kSmooth), CInt(kDoubleSmooth), CInt(DPeriod), CInt(MA_Type), CInt(PctD_MA_Type), CInt(mode), Result

        AlertMessage "The indicator value of the record 50 : " & Result(50)

End Sub


See Also

Back to VTL Client Script Index

(0 vote(s))
Not helpful

Comments (0)
Post a new comment
Full Name:
CAPTCHA Verification 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).

Help Desk Software by Hybrid Solutions