Intra-day gaps can be defined as difference between Open and Close price of previous candle.
if first Intra-day Candle
- If Open > Close of previous Session = GapUp
- If Open < Close of previous Session = GapDown
if GapUp
- - first trade is Long
- - - - ignore that trade
- - - - Take all subsequent trades
- - first trade is Short
- - - - Take that trade
if GapDown
- - first trade is Short
- - - - ignore that trade
- - - - Take all subsequent trades
- - first trade is Long
- - - - Take that trade
How do i code for this in Pine Script?