Hello,
I am trying to build an algorithm that trades using price action trading rules (buying/shorting breakout pullbacks, fading range breakouts, etc.).
I'm currently at the stage of development where I'm just building all the little pieces of the algorithm to enable it do identify legs and larger patterns like channels.
One issue I'm not sure how to deal with is dealing with gaps between bars.
Al Brooks, author of the trading price action trilogy, says that one can treat gaps as bars and that they function similarly.
I took this and decided that it would be too much trouble to write code so as to actually insert bars where gaps exist in price data so I assumed that 'bridging' the bar that formed on the gap would be reasonable and desirable.
Attached is a notebook with examples.
The code is set so that all gaps between a current bars open and its prior bars close are set equal (bridged).
Though this affect the entire second chart, the most notable differences lie on 4/24 and 5/11.
My questions is this:
Is bridging like this reasonable?
I'm unsure of the effect this will have on a standard price action trading algorithm so my current plan is to finish the algorithm and backtest three different variations, sticking with whatever performs the best although I am concerned about how this may invite curvefitting:
1. No gap bridging whatsoever
2. Bridging gaps for bars that have gapped up/down in extremity (i.e. completely above or below its prior bar)
3. Bridging all gaps
All help is appreciated, thanks in advance
EDIT: Took out the -1 from len() while using range to setup the adjusted price data