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

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

# IIndicatorsAccessor.PriceOscillator

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

## PriceOscillator(DataSeries source, int longCycle, int shortCycle, MovingAverageType maType)

The Price Oscillator calculates the difference between two moving averages.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
PriceOscillator PriceOscillator(DataSeries source, int longCycle, int shortCycle, MovingAverageType maType)
```

Python:

```python
api.Indicators.PriceOscillator(source: DataSeries, longCycle: int, shortCycle: int, maType: MovingAverageType) -> PriceOscillator
```

### Parameters

- `source` (`DataSeries`, Python `DataSeries`): The price source data used for calculation.
- `longCycle` (`int`, Python `int`): The long period used for calculation.
- `shortCycle` (`int`, Python `int`): The short period used for calculation.
- `maType` (`MovingAverageType`, Python `MovingAverageType`): Type of the Moving Average.

### Returns

`PriceOscillator` — The Price Oscillator indicator instance.

### Examples

C#:

```csharp
var priceOscillator = Indicators.PriceOscillator(Bars.ClosePrices, 26, 12, MovingAverageType.Simple);
Print("Price Oscillator of the last closed bar: {0}", priceOscillator.Result.Last(1));
```

Python:

```python
priceOscillator = api.Indicators.PriceOscillator(api.Bars.ClosePrices, 26, 12, MovingAverageType.Simple)
api.Print(f"Price Oscillator of the last closed bar: {priceOscillator.Result.Last(1)}")
```

