Warad Kabade has kindly posted a demo algorithm 12044 here.
1. How to correctly replace in this algorithm a simple momentum
self.roc = RateOfChange (252)
with a delay momentum
self.rocd = IndicatorExtensions.Of(Delay(21), RateOfChange (252))?
2. How to correctly get the top 5 by momentum in MyCoarse?
Devsim
I was working with this example last night so thanks to Varad Kabade for sharing work.
2. Example in backtest uses heapq.heappush and heapq.nlargest to iteratively add and then more quickly search for n-largest - https://docs.python.org/3/library/heapq.html
Varad Kabade
Hi Ben Kaylor,
In the above algorithm, the self.rocd indicator is getting updated twice. When using:
to update self.rocd we just need to update the self.roc. In the MyCoarseFilterFunction method, we don't need to sort the coarse objects by dollar volume.Refer to the attached backtest for the changes mentioned above.
Best,
Varad Kabade
Vladimir
Ben Kaylor,
It's always a pleasure for me to try something new to accomplish a task.
Thanks for the new approach.
Vladimir
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!