Hello,
The ROCP indicator seems to give incorrect data for short periods (e.g 25). For longer periods (e.g. 50) it seems to do fine. I've included what I am doing below. Am I doing something wrong?
Thanks so much.
class GetROC(QCAlgorithm):
def Initialize(self):
self.sym = 'DERM'
sym = self.sym
self.SetStartDate(2019, 1, 1) # Set Start Date
self.SetEndDate(2019, 4, 17) # Set Start Date
self.SetCash(20000) # Set Strategy Cash
self.UniverseSettings.Resolution = Resolution.Daily
self.AddEquity(sym, Resolution.Daily)
self.mysymROC = self.ROCP(sym, 25, Resolution.Daily)
self.RegisterIndicator(sym, self.mysymROC)
def OnData(self, data):
sym = self.sym
if self.mysymROC.IsReady:
if data.ContainsKey(sym):
if data[sym] is not None:
self.Debug("ROC: " + str(self.mysymROC.Current.Value))
JigLoveBaker
for example, for today it shows ROCP to be -15, while yahoo shows it as 67. why is it so different?
Link Liang
Hi,
We have a different data source, so it is expected to see slightly different data from what Yahoo provides.
Meanwhile, the main problem is that we don’t have to register indicator which is defined with our shortcut helper method. The ROCP() method has already taken care of registering. More information regarding usage of indicators is here.
In fact, by registering the indicator twice, it is updated twice a day and that is why the indictor gives wrong number. Just remove “self.RegisterIndicator(sym, self.mysymROC)” and it will be good to go.
Hope it helps!
JigLoveBaker
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!