Skip to main content TTM Squeeze Histogram Backtester Skip to main content Skip to content
Master the TTM Squeeze with our comprehensive 19-module course Start Learning →
TOS Indicators
  • Tools

    Categories

    • Indicators
    • Backtesters
    • Scans
    • Dashboards
    • thinkScript
    • Member Resources
    Browse Full Library

    Featured Tutorials

    Heiken Ashi Trend Indicator
    Heiken Ashi Trend Indicator
    Indicators

    Download our Custom Heiken Ashi indicator for ThinkOrSwim. Full ThinkScript code, formula...

    Learn more →
    Commodities Tracker
    Commodities Tracker
    Indicators

    For acceleration signals: trend-following strategies and buying pullbacks. For deceleration signals: short...

    Learn more →
    Build an Election Backtester in 10 Minutes
    Build an Election Backtester in 10 Minutes
    Backtesters

    Learn how to create a Post-Election Backtester in ThinkOrSwim to analyze market...

    Learn more →

    Popular Posts

    Unusual Volume
    Unusual Volume
    Scans

    Build 4 scans to easily find stocks with greater than...

    Learn more →
    Upcoming Earnings with High Short Interest
    Upcoming Earnings with High Short Interest
    Scans

    Build a scan to find stocks that are likely to...

    Learn more →
    Unusual Volume Pro Scans
    Unusual Volume Pro Scans
    Scans

    4 additional scans to find unusual volume overlapping with key...

    Learn more →
  • Courses
    Squeeze Course
    Squeeze Course
    19 Modules

    Scan, backtest, and trade the TTM Squeeze setup with precision.

    Unlock Course →
    Earnings Course
    Earnings Course
    3 Modules

    Master earnings plays with free indicators and proven strategies for ThinkOrSwim.

    Unlock Course →
    V-Shaped Reversals
    V-Shaped Reversals
    7 Modules

    Identify and trade powerful V-shaped reversal patterns with confidence and precision.

    Unlock Course →
    Fibonacci Trading
    Fibonacci Trading
    4 Modules

    Learn to trade Fibonacci retracements and extensions in ThinkOrSwim effectively.

    Unlock Course →
  • Products
    Futures Volatility Box Premium
    Futures Volatility Box

    Volatility models for 10 major futures markets, including micros & SPX.

    Explore Futures VB →
    Stock Volatility Box Premium
    Stock Volatility Box

    Dynamic support & resistance for 595+ stocks/ETFs, with a live scanner.

    Explore Stock VB →
    Opening Range Breakouts Premium
    Opening Range Breakouts

    Powerful live scanner & backtester for ORB strategies on 595+ stocks.

    Explore ORB Setups →
My Account
Back to Tutorials
Beginner-Friendly 33 mins

TTM Squeeze Histogram Backtester

Test if the TTM Squeeze Histogram is effective in timing momentum shifts in your favorite markets, on any time frame chart.

Download Backtester
How to install in ThinkOrSwim →
Table of Contents
  • How to Read the TTM Squeeze Histogram?
  • Histogram Patterns and Momentum Clues
  • Getting Started with thinkScript
  • Conclusion

Introduction

The TTM Squeeze indicator is a popular tool among traders who started their careers in the 21st century, and ever came across John Carter. The TTM Squeeze indicator combines the Keltner Channels and Bollinger Bands to provide insight into market volatility, showing when it is compressing and when it is about to expand.

Within the TTM Squeeze, there are two main components that traders use:

  1. Squeeze Dots
  2. Squeeze Histogram

This tutorial focuses on the TTM Squeeze Histogram, answering a key question:

How effective is the TTM Squeeze Histogram in timing momentum shifts in the market?

The TTM Squeeze Histogram is considered a leading momentum indicator. In this tutorial, we’ll build a backtester to test that theory.

How to Read the TTM Squeeze Histogram?

The TTM Squeeze Histogram is used to gauge momentum, with the histogram bars providing clues about the market’s movements.

Here’s how to read the TTM Squeeze Histogram:

There are four different colors in the histogram bars:

  1. Cyan
  2. Blue
  3. Yellow
  4. Red

Each color is based on its relationship with the prior bar and the zero line, offering visual cues on whether momentum is increasing or decreasing.

Cyan Squeeze Histogram:

A cyan TTM squeeze histogram appears when:

  1. The bar is increasing compared to the prior bar,
  2. And is greater than 0.

Blue Squeeze Histogram:

A blue TTM squeeze histogram appears when:

  1. The bar is decreasing compared to the prior bar,
  2. And is greater than 0.

Red Squeeze Histogram:

A red TTM squeeze histogram appears when:

  1. The bar is decreasing compared to the prior bar,
  2. And is less than 0.

Yellow Squeeze Histogram:

A yellow TTM squeeze histogram appears when:

  1. The bar is increasing compared to the prior bar,
  2. And is less than 0.

Histogram Patterns and Momentum Clues

Understanding these colors helps in identifying momentum patterns:

  1. Cyan bars increasing in height, in consecutive order = increasing buying momentum
  2. Red bars increasing in height, in consecutive order = increasing selling momentum
  3. 7+ consecutive cyan bars, followed by the first blue bar = slowing buying momentum, potential reversal
  4. 7+ consecutive red bars, followed by the first yellow bar = slowing selling momentum, potential reversal

For example, consecutive cyan bars indicate increasing momentum, often leading to upward price action supported by bullish activity.

TTM Squeeze Histogram - Cyan Bars

Conversely, consecutive red bars signal increasing bearish momentum, putting downward pressure on price action.

TTM Squeeze Histogram - Red Bars

The first bar of a different color after a series of the same color can indicate a momentum shift. For instance, consecutive cyan bars followed by a blue bar suggest slowing upward momentum and possible reversal. Similarly, consecutive red bars followed by a yellow bar indicate slowing downward momentum and potential reversal. Combining this with other indicators can help identify entry points.

Getting Started with thinkScript

To start, open ThinkOrSwim and follow these steps to create a new thinkScript strategy:

  1. Click the Studies icon at the top right of your chart.
  2. Go to the Strategies tab.
  3. Click Create to open the thinkScript editor.
  4. Name your strategy (e.g., “TTM Squeeze Histogram Backtester”).

Referencing the TTM Squeeze Histogram

First, we need to reference the TTM Squeeze study and extract the histogram data:

def histogram = TTM_Squeeze().Histogram;

This line imports the histogram plot from the TTM Squeeze indicator, essential for identifying momentum shifts.

Defining Histogram Bar Colors

Next, categorize the histogram bars into four colors:


    def cyan = histogram > histogram[1] and histogram > 0;
def blue = histogram 0;
def red = histogram < histogram[1] and histogram < 0;
def yellow = histogram > histogram[1] and histogram < 0;

These definitions help distinguish between increasing and decreasing momentum in both positive and negative territories.

Identifying Momentum Shifts

Define conditions for momentum shifts based on consecutive histogram bars of the same color:


    def minCyanBars = Sum(cyan, 7) >= 7;
def minRedBars = Sum(red, 7) >= 7;
def momoDown = minCyanBars[1] and blue;
def momoUp = minRedBars[1] and yellow;

These conditions check for seven consecutive bars of the same color, indicating a significant momentum shift.

Filtering with RSI

Incorporate the RSI indicator to filter out false signals and identify overbought and oversold conditions:


    def rsi = RSI();
def rsiOverbought = rsi > 60;
def rsiOversold = rsi < 40;

Adding these filters refines entries and exits based on momentum shifts confirmed by the RSI.

Building the Backtester

Construct the backtester by specifying conditions for entering and exiting trades:


    AddOrder(OrderType.BUY_TO_OPEN, momoUp and rsiOversold, close, 100, Color.GREEN, Color.GREEN);
AddOrder(OrderType.SELL_TO_CLOSE, histogram < histogram[1], close, 100, Color.RED, Color.RED);
AddOrder(OrderType.SELL_TO_OPEN, momoDown and rsiOverbought, close, 100, Color.RED, Color.RED);
AddOrder(OrderType.BUY_TO_CLOSE, histogram > histogram[1], close, 100, Color.GREEN, Color.GREEN);

These lines define the trading strategy for long and short positions, using momentum shifts and RSI filters for decisions.

Testing and Refining

Test the backtester across different time frames and market conditions to identify strengths and weaknesses:


    input length = 14;
input overBought = 70;
input overSold = 30;
def rsi = RSI(length, overBought, overSold);
AddOrder(OrderType.BUY_TO_OPEN, momoUp and rsi < overSold, close, 100, Color.GREEN, Color.GREEN);
AddOrder(OrderType.SELL_TO_CLOSE, histogram < histogram[1], close, 100, Color.RED, Color.RED);
AddOrder(OrderType.SELL_TO_OPEN, momoDown and rsi > overBought, close, 100, Color.RED, Color.RED);
AddOrder(OrderType.BUY_TO_CLOSE, histogram > histogram[1], close, 100, Color.GREEN, Color.GREEN);

Experiment with different RSI thresholds, consecutive histogram bars, and other parameters to optimize the backtester.

Conclusion

Building a TTM Squeeze Histogram Backtester in ThinkOrSwim allows you to test the TTM Squeeze Histogram's effectiveness in identifying momentum shifts. By incorporating the RSI indicator, you can filter out false signals and improve your trading strategy's accuracy.

Continuously test and refine your backtester to adapt to changing market conditions. The insights gained from this tool can significantly enhance your trading decisions and help you capitalize on market momentum.

Happy trading!

Featured Tools:
Stock Volatility Box

Stock Volatility Box

Spot reversal zones across 600 stocks & ETFs.

  • Hourly & daily models
  • Powerful Live Scanner
  • Built for day traders
Futures Volatility Box

Futures Volatility Box

Pinpoint reversal zones in 10 major futures markets.

  • 5 models (incl. Scalper)
  • ThinkOrSwim & TradingView
  • SPX traders
ORB Setups

ORB Setups

Find the best Opening Range Breakout setups.

  • Powerful real-time scanner
  • Instant backtests
  • 2+ years data

Get Free Access

Create a free account for downloads and new tutorial alerts.

Create Free Account

More Tutorials Like This

Santa Claus Rally Backtester

Santa Claus Rally Backtester

Beginner • 14 minutes
TTM Squeeze Backtester

TTM Squeeze Backtester

Beginner-Friendly • 17 mins
Opening Range Breakout

Opening Range Breakout

Intermediate • 36 minutes

Ready to Trade With an Edge?

Join 40,000+ traders using institutional-grade tools for ThinkOrSwim.

Get the Bundle
TOS Indicators

Premium thinkorswim indicators, scans, and trading tools to help you trade smarter.

ThinkOrSwim Tools

  • Indicators
  • Scans
  • Backtesters
  • Dashboards
  • thinkScript
  • Browse All

Courses

  • Squeeze Course
  • Earnings Course
  • V-Shaped Reversals
  • Fibonacci Trading

Products

  • Futures Volatility Box
  • Stock Volatility Box
  • ORB Setups
  • Shop All

Guides

  • TTM Squeeze
  • Automated Trading
  • Volatility Trading
  • Opening Range Breakouts
  • Trade Reports
  • Contact Us

© 2026 TOS Indicators. All rights reserved.

Privacy Policy Terms of Service Disclaimer

The information contained on this website is solely for educational purposes, and does not constitute investment advice. The risk of trading in securities markets can be substantial. You must review and agree to our Terms of Service prior to using this site.

U.S. Government Required Disclaimer - Commodity Futures Trading Commission. Futures and options trading has large potential rewards, but also large potential risk. You must be aware of the risks and be willing to accept them in order to invest in the futures and options markets. Don't trade with money you can't afford to lose. This website is neither a solicitation nor an offer to Buy/Sell futures or options. No representation is being made that any account will or is likely to achieve profits or losses similar to those discussed on this website. The past performance of any trading system or methodology is not necessarily indicative of future results.

Individual results may vary, and testimonials are not claimed to represent typical results. All testimonials are by real people, and may not reflect the typical purchaser's experience, and are not intended to represent or guarantee that anyone will achieve the same or similar results.

TOS Indicator's Traders and employees will NEVER manage or offer to manage a customer or individual's options, stocks, currencies, futures, or any financial markets or securities account. If someone claiming to represent or be associated with TOS Indicator solicits you for money or offers to manage your trading account, do not provide any personal information and contact us immediately.

CFTC RULE 4.41 - HYPOTHETICAL OR SIMULATED PERFORMANCE RESULTS HAVE CERTAIN LIMITATIONS. UNLIKE AN ACTUAL PERFORMANCE RECORD, SIMULATED RESULTS DO NOT REPRESENT ACTUAL TRADING. ALSO, SINCE THE TRADES HAVE NOT BEEN EXECUTED, THE RESULTS MAY HAVE UNDER-OR-OVER COMPENSATED FOR THE IMPACT, IF ANY, OF CERTAIN MARKET FACTORS, SUCH AS LACK OF LIQUIDITY, SIMULATED TRADING PROGRAMS IN GENERAL ARE ALSO SUBJECT TO THE FACT THAT THEY ARE DESIGNED WITH THE BENEFIT OF HINDSIGHT. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFIT OR LOSSES SIMILAR TO THOSE SHOWN.