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

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

# IIndicatorsAccessor.MassIndex

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

## MassIndex(int periods)

The Mass Index indicator is used to predict trend reversals.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
MassIndex MassIndex(int periods)
```

Python:

```python
api.Indicators.MassIndex(periods: int) -> MassIndex
```

### Parameters

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

### Returns

`MassIndex` — Mass Index indicator instance

### Examples

C#:

```csharp
var massIndex = Indicators.MassIndex(9);
if (massIndex.Result.LastValue > 27)
    Print("Mass Index reversal bulge: {0}", massIndex.Result.LastValue);
```

Python:

```python
massIndex = api.Indicators.MassIndex(9)
if massIndex.Result.LastValue > 27:
    api.Print(f"Mass Index reversal bulge: {massIndex.Result.LastValue}")
```

## MassIndex(Bars bars, int periods)

The Mass Index indicator is used to predict trend reversals.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
MassIndex MassIndex(Bars bars, int periods)
```

Python:

```python
api.Indicators.MassIndex(bars: Bars, periods: int) -> MassIndex
```

### Parameters

- `bars` (`Bars`, Python `Bars`): The Bars that will be used by indicator, you can pass another timeframe/symbol bars
- `periods` (`int`, Python `int`): The value of the periods used for calculation.

### Returns

`MassIndex` — Mass Index indicator instance

### Examples

C#:

```csharp
var dailyBars = MarketData.GetBars(TimeFrame.Daily);
var dailyMassIndex = Indicators.MassIndex(dailyBars, 9);
Print("Daily Mass Index: {0}", dailyMassIndex.Result.LastValue);
```

Python:

```python
dailyBars = api.MarketData.GetBars(TimeFrame.Daily)
dailyMassIndex = api.Indicators.MassIndex(dailyBars, 9)
api.Print(f"Daily Mass Index: {dailyMassIndex.Result.LastValue}")
```

