---
id: "M:cAlgo.API.Indicator.Calculate(System.Int32)"
kind: "method"
type: "T:cAlgo.API.Indicator"
url: "https://help.ctrader.com/ctrader-algo/references/General/Indicator/Calculate/"
---

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

# Indicator.Calculate

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

## Calculate(int index)

Calculate the value(s) of indicator for the given index.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
public abstract void Calculate(int index)
```

Python:

```python
api.Calculate(index: int) -> None
```

### Parameters

- `index` (`int`, Python `int`): The index of calculated value.

### Examples

C#:

```csharp
public partial class MedianPriceIndicator : Indicator
{
    public override void Calculate(int index)
    {
        Result[index] = (Bars.HighPrices[index] + Bars.LowPrices[index]) / 2;
    }
}
```

Python:

```python
def calculate(self, index):
    api.Result[index] = (api.Bars.HighPrices[index] + api.Bars.LowPrices[index]) / 2
```

config.json:

```json
{
  "AccessRights": "None",
  "IsOverlay": true,
  "LineOutputs": [
    {
      "Name": "Result",
      "DisplayName": "Main"
    }
  ]
}
```

