MACD
The Moving Average Convergence/Divergence indicator (MACD) is calculated by
subtracting the value of a 0.075 (26-period) exponential moving average from a
0.15 (12-period) exponential moving average.
Most analysts say that the MACD indicator is "the difference between 12-day
and 26-day exponential moving averages." However, the indicator is really the
difference between 0.15 and 0.075 exponential moving averages (whereas, when
expressed in decimal form, the 12- and 26-day exponential moving averages are
actually 0.153846 and 0.076923 exponential moving averages).
Syntax:
Public Function MACD(ByVal MACDIn() As Double, ByVal Lag1 As Long, ByVal Lag2 As Long) As Double
Parameters:
- ByVal MACDIn() As Double
- ByVal Lag1 As Long
- ByVal Lag2 As Long
Back to list
Example:
Dim TA4Net As
New TA4Net.CTAFunctions("YOUR-REGISTRATION-CODE")
Dim Result() As
Double
Dim CloseValues() As
Double
' loading values to array
CloseValues =
GetCloseValues()
' calculating Technical Analysis function
Result = TA4Net.MACD(CloseValues, 12, 26)
|