---
id: "T:cAlgo.API.Indicators.AcceleratorOscillator"
kind: "interface"
namespace: "cAlgo.API.Indicators"
url: "https://help.ctrader.com/ctrader-algo/references/Indicators/AcceleratorOscillator/"
---

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

# AcceleratorOscillator (interface)

Identifies possible trend reversals

Environments: Desktop supported · CLI supported · Cloud supported.

## Definition

```csharp
public interface AcceleratorOscillator
```

## Examples

C#:

```csharp
var acceleratorOscillator = Indicators.AcceleratorOscillator();
Print("Accelerator Oscillator: {0}", acceleratorOscillator.Result.LastValue);
```

Python:

```python
acceleratorOscillator = api.Indicators.AcceleratorOscillator()
api.Print(f"Accelerator Oscillator: {acceleratorOscillator.Result.LastValue}")
```

C#:

```csharp
using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo.Robots
{
    // This sample cBot shows how to use an Accelerator Oscillator indicator
    public partial class AcceleratorOscillatorSample : Robot
    {
        private double _volumeInUnits;

        private AcceleratorOscillator _acceleratorOscillator;

        public Position[] BotPositions
        {
            get
            {
                return Positions.FindAll(Label);
            }
        }

        protected override void OnStart()
        {
            _volumeInUnits = Symbol.QuantityToVolumeInUnits(VolumeInLots);

            _acceleratorOscillator = Indicators.AcceleratorOscillator();
        }

        protected override void OnBar()
        {
            foreach (var position in BotPositions)
            {
                if ((position.TradeType == TradeType.Buy && _acceleratorOscillator.Result.Last(1) < _acceleratorOscillator.Result.Last(2))
                    || (position.TradeType == TradeType.Sell && _acceleratorOscillator.Result.Last(1) > _acceleratorOscillator.Result.Last(2)))
                {
                    ClosePosition(position);
                }
            }

            if (_acceleratorOscillator.Result.Last(1) > 0 && _acceleratorOscillator.Result.Last(2) <= 0)
            {
                ExecuteMarketOrder(TradeType.Buy, SymbolName, _volumeInUnits, Label, StopLossInPips, TakeProfitInPips);
            }
            else if (_acceleratorOscillator.Result.Last(1) < 0 && _acceleratorOscillator.Result.Last(2) >= 0)
            {
                ExecuteMarketOrder(TradeType.Sell, SymbolName, _volumeInUnits, Label, StopLossInPips, TakeProfitInPips);
            }
        }
    }
}
```

Python:

```python
import clr

clr.AddReference("cAlgo.API")

# Import cAlgo API types
from cAlgo.API import *

# Import trading wrapper functions
from robot_wrapper import *

class AcceleratorOscillatorSample():
    def on_start(self):
        self.volumeInUnits = api.Symbol.QuantityToVolumeInUnits(api.VolumeInLots)
        self.acceleratorOscillator = api.Indicators.AcceleratorOscillator()

    def on_bar_closed(self):
        for position in self.get_bot_positions():
            if (position.TradeType == TradeType.Buy and self.acceleratorOscillator.Result.Last(0) < self.acceleratorOscillator.Result.Last(1)) or (position.TradeType == TradeType.Sell and self.acceleratorOscillator.Result.Last(0) > self.acceleratorOscillator.Result.Last(1)):
                api.ClosePosition(position)

        if self.acceleratorOscillator.Result.Last(0) > 0 and self.acceleratorOscillator.Result.Last(1) <= 0:
            api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, self.volumeInUnits, api.Label, api.StopLossInPips, api.TakeProfitInPips)
        elif (self.acceleratorOscillator.Result.Last(0) < 0 and self.acceleratorOscillator.Result.Last(1) >= 0):
            api.ExecuteMarketOrder(TradeType.Sell, api.SymbolName, self.volumeInUnits, api.Label, api.StopLossInPips, api.TakeProfitInPips)

    def get_bot_positions(self):
        return api.Positions.FindAll(api.Label)
```

config.json:

```json
{
  "AccessRights": "None",
  "TimeZone": "UTC",
  "Parameters": [
    {
      "Name": "VolumeInLots",
      "DisplayName": "Volume (Lots)",
      "Type": "Double",
      "DefaultValue": 0.01
    },
    {
      "Name": "StopLossInPips",
      "DisplayName": "Stop Loss (Pips)",
      "Type": "Double",
      "DefaultValue": 10
    },
    {
      "Name": "TakeProfitInPips",
      "DisplayName": "Take Profit (Pips)",
      "Type": "Double",
      "DefaultValue": 10
    },
    {
      "Name": "Label",
      "Type": "String",
      "DefaultValue": "Sample"
    }
  ]
}
```

## Properties

- `IndicatorDataSeries Result {get;}` — AcceleratorOscillator calculation result [details](https://help.ctrader.com/ctrader-algo/references/Indicators/AcceleratorOscillator/Result/index.md)

## Inherited members

- `ChartIndicator AddToChart()` (from StandardIndicator) [details](https://help.ctrader.com/ctrader-algo/references/General/StandardIndicator/AddToChart/index.md)
- `Symbol Symbol {get;}` (from StandardIndicator) [details](https://help.ctrader.com/ctrader-algo/references/General/StandardIndicator/Symbol/index.md)
- `TimeFrame TimeFrame {get;}` (from StandardIndicator) [details](https://help.ctrader.com/ctrader-algo/references/General/StandardIndicator/TimeFrame/index.md)
- `Bars Bars {get;}` (from StandardIndicator) [details](https://help.ctrader.com/ctrader-algo/references/General/StandardIndicator/Bars/index.md)

