Hello,
I am trying to calculate the difference between the stock price and the vwap. For some reason the attached code does not work using indicatorExtensions.Minus.
Any help would be great.
Tate
QUANTCONNECT COMMUNITY
Hello,
I am trying to calculate the difference between the stock price and the vwap. For some reason the attached code does not work using indicatorExtensions.Minus.
Any help would be great.
Tate
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.
Maurício Cordeiro
Hi Tate,
When I use the Identity indicator, I register it with the function self.RegisterIndicator to feed it with the desired data. The identity is just needs to be updated (manually or by registering it), like so:
Take a look at the backtest I attached in the following discussion:
Vladimir
Tate Linzel
You can get the difference between the stock price and the vwap without
Indicator Extenions.Minus
Tate Linzel
Hi Valadimir,
I was looking to use the IndicatorExtension in the "initialize" section in order to calculate a moving average and other indicators using this “difference” value as a data source. This is not possible when you do it in the “Ondata” section. Is it possible to do it in the “Initialize” section without the "identity" setup? what does this not work “self.Diff = IndicatorExtensions.Minus(self.SecondMA, self.Vwap)” if the self.SecondMA is a 1 minute SMA of the symbol hence giving you the latest stock price?
Vladimir
Tate Linzel,
My backtests conform there is a bug in IndicatorExtensions.Minus()
No problem with self.Vwap = self.VWAP(self.stock) # OK
I tried three ways to get current price
They match perfectly.
Until the bug is fixed you have at least 3 ways to achieve your goal
without using IndicatorExtensions.Minus()
Tate Linzel
Thank you for the update Vladimir, is there a GitHub page for this bug so I know when it is fixed or when do you think this bug will be fixed?
Thank you for your efforts.
Tate
Vladimir
Another test shows that IndicatorExtensions.Minus works correctly with two simple moving averages, but not with self.VWAP.
Tate Linzel
So the bug is that IndicactorExtensions.Minus does not like using self.VWAP. I have tested it with it being self.Diff = IndicatorExtensions.Minus(self.Vwap, 2) and this works.
Is there any timeline for when this might get fixed?
Louis Szeto
Hi Tate, Vladimir
Thank you for reporting this issue. We're able to reproduce this problem and will fix as soon as possible. Please subscribed to this GH issue to follow our progress
Best
Louis Szeto
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.
Tate Linzel
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!