Indicator Reference

Aroon Oscillator

Introduction

The Aroon Oscillator is the difference between AroonUp and AroonDown. The value of this indicator fluctuates between -100 and +100. An upward trend bias is present when the oscillator is positive, and a negative trend bias is present when the oscillator is negative. AroonUp/Down values over 75 identify strong trends in their respective direction.

Create Manual Indicators

You can manually create a AroonOscillator indicator, so it doesn’t automatically update. Manual indicators let you update their values with any data you choose. The following reference table describes the AroonOscillator constructor.

AroonOscillator()1/2

            AroonOscillator QuantConnect.Indicators.AroonOscillator (
     int  downPeriod
   )
        

Creates a new AroonOscillator from the specified up/down periods.

AroonOscillator()2/2

            AroonOscillator QuantConnect.Indicators.AroonOscillator (
     string  name,
     int     downPeriod
   )
        

Creates a new AroonOscillator from the specified up/down periods.

Update Manual Indicators

You can update the indicator automatically or manually.

Automatic Update

To register a manual indicator for automatic updates with the security data, call the RegisterIndicator method.


private AroonOscillator _aroon;

// In Initialize()
_aroon = new AroonOscillator(name, upPeriod, downPeriod);
_aroon.Updated += IndicatorUpdateMethod;

RegisterIndicator(symbol, _aroon, Resolution.Daily);

// In IndicatorUpdateMethod()
if (_aroon.IsReady)
{
    var indicatorValue = _aroon.Current.Value;
}
    
# In Initialize()
self.aroon = AroonOscillator(name, upPeriod, downPeriod)
self.aroon.Updated += self.IndicatorUpdateMethod

self.RegisterIndicator(symbol, self.aroon, Resolution.Daily)

# In IndicatorUpdateMethod()
if self.aroon.IsReady:
    indicator_value = self.aroon.Current.Value

To customize the data that automatically updates the indicator, see Custom Indicator Periods and Custom Indicator Values.

Manual Update

Updating your indicator manually enables you to control when the indicator is updated and what data you use to update it. To manually update the indicator, call the Update method with a TradeBar, QuoteBar, or an IndicatorDataPoint. The indicator will only be ready after you prime it with enough data.

    
private AroonOscillator _aroon;
private Symbol symbol;

// In Initialize()
_aroon = new AroonOscillator(upPeriod, downPeriod);
symbol = AddEquity("SPY").Symbol;

// In OnData()
if (data.QuoteBars.ContainsKey(_symbol))
{
    _aroon.Update(data.QuoteBars[symbol]);
}
if (_aroon.IsReady)
{
    var indicatorValue = _aroon.Current.Value;
}
    
# In Initialize()
self.aroon = AroonOscillator(upPeriod, downPeriod)
self.symbol = self.AddEquity("SPY").Symbol

# In OnData()
if data.QuoteBars.ContainsKey(self.symbol):
    self.aroon.Update(data.QuoteBars[self.symbol])
if self.aroon.IsReady:
    indicator_value = self.aroon.Current.Value

Create Automatic Indicators

The AROON method creates an AroonOscillator indicator, sets up a consolidator to update the indicator, and then returns the indicator so you can use it in your algorithm.

The following reference table describes the AROON method:

AROON()1/2

            AroonOscillator QuantConnect.Algorithm.QCAlgorithm.AROON (
    Symbol                                symbol,
    Int32                                 period,
    *Nullable<Resolution>           resolution,
    *Func<IBaseData, IBaseDataBar>  selector
   )
        

Creates a new AroonOscillator indicator which will compute the AroonUp and AroonDown (as well as the delta)

AROON()2/2

            AroonOscillator QuantConnect.Algorithm.QCAlgorithm.AROON (
    Symbol                                symbol,
    Int32                                 upPeriod,
    Int32                                 downPeriod,
    *Nullable<Resolution>           resolution,
    *Func<IBaseData, IBaseDataBar>  selector
   )
        

Creates a new AroonOscillator indicator which will compute the AroonUp and AroonDown (as well as the delta)


If you don't provide a resolution, it defauls to the security resolution. If you provide a resolution, it must be greater than or equal to the resolution of the security. For instance, if you subscribe to hourly data for a security, you should update its indicator with data that spans 1 hour or longer.

For more information about the selector argument, see Alternative Price Fields.

Get Indicator Values

To get the value of the indicator, use its Current.Value attribute.

private AroonOscillator _aroon;

// In Initialize()
var symbol = AddEquity("SPY").Symbol;
_aroon = AROON(symbol, upPeriod, downPeriod);

// In OnData()
if (_aroon.IsReady)
{
    var aroonUp = _aroon.AroonUp.Current.Value;
    var aroonDown = _aroon.AroonDown.Current.Value;
    var current = _aroon.Current.Value;
}
# In Initialize()
symbol = self.AddEquity("SPY").Symbol
self.aroon = self.AROON(symbol, upPeriod, downPeriod)

# In OnData()
if self.aroon.IsReady:
    aroon_up = self.aroon.AroonUp.Current.Value
    aroon_down = self.aroon.AroonDown.Current.Value
    current = self.aroon.Current.Value

Visualization

To plot indicator values, in the OnData event handler, call the Plot method.

private AroonOscillator _aroon;

// In Initialize()
var symbol = AddEquity("SPY").Symbol;
_aroon = AROON(symbol, upPeriod, downPeriod);

// In OnData()
if (_aroon.IsReady)
{
    Plot("My Indicators", "aroonup", _aroon.AroonUp);
    Plot("My Indicators", "aroondown", _aroon.AroonDown);
    Plot("My Indicators", "aroonoscillator", _aroon.Current);
}
# In Initialize()
symbol = self.AddEquity("SPY").Symbol
self.aroon = self.AROON(symbol, upPeriod, downPeriod)

# In OnData()
if self.aroon.IsReady:
    self.Plot("My Indicators", "aroonup", self.aroon.AroonUp)
    self.Plot("My Indicators", "aroondown", self.aroon.AroonDown)
    self.Plot("My Indicators", "aroonoscillator", self.aroon.Current)

For more information about plotting indicators, see Plotting Indicators.

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: