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

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

# IIndicatorsAccessor.RainbowOscillator

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

## RainbowOscillator(DataSeries source, int levels, MovingAverageType maType)

The Rainbow Oscillator is a process of repetitive smoothing of simple moving averages resulting in a full spectrum of trends.

Environments: Desktop supported · CLI supported · Cloud supported.

C#:

```csharp
RainbowOscillator RainbowOscillator(DataSeries source, int levels, MovingAverageType maType)
```

Python:

```python
api.Indicators.RainbowOscillator(source: DataSeries, levels: int, maType: MovingAverageType) -> RainbowOscillator
```

### Parameters

- `source` (`DataSeries`, Python `DataSeries`): The price source data used for calculation.
- `levels` (`int`, Python `int`): The value of the levels used for calculation.
- `maType` (`MovingAverageType`, Python `MovingAverageType`): The Moving Average type used for calculation.

### Returns

`RainbowOscillator` — The Rainbow Oscillator instance.

### Examples

C#:

```csharp
var rainbow = Indicators.RainbowOscillator(Bars.ClosePrices, 9, MovingAverageType.Simple);
Print("Rainbow Oscillator: {0}", rainbow.Result.LastValue);
```

Python:

```python
rainbow = api.Indicators.RainbowOscillator(api.Bars.ClosePrices, 9, MovingAverageType.Simple)
api.Print(f"Rainbow Oscillator: {rainbow.Result.LastValue}")
```

