Gap Open Strategy



I am trying to code a strategy that looks at gap and crap or gap and run. I'm new to strategies. So don't pin me too hard. The logic is that if it gaps up and then starts selling off pre market, it will continue to sell off into the open, with a potential pivot 30 minutes to hour after open. I'm looking for this when I trade:

If it's a gap and run, I'm looking for this set up.

Anyway, typically runs to 3rd fib extension from 5 minute opening range, kisses the fib and pulls back. I buy OTM at open, sell ITM at around 10-1030 central, and move on with my day doing other things.

Was thinking of using Hahn's videos to build a simple code of several indicators, then putting it in as column on my watch list of good liquidity stocks that I watch that have these pattern happen with relative frequency. Is that a silly way to go about it? How would you code it?
Last edited by a moderator:


New member
This is in a Pine Code. Doesn't look pretty, obviously, and will not function on TOS. It supposedly sees a gap down, and opens a buy. Possible great indicator to work into a strategy when Futures are pointing to a negative day, or any watched stocks takes a drip at open. Wondering if someone can get a handle on how it works and transfer it to a usable useThinkScript indicator.

Strategy (title =” Swing Trade Market Gaps”, overlay=false,
pyramiding=0, initial_capital=100000,
default_qty_type = strategy. fixed,

commission_type=strategy. commission. cash_per_order,
commission_value=8, slippage=2

gapDownSize = input (title=” Gap Down Size %, type = float, defval = 15, step = .25
gapUpSize = input (title=” Gap Up Size %, type=float, defval=5, step=.25

//Step 2. Calculate strategy values
gapSize = ((open – close [1]) / close [1]) * 100

//Step 3. Determine long trading conditions
enterLong = (gapSize [0] < gapDownSize [0]

exitLong = (close [0]) and
(strategy. position _size > 0)

//Display gap sizes
plot (series = gapSize, color teal, style=columns,
title= “Gap Size %

// Highlight gap trigger level
plot (series = gapDownSize, color = green, transp = 70,
title= “Gap Down Size [Long Entry]”)

plot (series = gapUpSize, color = red, transp = 70
title= “Gap Up Size [Short Entry]”)

//Step 6. Submit entry orders
If (enterLong)
strategy. entry (id = “EL”, long = true)

//Step 7. Submit exit orders
strategy. Order (if = “XL”, long = false, qty = strategy. position_size
Last edited by a moderator:

Similar threads