Conditional sequence methods apply Boolean sequence results to choose values, filter rows, or locate matching positions.
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
condition.If(thenSequence, otherwiseSequence, bool lazy)Returns a sequence that selects values fromthenSequenceorotherwiseSequencebased on each Boolean element.source.Filter(condition)Returns only the elements ofsourcewhose corresponding condition element istrue.condition.FilterPos()Returns the positions of the elements where the Boolean condition istrue.Example
The C# samples use
Filterto keep only the days where the close price is greater than the open price.using (Sequence dayRange = quote.Day.Search(20130101u, SelectBoundary.Inclusive, 20130401u, SelectBoundary.Inclusive)) { PrintIntSequence(quote, dayRange.Filter(quote.Close[dayRange] > quote.Open[dayRange])); }