Supported Indicators

Augen Price Spike

Introduction

The Augen Price Spike indicator is an indicator that measures price changes in terms of standard deviations. In the book, The Volatility Edge in Options Trading, Jeff Augen describes a method for tracking absolute price changes in terms of recent volatility, using the standard deviation. length = x closes = closeArray closes1 = closeArray shifted right by 1 closes2 = closeArray shifted right by 2 closeLog = np.log(np.divide(closes1, closes2)) SDev = np.std(closeLog) m = SDev * closes1[-1] spike = (closes[-1]-closes1[-1])/m return spike Augen Price Spike from TradingView https://www.tradingview.com/script/fC7Pn2X2-Price-Spike-Jeff-Augen/

To view the implementation of this indicator, see the LEAN GitHub repository.

Using APS Indicator

To create an automatic indicators for AugenPriceSpike, call the APS helper method from the QCAlgorithm class. The APS method creates a AugenPriceSpike object, hooks it up for automatic updates, and returns it so you can used it in your algorithm. In most cases, you should call the helper method in the Initializeinitialize method.

public class AugenPriceSpikeAlgorithm : QCAlgorithm
{
    private Symbol _symbol;
    private AugenPriceSpike _aps;

    public override void Initialize()
    {
        _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
        _aps = APS(_symbol, 3);
    }

    public override void OnData(Slice data)
    {
        if (_aps.IsReady)
        {
            // The current value of _aps is represented by itself (_aps)
            // or _aps.Current.Value
            Plot("AugenPriceSpike", "aps", _aps);
            
        }
    }
}
class AugenPriceSpikeAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self._symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
        self.aps = self.APS(self.symbol, 3)

    def on_data(self, slice: Slice) -> None:
        if self.aps.IsReady:
            # The current value of self.aps is represented by self.aps.Current.Value
            self.plot("AugenPriceSpike", "aps", self.aps.Current.Value)
            

The following reference table describes the APS method:

APS()1/1

            AugenPriceSpike QuantConnect.Algorithm.QCAlgorithm.APS (
    Symbol                           symbol,
    *Int32                           period,
    *Nullable<Resolution>      resolution,
    *Func<IBaseData, Decimal>  selector
   )
        

Creates an AugenPriceSpike indicator for the symbol. The indicator will be automatically updated on the given 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.

For more information about plotting indicators, see Plotting Indicators.

You can manually create a AugenPriceSpike indicator, so it doesn't automatically update. Manual indicators let you update their values with any data you choose.

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 Updateupdate method with time/number pair or an IndicatorDataPoint. The indicator will only be ready after you prime it with enough data.

public class AugenPriceSpikeAlgorithm : QCAlgorithm
{
    private Symbol _symbol;
    private AugenPriceSpike _aps;

    public override void Initialize()
    {
        _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
        _aps = new AugenPriceSpike(3);
    }

    public override void OnData(Slice data)
    {
        if (data.Bars.TryGetValue(_symbol, out var bar))
        {      
            _aps.Update(bar.EndTime, bar.Close);
        }
   
        if (_aps.IsReady)
        {
            // The current value of _aps is represented by itself (_aps)
            // or _aps.Current.Value
            Plot("AugenPriceSpike", "aps", _aps);
            
        }
    }
}
class AugenPriceSpikeAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self._symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
        self.aps = AugenPriceSpike(3)

    def on_data(self, slice: Slice) -> None:
        bar = slice.Bars.get(self.symbol)
        if bar:
            self.aps.Update(bar.EndTime, bar.Close)
        if self.aps.IsReady:
            # The current value of self.aps is represented by self.aps.Current.Value
            self.plot("AugenPriceSpike", "aps", self.aps.Current.Value)
            

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

public class AugenPriceSpikeAlgorithm : QCAlgorithm
{
    private Symbol _symbol;
    private AugenPriceSpike _aps;

    public override void Initialize()
    {
        _symbol = AddEquity("SPY", Resolution.Daily).Symbol;
        _aps = new AugenPriceSpike(3);
        RegisterIndicator(_symbol, _aps, Resolution.Daily);
    }

    public override void OnData(Slice data)
    {
        if (_aps.IsReady)
        {
            // The current value of _aps is represented by itself (_aps)
            // or _aps.Current.Value
            Plot("AugenPriceSpike", "aps", _aps);
            
        }
    }
}
class AugenPriceSpikeAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self._symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
        self.aps = AugenPriceSpike(3)
        self.RegisterIndicator(self.symbol, self.aps, Resolution.Daily)

    def on_data(self, slice: Slice) -> None:
        if self.aps.IsReady:
            # The current value of self.aps is represented by self.aps.Current.Value
            self.plot("AugenPriceSpike", "aps", self.aps.Current.Value)
            

The following reference table describes the AugenPriceSpike constructor:

AugenPriceSpike()1/2

            AugenPriceSpike QuantConnect.Indicators.AugenPriceSpike (
    *int  period
   )
        

Initializes a new instance of the AugenPriceSpike class using the specified period.

AugenPriceSpike()2/2

            AugenPriceSpike QuantConnect.Indicators.AugenPriceSpike (
    string  name,
    int     period
   )
        

Creates a new AugenPriceSpike indicator with the specified period.

Visualization

The following image shows plot values of selected properties of AugenPriceSpike using the plotly library.

AugenPriceSpike line plot.

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: