---
id: "M:cAlgo.API.Internals.IIndicatorsAccessor.LinearRegressionRSquared(cAlgo.API.DataSeries,System.Int32)"
kind: "method"
type: "T:cAlgo.API.Internals.IIndicatorsAccessor"
url: "https://help.ctrader.com/ctrader-algo/references/Indicators/IIndicatorsAccessor/LinearRegressionRSquared/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# IIndicatorsAccessor.LinearRegressionRSquared

Member of [IIndicatorsAccessor](https://help.ctrader.com/ctrader-algo/references/Indicators/IIndicatorsAccessor/index.md).

## LinearRegressionRSquared(DataSeries source, int periods)

The R Squared or coefficient of determination indicator's main purpose is the confirm the strength of the market.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
LinearRegressionRSquared LinearRegressionRSquared(DataSeries source, int periods)
```

Python:

```python
api.Indicators.LinearRegressionRSquared(source: DataSeries, periods: int) -> LinearRegressionRSquared
```

### Parameters

- `source` (`DataSeries`, Python `DataSeries`): The source data used for calculation.
- `periods` (`int`, Python `int`): The value of the periods used for calculation.

### Returns

`LinearRegressionRSquared` — Linear Regression R-Squared indicator instance

### Examples

C#:

```csharp
var rSquared = Indicators.LinearRegressionRSquared(Bars.ClosePrices, 14);
Print("R squared: {0}", rSquared.Result.LastValue);
```

Python:

```python
rSquared = api.Indicators.LinearRegressionRSquared(api.Bars.ClosePrices, 14)
api.Print(f"R squared: {rSquared.Result.LastValue}")
```

