Hello! I'm new to the platform and I'm stuck on order execution. I am working on a simple strategy that triggers only after an equity declines a certain percentage from the previous day's close. I've been looking through the bootcamps and even the stuff on github for help but can't seem to find what I'm looking for. I want the bot to check if current price during normal market hours dips below a percentage from previous day and if so buy the equity and I want to instruct it to sell at a percentage as well from purchased price. Do I have to create something for the closeprice and currentprice argument and define it or does that already exist and I'm missed it?
Dario Teodori
Hi Venturie,
If you set resolution as daily, you could compare today's close with yesterday close and buy when market open next day.
Note that above should run once a day at 00:00 hours
First price at Day 1
second price at Day 2 (there was a drop ). You set the buy signal
BTW, welcome to the community I am kind of new too :). If you are not doing so, use the debugger as much as you can. It has saved me many times when I was stuck. in the observe variables you can evaluate any expression you want. you can see what time is it with self.UtcTime, or just check your logic.
Regards,
Dario
Veturie Tertulien
Hey Dario,
Thanks for your response. I'll try to incorporate that into what I have. As a fellow newbie, best of luck to you!
Varad Kabade
Hi Veturie Tertulien,
Thank you, Dario, for your response.
As mentioned above, we want to check for the signals during market hours. So we cannot use daily resolution. We can keep universe resolution to Hour or Minute and create an SMA indicator with period one and daily resolution to keep track of the close of previous days close. Refer to the attached backtest.
Best,
Varad Kabade
Veturie Tertulien
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!