Buyable Gap Up Indicator and Strategy for ThinkorSwim


Staff member
There are many profitable gap trading strategies out there. You often hear people mention a stock when it's gapping up or gapping down. This is an indicator based on the Buyable Gap-Up Strategy written here.

Before using the script below, I highly recommend this article as it lay out the process of trading gaps.


thinkScript Code

Rich (BB code):
# Copyright 2014 Scott J. Johnson (
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# See the License for the specific language governing permissions and
# limitations under the License.

# BuyableGapUpIndicator
# Based on Gil Morales and Chris Kacher's rules for buyable gaps up.
# This study doesn't work intraday because the volume used is the actual volume
# and not the projected end-of-day volume.  Instead, this study is useful
# in post-analysis to quickly find buyable gaps up.
# TODO: Add logic to handle the current period gaps up by projecting the full day volume
# based on the current time and volume so far.
input AverageTrueRangeTimePeriod = 40;
input BuyableGapPercentOfATR = 75; # percent of average true range to qualify for as a gap
input AverageVolumeTimePeriod = 50; # calculate 50 day MA volume
input BuyableGapUpMinVolumePercent = 150;  # 150% of 50 day MA volume

def AverageTrueRange = reference ATR(AverageTrueRangeTimePeriod, averageType = AverageType.SIMPLE);
def OpeningPriceGap = open - high[1];

def AverageVolume = MovingAverage(AverageType.SIMPLE, volume, AverageVolumeTimePeriod );

def GapUp = (OpeningPriceGap >= AverageTrueRange * BuyableGapPercentOfATR / 100) and (volume > AverageVolume * BuyableGapUpMinVolumePercent / 100);

AddChartBubble(GapUp > 0, low, “GU", Color.GREEN, no);

Shareable Link

Gap Up Scanner

If you want to scan for buyable gap ups at market open, add the following code to your indicator.

Rich (BB code):
plot GU = GapUp;

Switch over to the Scan tab, add a Study filter, enter your indicator's name then scan for GU within X bars.




  • w9lxgc8.png
    154.9 KB · Views: 248
  • Md5sTWw.png
    78.6 KB · Views: 184
Last edited:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Thank you for doing this, I like to watch these gaps for swing ideas. I get "Exactly one plot expected" when i paste this in. What should i change?

Last edited:
@TampaTrader Shouldn't be happening. Use the shared link above to load it instead.

Last edited:
Thanks, I did get it to work as an indicator. I was trying to add it to a scan, but looks like I misunderstood the use. Thanks again for sharing your work!

Last edited:
@TampaTrader Ahh I see. Added above. See the original post.

Last edited:
@Mac Trader Are you looking for gap up & and gap down scanner? ThinkorSwim already provides that by default. See the video below.


anyone have a good scanner for reversal candles, followed by a gap?
One scanner that comes to mind regarding this would be the daily blastoff indicator. It only scans for candles that tend to come before big moves. I have not found the scan that useful by itself. And I have not found a good combo for it yet. I am still playing with different conditions. Hope this helps.
@mjlinhle Do you mean assign a different color to the gap up candle?

Sure, here is an example:

AssignPriceColor(if GapUp > 0 then color.white else color.current);

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
432 Online
Create Post

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.