LinearRegressionIntercept


Summary

The Linear Regression Intercept can be used together with the Linear Regression Slope indicator to plot the Linear Regression Line.

Syntax

public LinearRegressionIntercept LinearRegressionIntercept(DataSeries source, int periods)

Parameters

NameDescription

Example 1

[Parameter("Period", DefaultValue = 14)]
public int Period { get; set; }
protected override void OnStart()
{
    // initialize a new instance of LinearRegressionIntercept indicator class
    _linearRegressionIntercept = Indicators.
        LinearRegressionIntercept(MarketSeries.Close, Period);
}
protected override void OnBar(int index)
{
    // Result of _linearRegressionIntercept at the current index
    double result = _linearRegressionIntercept.Result[index];
    // Print the current result to the log
    Print("Linear Regression Intercept at the current index is = {0}", result);
}