Moving Average

A moving average is a method of calculating the average value of a security's price, or indicator, over a period of time. The term "moving" implies, and rightly so, that the average changes or moves. When calculating a moving average, a mathematical analysis of the security's average value over a predetermined time period is made. As the security's price changes over time, its average price moves up or down.

The TA4.NET calculates three different types of moving averages: simple (also referred to as arithmetic), exponential and weighted.

The only significant difference between the various types of moving averages is the weight assigned to the most recent data. Simple moving averages apply equal weight to the prices. Exponential and weighted averages apply more weight to recent prices. Triangular averages apply more weight to prices in the middle of the time period. And variable moving averages change the weighting based on the volatility of prices.

Suntax:

Public Function MovAvg(ByVal MAIn() As Double, ByVal Lag As Long) As Double

Parameters:

  • ByVal MAIn() 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 array

    CloseValues = GetCloseValues()

    ' calculating Technical Analysis function

    Result = TA4Net.MovAvg(CloseValues, 14)

 


TA4.NET® Franz AG 2004©
Web site: http://www.ta4.net
e-mail: support@ta4.net

Browser Based Help. Published by chm2web software.