Quant League is evolving into Strategies, our new home for sharing, discovering, and exploring trading strategies, with improved organization and a better overall experience. Q4-2025 will be the final Quant League.
LEAN is the open-source algorithmic trading engine powering QuantConnect.
Founded in 2012 LEAN has been built by a global community of 180+ engineers and powers more than 300+ hedge funds today.
Join Our Discord Channel
Join QuantConnect's Discord server for real-time support, where a vibrant community of traders and developers awaits to help you with any of your QuantConnect needs.
This research is under review. To publish this research attract three community upvotes.
This research is under review. To publish this research attract three community upvotes.
This discussion is a draft. Click here to publish this discusison.
Algorithmic Trading Video Course #5
Hi everyone,
I hope you're enjoying my free algorithmic trading video series. If you want to clone the code and algorithm from the 5th video of the series, you can do so by clicking on "Clone Algorithm" on the attached backtest below.
If you have any questions or comments, don't hesitate to let me know.
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.
Mo
77 Pro
,
Hi Louis , and thank you for the amazing tutorials,
Just having a hard time achieving the :
if (self.Time - self.stopMarketOrderFillTime).days < 30:
The number is very large , something like 736771 ??
I am using lean CLI with Pycharm debug, Do I need to use the portal to satisfy the condition? maybe time zone?
Best Regards
Mo
Loisray
10 Pro
,
AlertGreenKitten' object has no attribute 'stopMarketTicket' at OnData if self.stopMarketTicket is not None and self.Portfolio.Invested: at Python.Runtime.PythonException.ThrowLastAsClrException() at Python.Runtime.PyObject.Invoke(PyTuple args in main.py: line 41
Anthony Bergeron Burns
19 Pro
,
Hello,
I am getting an error saying, 'QCAlgorithm' not defined.
I have entered the code myself, and copied it from here.
Does QCAlgorithm not exist anymore?
Thank you,
Anthony
Shahrokh Kamyab
38 Pro
,
Hello Louis! I get error on this line: self.entryTime = datetime.min
Seems like lowercase “datetime” is not defined and has no attribute “min”
I was not able to see any error with “self.entryTime = datetime.min” while cloning and running the older code.
The only thing missing in the code was “from AlgorithmImports import *”
Let me know if you still face the same issue!
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.
Andrew Kives
109 Pro
,
I have resolved the date time issue, but every time I run the back test it only completes one order. The past data should be the same, so it should result in the same number of orders. Where am I going wrong?
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!
Allocate to this Strategy
Institutional clients can contact the author and allocate capital to this strategy.
Mo
Hi Louis , and thank you for the amazing tutorials,
Just having a hard time achieving the :
if (self.Time - self.stopMarketOrderFillTime).days < 30:
The number is very large , something like 736771 ??
I am using lean CLI with Pycharm debug, Do I need to use the portal to satisfy the condition? maybe time zone?
Best Regards
Mo
Loisray
AlertGreenKitten' object has no attribute 'stopMarketTicket' at OnData if self.stopMarketTicket is not None and self.Portfolio.Invested: at Python.Runtime.PythonException.ThrowLastAsClrException() at Python.Runtime.PyObject.Invoke(PyTuple args in main.py: line 41
Anthony Bergeron Burns
Hello,
I am getting an error saying, 'QCAlgorithm' not defined.
I have entered the code myself, and copied it from here.
Does QCAlgorithm not exist anymore?
Thank you,
Anthony
Shahrokh Kamyab
Hello Louis!
I get error on this line: self.entryTime = datetime.min
Seems like lowercase “datetime” is not defined and has no attribute “min”
Ashutosh
Hello Shahrokh Kamyab
I was not able to see any error with “self.entryTime = datetime.min” while cloning and running the older code.
The only thing missing in the code was “from AlgorithmImports import *”
Let me know if you still face the same issue!
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.
Andrew Kives
I have resolved the date time issue, but every time I run the back test it only completes one order. The past data should be the same, so it should result in the same number of orders. Where am I going wrong?
Hubert
Updated code
Louis
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!