Simple Breakout Tool
Identify breakouts before they happen, where you have enough of an edge to give you an entry.
Introduction
In this tutorial, I’ll walk you through building the Simple Breakout Tool for ThinkOrSwim, focusing on simple moving averages and technical indicators to generate clear buy and sell signals.
We’ll break it down step-by-step so you can see exactly how it works and how you can use it to improve your trading decisions.
This thinkScript coding tutorial is beginner-friendly, so don’t feel shy to follow along real-time.
Volatility Box Invite
We are TOS Indicators.com, home of the Volatility Box.
The Volatility Box is our secret tool, to help us consistently profit from the market place. We’re a small team, and we spend hours every day, after the market close, doing nothing but studying thousands of data points to keep improving and perfecting the Volatility Box price ranges.
We have two different Volatility Boxes - a Futures Volatility Box and a Stock Volatility Box.
Futures Volatility Box - Trade Major Markets With an Edge
Designed For: Futures, Micro-Futures and Index Market Traders
Supported Models: Hourly Volatility Box models
Supported Markets: 10 Major Futures Markets
The Futures Volatility Box comes with:
- 5 Volatility Models for each market
- Support for 10 Futures Markets (/ES, /NQ, /YM, /RTY, /CL, /GC, /SI, /ZB, /HG, /NG)
- Video Setup Guide
- Trade Plan
- Access to all members-only resources, including Squeeze Course
Learn More About the Futures Volatility Box
Trade futures and micro futures with a consistent volatility edge
Stock Volatility Box - Powerful Web Based Volatility Platform
Designed For: Stock and Options Traders
Supported Models: Hourly and Daily Volatility Box models
Supported Markets: 10,000+ Stocks and ETFs (new markets added frequently)
A Stock Volatility Box membership includes access to:
- Live Scanner - A powerful scanner we've built from scratch, to scan 10,000 symbols every 2 seconds for new volatility breaches
- Dashboard - A quick and easy way to view daily volatility model levels online
- Short Interest Scanner - Short interest, Squeeze, and EMA data to find short squeezes
- Squeeze Course - All of our proprietary squeeze tools, including robust backtesters
- All Members Only Indicators - We don't nickel and dime you. Everything really is included.
- And much more!
Learn More About the Stock Volatility Box
Trade stocks and options with a consistent volatility edge
How the Simple Breakout Tool Works
Here’s what we’re using in this indicator:
- Simple Moving Averages (SMA): We’ll use 10, 30, and 100-period SMAs to determine trend direction.
- Stochastic Slow Indicator: A tool to measure overbought and oversold levels, making it easy to spot potential reversals.
- MACD Histogram (MH): A momentum gauge to validate the strength of buy or sell signals.
Step-by-Step Code Breakdown
Step 1: Set Up Moving Averages
Start by defining the 10, 30, and 100-period SMAs, which form the basis of our trend analysis.
input fastSMALength = 10;
input mediumSMALength = 30;
input slowSMALength = 100;
def SMA10 = SimpleMovingAvg(close, fastSMALength);
def SMA30 = SimpleMovingAvg(close, mediumSMALength);
def SMA100 = SimpleMovingAvg(close, slowSMALength);
Step 2: Add Stochastic Slow Indicator
Next, we introduce the Stochastic Slow Indicator to pinpoint overbought and oversold zones.
def StoSloK = StochasticSlow(80,20,21,3).SlowK;
def StoSloD = StochasticSlow(80,20,21,3).SlowD;
def StoSloOB = StochasticSlow(80,20,21,3).Overbought;
def StoSloOS = StochasticSlow(80,20,21,3).Oversold;
Step 3: Define the MACD Histogram
The MACD Histogram is our momentum confirmation, helping filter out weaker signals.
def MH = MACDHistogram();
Step 4: Set Market Hours
We want to keep signals within regular trading hours, so we’ll limit the signals to 9:30 AM to 4:00 PM.
input startTime = 930;
input endTime = 1600;
def marketHours = if SecondsTillTime(startTime) <= 0 and SecondsTillTime(endTime) > 0 then 1 else 0;
Step 5: Create Buy and Sell Conditions
Now we’re ready to define the actual buy and sell conditions:
- Buy Signal: Triggers when the price crosses above the 10-period SMA, is above the 100-period SMA, and the Stochastic is not overbought.
- Sell Signal: Activates when the price crosses below the 10-period SMA, is under the 100-period SMA, and the Stochastic is not oversold.
plot bullish = if marketHours and (close > SMA10 and close[1] <= SMA10[1]) and (close > SMA100) and StoSloK < StoSloOB and StoSloD < StoSloOB and MH > 0 then 1 else 0;
plot bearish = if marketHours and (close < SMA10 and close[1] >= SMA10[1]) and (close < SMA100) and StoSloK > StoSloOS and StoSloD > StoSloOS and MH < 0 then 1 else 0;
Step 6: Add Arrows for Clarity
We’ll add arrows to make it clear where buy and sell signals occur. Bullish signals will display an upward arrow, and bearish signals will show a downward arrow.
bullish.SetPaintingStrategy(PaintingStrategy.Boolean_Arrow_Up);
bearish.SetPaintingStrategy(PaintingStrategy.Boolean_Arrow_Down);
bullish.SetLineWeight(5);
bearish.SetLineWeight(5);
Using the Simple Breakout Tool
With this setup, you get straightforward signals that you can use right on your charts. When you see a buy signal, consider entering a trade; when you see a sell signal, it might be time to exit. Use this tool on daily charts for swing trades or intraday charts for quicker trades. The goal here is simplicity: fewer, clearer signals to help you take action with confidence.
Take It Further
If you’re looking to take this to the next level, try combining the Simple Breakout Tool with our Volatility Box or Market Pulse Indicator—both available on our website. This gives you a more complete strategy, aligning your trades with market volatility and broader trends. Happy trading!
downloads
Download the Simple Breakout Tool Indicator for ThinkorSwim.
The download contains a STUDY.ts file, which you can directly import into your ThinkOrSwim platform.
Download Indicator
Download the Simple Breakout Tool Indicator for ThinkorSwim.
The download contains a STUDY.ts file, which you can directly import into your ThinkOrSwim platform.