Hi Everyone,
I just published the 6th video lesson of my free algorithmic trading video course. In this lesson, you will learn how to use indicators and history requests among other things. If you haven't already, make sure to check it out.
You can copy the code from this video using the "Clone" button on the attached backtest.
If you're new to the series, you can check out an overview of all videos here.
Let me know if you have any questions or comments.
Cheers,
Louis
Zl cao
hi there,
can i ask you a question about the code, please?
why we are putting this code: if not self.Portfolio[self.spy].IsLong: ?
i put this line in the comment and backtested it. there are some small amount orders which i dont understand.
do you have any method that I can find out how it happen please?
do appreciate.
Zl cao
as i can tell from the orders, the orders were not fully filled in one go sometimes.
but i don't know how it can happen.
Varad Kabade
Hi Zl cao,
In the original algorithm, we only go long if the given conditions are met, along with we are not already long on the security. We get a few extra orders by commenting out the line as the algorithm will try to buy more shares even if we are long. We can see that in extra orders, the order quantity is very small(1-2); this is because we already have the maximum position possible, but due to a decrease in price, we can add a few more shares to our holdings.
Best,
Varad Kabade
Marco Slomo
Joseph46
Hello Louis,
I'm trying to get the angle of the SMA with the same approach you used to define your custom indicator.
I'm getting an error when I try to make use the np.diff() method becuase the SMA_values looks to be empty
raise ValueError("diff requires input that is at least one dimensional")
Can you suggest somthing to fix this issue?
Louis Szeto
Hi Joseph46
deque.reverse() method returns NoneType object instead of the reversed queue (see here), and it will change the original queue instance. You may consider using the following instead:
Best
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.
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!