Syntax
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)
Description
A procedure that calculates Stochastic Momentum Index based on a custom array, and the result passed by result parameter as an array, each index of the result array represent indicator value corresponds to that index of the source array.
Parameters
Parameter | Description |
The open array | |
HighAry | The High array |
The low array |
|
CloseAry | The close array |
Period % k | |
Slowing % k | |
kDoubleSmooth | kDoubleSmooth |
Period % D | |
MA_Type | An integer value of typeENUM_MA_METHOD |
PctD_MA_Type | An integer value |
Result | The Result Array |
Return value
Returns a double value.
Sample
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