Buyable Gap Up Indicator and Strategy for ThinkorSwim

BenTen

BenTen

Administrative
Staff
VIP
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.



Rich (BB code):
#
# Copyright 2014 Scott J. Johnson (http://scottjjohnson.com)
#
# 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
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# 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.
# http://www.traderplanet.com/articles/view/164232-gain-your-stock-edge-buyable-gap-up-strategy/
#
# 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
https://tos.mx/Blt9EB

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;
GU.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
GU.SetDefaultColor(GetColor(8));
GU.SetLineWeight(2);

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



Credit:
 
Last edited:
TampaTrader

TampaTrader

New member
VIP
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:
BenTen

BenTen

Administrative
Staff
VIP
@TampaTrader Shouldn't be happening. Use the shared link above to load it instead.

 
Last edited:
TampaTrader

TampaTrader

New member
VIP
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:
BenTen

BenTen

Administrative
Staff
VIP
@TampaTrader Ahh I see. Added above. See the original post.

 
Last edited:
U

ukd1506

New member
@BenTen -- within X bars, is it 3 bars OR how may when u say X ?
 
BenTen

BenTen

Administrative
Staff
VIP
@ukd1506 That's up to you. Whatever lookback period you want, you change it to that value.
 
M

Mac Trader

New member
@BenTen Is it possible to set the indicator and scanner up gap down?
 
BenTen

BenTen

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

 
Thread starter Similar threads Forum Replies Date
S Creating ATR and Gap labels Questions 2
BenTen Gap Info Watchlist Column for ThinkorSwim Custom 12
STB Gap Up Counter? Questions 7
S Moving Average Gap Check? TOS ThinkScript Question Questions 2
F Gap Scanner with a twist Questions 0

Similar threads

Top