Close Navigation
Learn more about IBKR accounts
Should you buy or sell stocks that gap down?

Should you buy or sell stocks that gap down?

Posted September 8, 2020
Brian - QuantRocket Blog
QuantRocket LLC

What happens when strong stocks gap down at the open? A well-known trading strategy is to buy the gap, expecting mean reversion.

Buy the gap?

Buying stocks that gap down is a common trading strategy. The reasoning behind the strategy is that bad news causes traders to enter sell orders overnight which execute in tandem at the open, causing a temporary liquidity shock which drives down the opening price. The selling pressure immediately exhausts itself, however, leading the stock to recover through the remainder of the session. The strategy typically targets stocks in an uptrend, expecting that traders will buy the dip.

I use Zipline with QuantRocket’s 1-minute US stock data to backtest a buy-on-gap strategy. I first screen the daily universe of 8,000 listed stocks using the following criteria:

  1. common stocks only (no ETFs, ADRs, or preferred shares)
  2. liquid stocks only (top 10% by dollar volume)
  3. closed above their 20-day moving average

mavg = SimpleMovingAverage(
window_length=20, inputs=[EquityPricing.close])

are_common_stocks = SecuritiesMaster.usstock_SecurityType2.latest.eq(
“Common Stock”)
are_liquid = AverageDollarVolume(window_length=30).percentile_between(90, 100)
are_above_mavg = EquityPricing.close.latest > mavg

pipeline = Pipeline(
screen=(
are_common_stocks
& are_liquid
& are_above_mavg
)
)

For the stocks that pass the screen, I use intraday data to identify which stocks gapped down at least 1 standard deviation below the prior day’s low:

today_opens = data.current(context.candidates.index, ‘open’)
prior_lows = context.candidates[“prior_low”]
stds = context.candidates[“std”]

# find stocks that opened sufficiently below the prior day’s low
gapped_down = today_opens < (prior_lows - stds)

assets_to_buy = context.candidates[gapped_down]

I buy the stocks 1 minute after the open and hold until the close, resulting in the following equity curve:

Visit QuantRocket LLC website to read the full article and download ready-to-use code: https://www.quantrocket.com/blog/buy-or-sell-down-gaps

Disclosure: Interactive Brokers

Information posted on IBKR Campus that is provided by third-parties does NOT constitute a recommendation that you should contract for the services of that third party. Third-party participants who contribute to IBKR Campus are independent of Interactive Brokers and Interactive Brokers does not make any representations or warranties concerning the services offered, their past or future performance, or the accuracy of the information provided by the third party. Past performance is no guarantee of future results.

This material is from QuantRocket LLC and is being posted with its permission. The views expressed in this material are solely those of the author and/or QuantRocket LLC and Interactive Brokers is not endorsing or recommending any investment or trading discussed in the material. This material is not and should not be construed as an offer to buy or sell any security. It should not be construed as research or investment advice or a recommendation to buy, sell or hold any security or commodity. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.

IBKR Campus Newsletters

This website uses cookies to collect usage information in order to offer a better browsing experience. By browsing this site or by clicking on the "ACCEPT COOKIES" button you accept our Cookie Policy.