Exponential Moving Average
An exponential (or exponentially weighted) moving average is calculated by
applying a percentage of today's closing price to yesterday's moving average
value.
For example, to calculate a 9% exponential moving average of IBM: First, we
would take today's closing price and multiply it by 9%. We would then add this
product to the value of yesterday's moving average multiplied by 91% (100% - 9%
= 91%).
Syntax:
Public Function ExpMovAvg(ByVal EMAIn() As Double, ByVal Lag As Long) As Double
Parameters:
- ByVal EMAIn() As Double
- ByVal Lag 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 arrays
CloseValues =
GetCloseValues()
' calculating Technical Analysis function
Result = TA4Net.ExpMovAvg(CloseValues, 14)
|