Hey everyone, i am new here and got one question.
I created my first investing algo that does the following:
The algo is looking at the top 5 technology stocks sorted by market cap.
Once one of these stocks drops below the 100 EMA i want to buy 10% of my total capital.
Question:
I try to set a target at the all time hight of the stock. So when the stock price passes the all time high i want it to sell my holdings.
But i can't figure out how to set a target when using the framework.
OH, and if you see any problems or bugs in my code or you see something i can improve. LET ME KNOW :) always want to improve!!
Thanks in advance!
Shile Wen
Hi Tijmen,
I suggest using the dict[Symbol, SymbolData/SelectionData] pattern to store the EMA information, and warmup the EMA on creation using Historical data, both of which can be seen in this BootCamp. Furthermore, getting the All-Time high will require a lot of data, so I recommend using the MAX to get the rolling high. Moreover, I recommend using a Flat Insight inside the Alpha Model's Update function to liquidate a position when a security reaches it's high.
Best,
Shile Wen
Daniel Monteagudo
Shile Wen I've noticed flat Insights are available to Alpha Models, but I was wondering what exactly they do. If they expect a price to remain stagnant, how do they act on that information?
Adam W
Daniel Monteagudo
Insights don't do anything by themselves - you can just think of them as a collection of data representing your predictions (direction, magnitude, etc) for a future period of time.
After emitting Insights, the Portfolio Model converts it to a target weight/order quantity. The built-in ones typically set the weight to 0 (liquidate) for Flat Insights, but you can change the logic to whatever is desired with a custom model.
Tijmen Kodden
Thanks for the comments guys! appriciate your help. Lets see if i can figure it out now
Tijmen Kodden
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!