Hi Everyone.
So I'm new to working on QC, and wanted to ask someone for help. My algorithm requires to check Open data for the past 5 days. How can I implement that in QC?
I would like something along the lines of:
If two days ago the Open for EURUSD was higher than the Open three days ago then buy EURUSD today (simplified version of what I need to do with the past data, but you should get the idea)
Secondly,
I have seen a fair amount of questions asked in regards to SL and TP. However, I was wondering how one can put both into an order at the same time?
I haven't got any code written yet, as these two things are integral parts for me to start coding.
Regards
Alexandre Catarino
For past bars, we need to implement a RollingWindow:
private RollingWindow<QuoteBar> _bars; // In Initialize _bars = new RollingWindow<QuoteBar>(6); // In OnData var bar = slice["EURUSD"]; _bars.Add(bar); if (!_bars.IsReady) { return; } var lastFiveDaysOpen = _bars[5].Open;
Please checkout this excellent implementation of OCO orders to manage your TP and SL:
Allan Wojnowski
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!