QuantStudio Financial Data Analysis and Trading Framework

SMA Class

Simple Moving Average (SMA)

For a list of all members of this type, see SMA Members.

System.Object
   RQuant.Indicator.TTimeArray
      RQuant.Indicator.TDoubleArray
         RQuant.Indicator.TIndicator
            RQuant.Indicator.SMA

[Visual Basic]
Public Class SMA
    Inherits TIndicator
[C#]
public class SMA : TIndicator

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

Moving averages are one of the oldest and most popular technical analysis tools, smoothing price fluctuations by averaging over some period. They are used to reveal trends, their drawback is delay of average value against price. Moving averages differ by averaging method applied:

- Simple Moving Average (SMA).
- Weighted Moving Average (WMA).
- Exponential Moving Average(SMA).
- Modified Exponential Moving Average (MSMA).

A moving average is the average price of a security at a given time. When calculating a moving average, you specify the time span to calculate the average price (e.g., 15 days).

This indicator is described in more details in the Steve Achelis' book "Technical Analysis from A to Z".

Formula:

Example

TDataManager.cd("Demo");

TDailyArray Daily1 = TDataManager.GetStock("YHOO").DailyArray;

DateTime Date1 = DateTime.Parse("1999/02/08"); 
DateTime Date2 = DateTime.Parse("2000/12/29"); 

TDailyArray Daily = Daily1.Clone(Date1, Date2);

TCanvas Canvas = new TCanvas("Canvas","SMA DEMO",600,400);
    
SMA SMA = new SMA(Daily, 14);

Canvas.cd(1);
Daily.Draw("c");

SMA.Draw(Color.Red);

Requirements

Namespace: RQuant.Indicator

Assembly: RQuant.Indicator (in RQuant.Indicator.dll)

See Also

SMA Members | RQuant.Indicator Namespace