﻿ TrendLinePolynomial(SeriesCollection,Int32) Method
 Collapse All Expand All Language Filter: All Language Filter: Multiple Language Filter: Visual Basic (Declaration) Language Filter: Visual Basic (Usage) Language Filter: C#
 dotnetCHARTING Namespace > ForecastEngine Class > TrendLinePolynomial Method : TrendLinePolynomial(SeriesCollection,Int32) Method

sc
A collection of series objects. For example, to evaluate this indicator for two series you will need to pass a series collection containing this two series.
degree
The degree of the polynomial which is fitted to the data set given (i.e. if degree is 2, then a quadratic is fitted).
Fits a polynomial of a given degree to a data set in accordance with the least squares approach and returned the values of the fitted function over the same range of the x-coordinate as the given data set.

# Syntax

Visual Basic (Declaration)
```Public Overloads Shared Function TrendLinePolynomial( _
ByVal sc As SeriesCollection, _
ByVal degree As Integer _
) As SeriesCollection```
Visual Basic (Usage)Copy Code
``````Dim sc As SeriesCollection
Dim degree As Integer
Dim value As SeriesCollection

value = ForecastEngine.TrendLinePolynomial(sc, degree)``````
C#
```public static SeriesCollection TrendLinePolynomial(
SeriesCollection sc,
int degree
)```

#### Parameters

sc
A collection of series objects. For example, to evaluate this indicator for two series you will need to pass a series collection containing this two series.
degree
The degree of the polynomial which is fitted to the data set given (i.e. if degree is 2, then a quadratic is fitted).

# Remarks

For example, if we fit a polynomial of degree 2, then we fit the quadratic polynomial (i.e. f(x) = a_0 + a_1 x + a_2 x^2); similarly if we fit a polynomial of degree 3, then we fit the cubic polynomial (i.e. f(x) = a_0 + a_1 x + a_2 x^2 + a_3 x^3).