Hi Everyone,
Here is my Simple Breakout Example Algorithm from my video tutorial. Feel free to clone it and play around with it. Let me know if you have any questions or comments.
Cheers,
Louis
Hi Everyone,
Here is my Simple Breakout Example Algorithm from my video tutorial. Feel free to clone it and play around with it. Let me know if you have any questions or comments.
Cheers,
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.
Thank you for share
Louis,
Nice work. I have been trying for a while to create a breakout strategy a swing trading type algo. I am not the best at programming but I would try to use a universe selection based on solid companies (i.e. growth, revenue fundamentals). With the simple idea of wanting to buy solid companies that have broken out, becuase there is usually a good reason the stock is making a move up as opposed to a stock that meets a specific pattern.
Frank
Â
Hi Frank,
That sounds like a great idea.
Louis
I watched the video to get a better understanding of what you did. I understand how to do the Coarse selection no big deal, but how would it flow retrieve the symbols then do all the calculation in the OnData event? In the OnSecuritiesChanged Event? That is where i get lost
Thanks
Frank
Hi Frank,
I haven't putten too much thought into it, but I'd say the easiest way would be to add some kind of dynamic collection (e.g. list or dictionary) in which you save the calculations for each added symbol. Then you could, for instance, add the new symbol and initial calculations in the OnSecuritiesChanged event, and update the values in EveryMarketOpen.
I hope this helps.
Louis
Hi Frank,
Louis' recommendation above is the standard design pattern to accomplish this. As an example, consider reviewing this strategy in the Strategy Library.
Note that the Ichimoku Clouds strategy warms up the historical data the strategy needs during the SymbolData constructor. Instead of making a History call each day as demonstrated in the algorithm above, we recommend warming up the history and setting up some consolidators.
Best,
Derek Melchin
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.
Derek,Thanks for pointing me in the right direction. I having been using both Quantopian and Quantconnect for a while. For me whenever an algo uses Static Assets (Quantopian term) same as Quantconnect AddEquity I can follow the logic of the algo. I grasp the concept of Quantconnect Coarse and Fine Universe versus Quantopian pipeline and how the OnSecuritiesChanged works. But when it comes the class SelectionData(): and how it works with Coarse Selection to applu your indicators I just can't seem to get it. I have looked at the EMA Universe Boot camp sample but the updating of the indicators is soemthing i struggle with
Hi Louis,
First of all thanks for this example algo and for your ongoing work with your TradeOptions website/youtube. I am a massive fan of the little I have seen so far and will keep learning from everything you share. Really good content.
As Derek Melchin pointed out, I noticed this algorithm performs TWO history requests each day, one for CLOSE and one for HIGH, this could be combined into a single history request in Initialise to "warm-Up" the algo, subsequently accessing the CLOSE or HIGH where needed.Â
I believe you could put the ORIGINAL history request in the initialise function to "warm-Up" the algo and then use a rolling window to perform volatility calculations. Do you know how to implement these improvements?Â
So far I have been unable to successfully implement a rolling window for volatility calculations...
The problem I encountered was the rolling window returns a QC Indicators object, not an array, so while I could access individual items, I could not access the entire array to perform std calcs - perhaps Derek Melchin can help point us in the right direction?Â
I known there is a STD indicator but it would be nice to see how to best perform any calculations on all values within a rolling window of historical data without repeated history requests?
Hi Mark,
First of all, thank you very much for the positive feedback. It is greatly appreciated!
I certainly agree that multiple history calls isn't the most efficient solution but it is an easy solution that even newcomers should understand.
As for calculating volatility, have you tried combining a rolling window and a consolidator? There is an example on the consolidator documentation page. I think this should allow you to access previous values.
I hope this helps.
Hi Frank,
I recommend reviewing the solution file to that bootcamp example. It demonstrates that the indicators are updated by calling their respective Update method.
Mark,
Instead of filling the RollingWindow with indicator objects, fill it with indicator values by using `.Current.Value`. Refer to our documentation for an example.
Best,
Derek Melchin
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.
DerekÂ
Will do,
thanks
Frank
Â
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!