Click or drag to resize

Second Raw Moment

The second raw moment (SecondRawMoment) (SRM) is defined as the mean square (the arithmetic mean of the squares of a set of numbers). The second raw moment is the square of the (RootMeanSquare).

Calculation

In the case of a set of N values Specification 029, the SRM is

Second Raw Moment 002

Chart Example

Second Raw Moment 003

Implementation and Usage

To initialize indicator, use one of the following constructors:

SecondRawMoment – set default values: period = 14

SecondRawMoment(Int32) – set value for period

SecondRawMoment(TimeSpan) – sets time period

Use

SRM - property to get current value

Example
C#
 1// Create new instance
 2var indicator = new SecondRawMoment(28);
 3
 4// Number of stored values
 5indicator.HistoryCapacity = 2;
 6
 7// Add new data point
 8indicator.Add(CurrentPrice);
 9
10// Get indicator value
11double IndicatorValue = indicator.SRM;
12// Get previous value
13if (indicator.HistoryCount == 2)
14{
15    double IndicatorPrevValue = indicator[1];
16}