Hi,
I've been trying to filter a universe through a moving average and rsi, however, i havent been getting the expected results.
I started with the MA cross example and added an RSI indicator to debug what going on. I'm getting the following information for each symbol when i debug the symbol, fastMA, slowMA, price and rsi.
Ticker = AADR UOFRJAZTL0TH , Fast MA = 36.64 , Slow = 0.0 , Price = 36.64 , RSI =0.0
I'm sure this is a rookie mistake, but i seem to be getting 0 for both the slow moving average and rsi and then the same value for the price and fast moving average.
I've attached the backtest, Any help would be greatly appreciated
Michael Manus
hi Jing Wu
i think that is an old python example because its not working anymore?
this line does not update the slow moving average and rsi only fast sma:
if self.fast.Update(time, value) and self.slow.Update(time, value) and self.rsi.Update(time, value):doing this everything works fine:
def update(self, time, value): self.fast.Update(time, value) self.slow.Update(time, value) self.rsi.Update(time, value) fast = self.fast.Current.Value slow = self.slow.Current.Value rsi = self.rsi.Current.Value self.is_uptrend = fast > slow * self.tolerance
Michael Manus
Glenn Wilson
Hi Michael,
Thank you for the comment.
That helps to update the slow and rsi, however, it still gives an unexpected result
Ticker = AFSD VAAHQ09OPU1X , Fast MA = 25.0 , Slow = 25.0 , Price = 25 , RSI =100.0
For all the symbols, rsi = 100 and the fast MA, slow MA and Price are always equal.
Michael Manus
I was not very well in math but glenn how did you set the test period?
start and enddate.......i am asking because the resolution is set to daily and you have
ExponentialMovingAverage(300)..................................................
is that a 300 day ex. moving average? :)
Glenn Wilson
Yes, it was meant to be a 300 day moving average.
I feel very silly, i was testing it on a non-trading day and wondering why i wasnt getting the correct results. I would have still expected the moving averages to have shown correctly though.
Thanks again!
Michael Manus
try to warming up so you see the values at start
https://www.quantconnect.com/docs#Historical-Data
Glenn Wilson
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!