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