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

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

# IIndicatorsAccessor.VariableIndexDynamicAverage

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

## VariableIndexDynamicAverage(DataSeries source, int cmoPeriods, int smoothPeriods)

The Variable Index Dynamic Average (VIDYA) indicator is a type of moving average that dynamically adjusts its smoothing period based on market volatility.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
VariableIndexDynamicAverage VariableIndexDynamicAverage(DataSeries source, int cmoPeriods, int smoothPeriods)
```

Python:

```python
api.Indicators.VariableIndexDynamicAverage(source: DataSeries, cmoPeriods: int, smoothPeriods: int) -> VariableIndexDynamicAverage
```

### Parameters

- `source` (`DataSeries`, Python `DataSeries`): The source data used for calculation.
- `cmoPeriods` (`int`, Python `int`): The value of the periods used for the Chande Momentum Oscillator (CMO) calculation.
- `smoothPeriods` (`int`, Python `int`): The value of the periods used for the volatility smoothing factor calculation.

### Returns

`VariableIndexDynamicAverage` — 

### Examples

C#:

```csharp
var vidya = Indicators.VariableIndexDynamicAverage(Bars.ClosePrices, 9, 12);
Print("VIDYA(9, 12): {0}", vidya.Result.LastValue);
```

Python:

```python
vidya = api.Indicators.VariableIndexDynamicAverage(api.Bars.ClosePrices, 9, 12)
api.Print(f"VIDYA(9, 12): {vidya.Result.LastValue}")
```

## VariableIndexDynamicAverage(int cmoPeriods, int smoothPeriods)

The Variable Index Dynamic Average (VIDYA) indicator is a type of moving average that dynamically adjusts its smoothing period based on market volatility.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
VariableIndexDynamicAverage VariableIndexDynamicAverage(int cmoPeriods, int smoothPeriods)
```

Python:

```python
api.Indicators.VariableIndexDynamicAverage(cmoPeriods: int, smoothPeriods: int) -> VariableIndexDynamicAverage
```

### Parameters

- `cmoPeriods` (`int`, Python `int`): The value of the periods used for the Chande Momentum Oscillator (CMO) calculation.
- `smoothPeriods` (`int`, Python `int`): The value of the periods used for the volatility smoothing factor calculation.

### Returns

`VariableIndexDynamicAverage` — 

### Examples

C#:

```csharp
var vidya = Indicators.VariableIndexDynamicAverage(9, 12);
if (Bars.ClosePrices.LastValue > vidya.Result.LastValue)
    Print("Price is above VIDYA {0}", vidya.Result.LastValue);
```

Python:

```python
vidya = api.Indicators.VariableIndexDynamicAverage(9, 12)
if api.Bars.ClosePrices.LastValue > vidya.Result.LastValue:
    api.Print(f"Price is above VIDYA {vidya.Result.LastValue}")
```

