Hey Quants, I am new to Quantconnect community and I am thrilled with the potential of this platform as a learning tool. I am new to Python and currently trying to implement a basic test algorithm that covers different aspects of the way I traded manually. The steps of the testing algorithm are:
1. If the current Bar's high(5 minute timeframe) is the highest high within last 15 bars and it is within upper and lower bollinger bands, then place a stop order to buy at the high of the current bar 5 seconds before the current bar finishes.
2. If and when that stop order is filled, I want to implement a dynamic bracket order where:
- As of the end of every bar after trade entry, the algo edits the live profit taking limit order to upper band of bollinger band.
- As of the end of every bar after trade entry, the algo edits the live stop loss order to the lower band of bollinger band
Gurumeher Sawhney
Welcome to the community! With regards to the first question, data via the self.History function needs to be called with one of the Resolution enums. This means that the 5-minute bars would need to be manually created by parsing through the dataframe.
The ability to place a stop order 5 seconds before the 5-minute current bar completes is not possible with the minute resolution. The TradeBar data is the past minute's data so the "current bar" was technically already completed. If ordering 5 seconds before the creation of the 5-minute current bar completes is critical to the strategy, second resolution can be used.
Once the profit-taking limit order and stop-loss orders are placed, they generate OrderTickets. These can be called upon by requesting the open orders and can be updated with the aforementioned Bollinger Band values.
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.
Showvik Sizan
Thank you so much Gurumeher for pointing me in the right direction. I have been learning and applying some of things you mentioned. I will post a new question sometime later as I will inevitably get stuck.
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!