Hi guys,
I am trying to code an algo that would simply buy at open if a gap occurs and sell at the end of the day or if the gap has been filled.
My problem is to define the gap, how can I code this:
Gap_Down = Close[1] > Open[0] // The close of yesterday is greater that the open today.
Gap_Change = (Open[0]/Close[1] -1) // The difference in percentage.
Thank you in advance.
Chris
Michael Handschuh
ChrisD
Mike Wu
Hendrik410
Hey there,
I don't now if this ist still relevant for you, but I think you could use the calculation methon of ChrisD to get the direction an size of the gap and then use scheduled events as described here (
) to trade at the specified times.
@ MichaelH Do you think the perfomance could be better if the difference of the high of the day befor to the low of the first bar of the current day (Gap Up) or vice versa would be included?
ChrisD
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!