Hello,
I am entirely new to QuantConnect's Algo Lab feature and I'm trying my hand at a simple python algorithm that enters long when the RSI is < 30, and closes the open position when RSI > 70. It’s not a great strategy, but I just wanted to get the basics down. My code processes fine, but the results don’t seems to generate any data? Assistance would be greatly appreciated.
Jared Broad
Check out this demonstration Kaleigh ; with LEAN you only create the indicators once -
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.
Kaleigh
Thank you very much Jared! That is exactly the information I was looking for.
The help is greatly appreciated!
Ali Izzet Metin
This helped me greatly as well thanks Jared
Karthick Aravindan
Jared Broad What about If I need to run on multiple stocks or QC500 UniverseÂ
Jared Broad
Hi Karthick Aravindan since 2018 we've published 20 Boot Camp tutorials which step you line by line how to do everything in QuantConnect =). I see you've done them all -- this was covered in the 200-50 EMA Universe which you've done. I suggest redoing them if you need a refresher!Â
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.
James Goldberg
Jared -Â
I am trying to apply a similar strategy to "SPY" however i am getting the same result as Kaleigh. At first, i attempted to simply switch out the Forex for Equity.. but that didn't seem to work. I tried to simplify the code even more but no luck. Any advice?
Â
import numpy as np class BasicTemplateAlgorithm(QCAlgorithm): '''Basic template algorithm simply initializes the date range and cash''' def Initialize(self): self.SetStartDate(2017,1, 1) #Set Start Date self.SetEndDate(2017,7,31) #Set End Date self.SetCash(100000) #Set Strategy Cash self.AddEquity("SPY", Resolution.Minute) self.rsi = self.RSI("SPY", 14) def OnData(self, data): if not self.rsi.IsReady: return if self.rsi.Current.Value < 25 and self.Portfolio["SPY"].Invested <= 0: self.MarketOrder("SPY", 25000) if self.rsi.Current.Value > 50: self.Liquidate() def OnEndOfDay(self): self.Plot("Indicators","RSI", self.rsi.Current.Value)
Â
Vncne
Hi James GoldbergÂ
I modified it a bit by adding a self.WarmUp for the indicator and removed some other things and got it to work, I attached the version to this post.
James Goldberg
Thank you Vncne!Â
Quick question, how do you reference someone in comment? Like you did with my profile name..
Jasper van Merle
James Goldberg if you type the at-sign ("@") in the editor and start typing someone's name a dropdown will show letting you select the user you want to reference.
Kaleigh
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!