I am working on an opening range breakout strategy that defines the High and Low of the first 5' bar as the "range". Once price crosses above or below that range, I want to enter long and short respectively. In trying to backtest this, I am having trouble getting the script to enter on the break of the range. Instead, it is currently entering on the open of the next bar after the range is broken. (I have only coded the long portion so far)
See the attached pictures for a snippet of my code and the problem that is happening. I want to enter at the blue circle, but instead it enters me at the white circle. Does anyone know how to fix this?
Thank you.
Comment