Back

How to register VWAP consolidated indicator

I am trying to register a consolidated VWAP but I get:

SystemError : <bound method 'RegisterIndicator'> returned a result with an error set

fiveMinutesConsolidator = TradeBarConsolidator(timedelta(minutes=5))
fiveMinutesConsolidator.DataConsolidated += self.fiveMinutesBarHandler
self.SubscriptionManager.AddConsolidator("SPY", fiveMinutesConsolidator)

self._ema10 = ExponentialMovingAverage(10)
self._ema20 = ExponentialMovingAverage(20)
self._vwap20 = VolumeWeightedAveragePriceIndicator(20)

self.RegisterIndicator("SPY", self._ema10, fiveMinutesConsolidator)
self.RegisterIndicator("SPY", self._ema20, fiveMinutesConsolidator)
self.RegisterIndicator("SPY", self._vwap20, fiveMinutesConsolidator)

self._ema10.Updated += self._ema10Updated
self._ema20.Updated += self._ema20Updated
self._vwap20.Updated += self._vwap20Updated
self._ema10Win = RollingWindow[IndicatorDataPoint](20)
self._ema20Win = RollingWindow[IndicatorDataPoint](20)
self._vwap20Win = RollingWindow[IndicatorDataPoint](20)

Update Backtest







Pier,

QC provided a new framework for working with larger algos. their idea is to plug items together like risk manager and alpha manager ant that stuff. In works almost the same as the standard one file algo. You only have to find the right spot to put your code. That is an register indicator example from the mentioned framework:

https://github.com/QuantConnect/Lean/blob/3b8273c079ec47615556ba4b0329113179a6f61a/Algorithm.Framework/Execution/VolumeWeightedAveragePriceExecutionModel.py

line 125

the framework:

https://www.quantconnect.com/forum/discussion/3682/algo-framework-etf-momentum-rebalancing-using-mean-variance-optimization

More register indicator examples:

https://github.com/QuantConnect/Lean/search?l=Python&q=RegisterIndicator&type=
0

It seems that that their classical VWAP doesn't to support intraday. In their execution model they have a IntradayVwap class. This one works, I can consolidate it and put it in a Rollingwindow.

0

There is an intraday VWAP Indicator in the documentation. If you want to use the class directly you'll have to call Update() method.

Check the examples -- 

https://github.com/QuantConnect/Lean/blob/cbd953437f987392f2c2e154adcb7d43d684b7f1/Algorithm.Python/EmaCrossUniverseSelectionAlgorithm.py#L102

0

Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed