# Forecasting Formula

The forecasting formula attempts to fit the historical data to a regression function and forecast future values of the data best on the best fit.

## Formula Details

## Syntax

```
Chart.DataManipulator.FinancialFormula(
FinancialFormula.Forecasting,
"RegressionType,Period,ApproxError,ForecastError",
"Historical",
"Forecast,UpperError,LowerError")
```

## Parameters

This formula takes four optional parameters.

RegressionType

Regression type. Use a numeral to indicate a polynomial regression of a specific degree, or one of the following to specify a different regression type: Linear, Exponential, Logarithmic, Power. The default value is 2, which is the same as Linear.Period

Forecasting period. The formula predicts data for this period of days into the future. The default value is half of the series' length.ApproxError

Whether to output the approximation error. If set to false, output error series contain no data for the corresponding historical data. The default value is true.ForecastError

Whether to output the forecasting error. If set to false, output error series contain the approximation error for all predicted data points if ApproxError is set to true. The default value is true.

## Input Values

This formula takes one input Y value.

- Historical

Historical data for forecasting.

## Output Value

This formula outputs three Y values.

Forecast

Forecasted values.UpperError

Upper bound error.LowerError

Lower bound error.

## Remarks

The Line chart type is a convenient chart type to display the forecasted values, and the Range chart type is a convenient chart type to display the error bounds.

## Example

The following example takes input from Series1 (Series1:Y) and outputs the forecast on Series2 (Series2:Y) and error bounds on Series3 (Series3:Y,Series3:Y2). It uses a second degree polynomial regression and a forecasting period of 40 days.

```
Chart1.DataManipulator.FinancialFormula (FinancialFormula.Forecasting, "2,40,true,true", "Series1:Y", "Series2:Y,Series3:Y,Series3:Y2")
```

```
Chart1.DataManipulator.FinancialFormula (FinancialFormula.Forecasting, "2,40,true,true", "Series1:Y", "Series2:Y,Series3:Y,Series3:Y2");
```

## See Also

#### Reference

System.Windows.Forms.DataVisualization.Charting

System.Web.UI.DataVisualization.Charting