Top methods return the highest or lowest values in a sequence, or the positions of those values.
In the C# API, analytics operate on
Sequencevalues obtained fromOrderedSequence<T>searches, direct ordered-sequence iteration,UnorderedSequence<T>.All, or positional projections such asquote.Close[dayRange].For an overview see page The C# Sequence Class
Operations
source.TopMax(int top)Returns the topnmaximum values.source.TopMin(int top)Returns the topnminimum values.source.TopPosMax(int top)Returns the positions of the topnmaximum values.source.TopPosMin(int top)Returns the positions of the topnminimum values.Example
This example uses
TopPosMaxtogether withTeeandMapto retrieve the top close prices and their matching volumes.Sequence[] topPositions = quote.Close.All.TopPosMax(10).Tee(); using (Sequence topClose = quote.Close.Map(topPositions[0])) using (Sequence topVolume = quote.Volume.Map(topPositions[1])) { while (topClose.Next(out float price) && topVolume.Next(out uint volume)) { printf("%s: price=%.3f, volume=%u\n", __arglist(quote.Symbol, (double)price, volume)); } } foreach (Sequence positionSequence in topPositions) { positionSequence.Dispose(); }