Window Aggregate Methods in C#

Window aggregate methods calculate moving aggregates over a sliding window of the requested size.

In the C# API, analytics operate on Sequence values obtained from OrderedSequence<T> searches, direct ordered-sequence iteration, UnorderedSequence<T>.All, or positional projections such as quote.Close[dayRange].

For an overview, see page The C# Sequence Class

Operations

source.WindowAggMax(int interval)
Moving maximum.
source.WindowAggMin(int interval)
Moving minimum.
source.WindowAggSum(int interval)
Moving sum.
source.WindowAggAvg(int interval)
Moving average.
source.WindowAggVar(int interval)
Moving variance.
source.WindowAggVarSamp(int interval)
Moving sample variance.
source.WindowAggDev(int interval)
Moving standard deviation.
source.WindowAggDevSamp(int interval)
Moving sample standard deviation.
source.WindowAggEma(int period)
Exponential moving average.
source.WindowAggAtr(int period)
Average true range.

Example

The seqapi sample uses two moving averages and Cross(1) to locate crossover points.

    using (Sequence crossDates = quote.Day.Map(
        (quote.Close.All.WindowAggAvg(20) - quote.Close.All.WindowAggAvg(5)).Cross(1)))
    {
        PrintIntSequence(quote, crossDates);
    }