Supported Indicators

Advance Decline Volume Ratio

Introduction

The Advance Decline Volume Ratio is a Breadth indicator calculated as ratio of summary volume of advancing stocks to summary volume of declining stocks. AD Volume Ratio is used in technical analysis to see where the main trading activity is focused.

Create Manual Indicators

You can manually create a AdvanceDeclineVolumeRatio 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 AdvanceDeclineVolumeRatio constructor.

AdvanceDeclineVolumeRatio()1/1

            AdvanceDeclineVolumeRatio QuantConnect.Indicators.AdvanceDeclineVolumeRatio (
     string  name
   )
        

Initializes a new instance of the AdvanceDeclineVolumeRatio class.

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 AdvanceDeclineVolumeRatio _advr;

// In Initialize()
_advr = new AdvanceDeclineVolumeRatio();
_advr.Updated += IndicatorUpdateMethod;

RegisterIndicator(symbol, _advr, Resolution.Daily);

// In IndicatorUpdateMethod()
if (_advr.IsReady)
{
    var indicatorValue = _advr.Current.Value;
}
    
# In Initialize()
self.advr = AdvanceDeclineVolumeRatio()
self.advr.Updated += self.IndicatorUpdateMethod

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

# In IndicatorUpdateMethod()
if self.advr.IsReady:
    indicator_value = self.advr.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. The indicator will only be ready after you prime it with enough data.

    
private AdvanceDeclineVolumeRatio _advr;
private List<Symbol> symbols;

// In Initialize()
_advr = new AdvanceDeclineVolumeRatio();
symbols = new List<Symbol> {AddEquity("SPY").Symbol, AddEquity("QQQ").Symbol};

// In OnData()
if (data.Bars.ContainsKey(_symbol))
{
    _advr.Update(data.Bars[symbol]);
}
if (_advr.IsReady)
{
    var indicatorValue = _advr.Current.Value;
}
    
# In Initialize()
self.advr = AdvanceDeclineVolumeRatio()
self.symbols = [self.AddEquity("SPY").Symbol, self.AddEquity("QQQ").Symbol]

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

Create Automatic Indicators

The ADVR method creates an AdvanceDeclineVolumeRatio 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 ADVR method:

ADVR()1/1

            AdvanceDeclineVolumeRatio QuantConnect.Algorithm.QCAlgorithm.ADVR (
    IEnumerable<Symbol>    symbols,
    *Nullable<Resolution>  resolution
   )
        


If you don't provide a resolution, it defaults 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 AdvanceDeclineVolumeRatio _advr;

// In Initialize()
var symbols = new[] {AddEquity("SPY").Symbol, AddEquity("QQQ").Symbol};
_advr = ADVR(symbols);

// In OnData()
if (_advr.IsReady)
{
    var current = _advr.Current.Value;
}
# In Initialize()
symbols = [self.AddEquity("SPY").Symbol, self.AddEquity("QQQ").Symbol]
self.advr = self.ADVR(symbols)

# In OnData()
if self.advr.IsReady:
    current = self.advr.Current.Value

Visualization

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

private AdvanceDeclineVolumeRatio _advr;

// In Initialize()
var symbols = new[] {AddEquity("SPY").Symbol, AddEquity("QQQ").Symbol};
_advr = ADVR(symbols);

// In OnData()
if (_advr.IsReady)
{
    Plot("My Indicators", "advancedeclinevolumeratio", _advr.Current);
}
# In Initialize()
symbols = [self.AddEquity("SPY").Symbol, self.AddEquity("QQQ").Symbol]
self.advr = self.ADVR(symbols)

# In OnData()
if self.advr.IsReady:
    self.Plot("My Indicators", "advancedeclinevolumeratio", self.advr.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: