Functions


Summary

This class contains valuable functions that apply to DataSeries.

Syntax

public static sealed class Functions : Object

Members

NameTypeSummary
HasCrossedAbove MethodReturns true, if dataseries1 has crossed above dataseries2, over the specified Period.
HasCrossedBelow MethodReturns true, if dataseries1 has crossed below dataseries2, over the specified Period.
IsFalling MethodChecks if the last value in a dataseries is less than the previous
IsRising MethodChecks if the last value in a dataseries is greater than the previous.
Maximum MethodFinds the maximum value in a dataseries for a given period.
Minimum MethodFinds the minimum of a dataseries for a given period.
Sum MethodCalculates the sum of a dataseries, over the specified period.

Example 1

//...
SimpleMovingAverage sma;
protected override void Initialize()
{
    sma = Indicators.SimpleMovingAverage(source, period);
}
public override void Calculate(int index)
{
    // IsRising returns true if the current value is greater
    // than the previous value in the data series
    if (Functions.IsRising(sma.Result))
    {
        //Do something
    }
    // IsFalling returns true if the current value is less
    // than the previous value in the data series 
    else if(Functions.IsFalling(sma.Result))
    {
        // Do something else
    }
    else // sma is level
    {
        Do something else
    }
    //...
}