Skip to main content Multi-TimeFrame TTM Squeeze Indicator 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 21 minutes ThinkOrSwim

Multi-Time Frame (MTF) Squeeze Indicator

Build a powerful multi-timeframe squeeze indicator that displays TTM squeeze conditions across all timeframes in one visual dashboard for ThinkOrSwim

Download Indicator
How to install in ThinkOrSwim →
Table of Contents
  • Build a Comprehensive Multi-Time Frame Squeeze Dashboard
  • Understanding Multi-Timeframe Trading Challenges
  • The Reusable Code Framework Concept
  • TTM Squeeze Logic and Custom Implementation
  • Step-by-Step Coding Tutorial: Building the MTF Squeeze
  • Advanced Implementation Strategies
  • Common Implementation Mistakes and Solutions
  • Real-World Trading Applications
  • Framework Extension for Other Indicators

Multi-Timeframe Analysis with the MTF Squeeze Indicator

Stop switching between timeframes to check squeeze conditions. This Multi-Time Frame Squeeze indicator displays TTM squeeze status across all major timeframes in one compact dashboard.

Key features of this MTF Squeeze indicator:

  • Displays squeeze conditions from monthly down to 1-minute charts
  • Color-coded labels for instant visual identification
  • Reusable framework for other multi-timeframe indicators
  • Custom source code that avoids built-in TTM squeeze limitations

Perfect for traders who need comprehensive timeframe analysis without cluttering their charts with multiple indicators.

Build a Comprehensive Multi-Time Frame Squeeze Dashboard

Most traders struggle with timeframe analysis because they’re constantly switching between charts to check squeeze conditions. The Multi-Time Frame (MTF) Squeeze indicator solves this problem by displaying squeeze status across all major timeframes in one compact, visual dashboard. This tutorial teaches you to build a sophisticated MTF indicator using reusable code frameworks and custom squeeze calculations.

Understanding Multi-Timeframe Trading Challenges

Effective trading requires understanding market conditions across multiple timeframes, but traditional approaches create several problems:

Chart Clutter: Loading separate squeeze indicators for each timeframe makes charts unreadable and overwhelming.

Time Wastage: Constantly switching between timeframes to check conditions interrupts trading flow and causes missed opportunities.

Incomplete Analysis: Traders often check only 2-3 timeframes instead of the comprehensive view needed for optimal entries.

Platform Limitations: ThinkOrSwim’s built-in TTM squeeze has restrictions when used with aggregation periods that create false signals.

The MTF Squeeze dashboard addresses all these issues by providing a single indicator that monitors squeeze conditions across 17 different timeframes simultaneously.

The Reusable Code Framework Concept

Before diving into the squeeze-specific code, it’s crucial to understand the modular framework approach that makes this indicator possible. This same framework can be adapted for any multi-timeframe indicator, whether you want MTF moving average crossovers, RSI conditions, or custom oscillators.

Framework Benefits:

  • Write the core logic once and replicate it across timeframes
  • Easy maintenance and updates to calculation methods
  • Consistent variable naming makes debugging simple
  • Text editor find-and-replace speeds up development

The framework uses a specific pattern: define variables outside if/else blocks, then populate them within aggregation period checks. This approach ensures clean code organization and prevents compilation errors.

TTM Squeeze Logic and Custom Implementation

The TTM Squeeze measures the relationship between Bollinger Bands and Keltner Channels. When Bollinger Bands contract inside Keltner Channels, a squeeze condition exists, indicating low volatility that often precedes significant price movements.

Why Custom Source Code is Necessary:

ThinkOrSwim’s built-in TTM squeeze function has limitations when used within aggregation period if/else statements. The function doesn’t return expected boolean values, leading to false squeeze signals. Instead, we implement the squeeze calculation using the documented relationship between Bollinger Bands and Keltner Channels.

Core Squeeze Calculation:

  • Calculate Bollinger Band standard deviation
  • Calculate Keltner Channel ATR-based width
  • Compare the ratio to determine squeeze conditions
  • Use boolean logic to create clear on/off signals

Step-by-Step Coding Tutorial: Building the MTF Squeeze

Follow this comprehensive tutorial to build your MTF Squeeze indicator from scratch, learning the framework approach that can be applied to any multi-timeframe analysis.

Step 1: Setting Up Global Variables

Start by defining variables that remain constant across all timeframes. These represent the core squeeze parameters that don’t change whether you’re analyzing monthly or 1-minute data:

def length = 20;
def AlertLine = 1;
def nK = 1.5;
def nBB = 2;
def averageType = AverageType.SIMPLE;
def displace = 0;
def trueRangeAverageType = AverageType.SIMPLE;

These values match ThinkOrSwim’s default TTM squeeze settings. The nK factor (1.5) controls the Keltner Channel width, while nBB (2) sets the Bollinger Band standard deviation multiplier. The AlertLine (1) determines the threshold for squeeze detection.

Step 2: Understanding the Aggregation Period Framework

ThinkOrSwim has a key limitation: you can only access timeframes equal to or greater than your current chart timeframe. This means on a 5-minute chart, you can access 5-minute, 15-minute, hourly, and higher timeframes, but not 1-minute through 4-minute data.

The framework uses this logic pattern:

if GetAggregationPeriod() <= AggregationPeriod.MONTH {
    // Define calculations for monthly timeframe
} else {
    // Set default values when timeframe isn't accessible
}

This ensures the indicator only shows data for accessible timeframes while maintaining clean code structure.

Step 3: Defining Variables for the First Timeframe

For each timeframe, we need to define the same set of variables outside the if/else blocks, then populate them inside. Start with the monthly timeframe:

def monthPrice;
def monthATR;
def monthSDev;
def monthDenom;
def monthBBSInd;
def monthSqueeze;
def monthAggregationPeriod;

Each variable serves a specific purpose in the squeeze calculation:

  • monthPrice: Closing price for the monthly timeframe
  • monthATR: Average True Range for Keltner Channel calculation
  • monthSDev: Standard deviation for Bollinger Band width
  • monthDenom: Denominator (nK × ATR) for the squeeze ratio
  • monthBBSInd: Final squeeze ratio calculation
  • monthSqueeze: Boolean squeeze condition (1 or 0)
  • monthAggregationPeriod: Flag indicating if timeframe is accessible

Step 4: Implementing the Squeeze Calculation Logic

Inside the aggregation period check, implement the core squeeze calculation. This is where we translate the Bollinger Band vs. Keltner Channel relationship into code:

if GetAggregationPeriod() <= AggregationPeriod.Month {
    monthPrice = close(period="Month");
    monthATR = Average(TrueRange(high(period="Month"), close(period="Month"), low(period="Month")), length);
    monthSDev = StDev(monthPrice, length);
    monthDenom = (nK * monthATR);
    monthBBSInd = if (monthDenom  0, ((nBB * monthSDev) / monthDenom), 0);
    monthSqueeze = if monthBBSInd < AlertLine then 1 else 0;
    monthAggregationPeriod = 1;
} else {
    monthPrice = 0;
    monthATR = 0;
    monthSDev = 0;
    monthDenom = 0;
    monthBBSInd = 0;
    monthSqueeze = 0;
    monthAggregationPeriod = 0;
}

The key insight is the monthBBSInd calculation: When (nBB × Standard Deviation) ÷ (nK × ATR) is less than 1, Bollinger Bands are inside Keltner Channels, indicating a squeeze condition.

Step 5: Creating Visual Labels

Transform the boolean squeeze conditions into visual labels that provide instant feedback about market conditions:

AddLabel(monthSqueeze and monthAggregationPeriod, "M", Color.RED);
AddLabel(!monthSqueeze and monthAggregationPeriod, "M", Color.DARK_GREEN);

This creates two labels for the monthly timeframe:

  • Red "M" label: Appears when a monthly squeeze exists
  • Dark green "M" label: Appears when no monthly squeeze exists

The monthAggregationPeriod condition ensures labels only appear when the timeframe is accessible from your current chart.

Step 6: Scaling to Multiple Timeframes Using Text Editors

Rather than manually typing code for each timeframe, use a text editor's find-and-replace function to rapidly create variations. Copy your monthly code block to a text editor like Sublime Text or VS Code.

Find-and-Replace Process:

  1. Copy the complete monthly code block
  2. Use Ctrl+H (or Cmd+H on Mac) to open find-and-replace
  3. Find: "month" → Replace: "week"
  4. Update the aggregation period: AggregationPeriod.Month → AggregationPeriod.WEEK
  5. Update the period string: "Month" → "Week"
  6. Update the label: "M" → "W"

This process transforms your monthly code into weekly code in seconds. Repeat for all desired timeframes: 4-day, 3-day, 2-day, daily, 4-hour, 2-hour, 1-hour, 30-minute, 20-minute, 15-minute, 10-minute, 5-minute, 4-minute, 3-minute, 2-minute, and 1-minute.

Step 7: Handling Timeframe-Specific Nuances

Some timeframes require special handling due to ThinkOrSwim's naming conventions:

Day Period: Use "day" instead of "1 day"

Hour Period: Use "1 Hour" for the period string

Minute Periods: Use "1 Min", "2 Min", etc.

Multi-Day Periods: Use "4 days", "3 days", "2 days" with numbers

These nuances are important for proper compilation. Test each timeframe addition to ensure no syntax errors.

Step 8: Color Coding and Visual Organization

Organize your labels with consistent color coding that provides intuitive market feedback:

Standard Color Scheme:

  • Red: Squeeze condition exists (low volatility, potential breakout coming)
  • Dark Green: No squeeze (normal volatility conditions)
  • Gray: Alternative for fast compression squeezes (if implementing multiple compressions)
  • Yellow: Alternative for slow compression squeezes

For advanced implementations, you can create input variables that allow users to customize colors directly from the studies menu, making the indicator more versatile for different trading styles and visual preferences.

Step 9: Testing and Validation

Before using the indicator live, validate its accuracy against ThinkOrSwim's built-in TTM squeeze:

Validation Process:

  1. Apply your MTF Squeeze indicator to a chart
  2. Add the built-in TTM Squeeze indicator
  3. Switch to monthly timeframe and verify the "M" label matches TTM squeeze status
  4. Repeat for weekly, daily, and intraday timeframes
  5. Test on different stocks to ensure consistent behavior

Any discrepancies likely indicate syntax errors in the aggregation period strings or calculation logic.

Step 10: Advanced Features and Customization

Once your basic MTF Squeeze works correctly, consider these advanced enhancements:

Multiple Compression Levels: Add variables for nK2 and nK3 to track fast, medium, and slow squeeze compressions simultaneously.

User Inputs: Convert def variables to input variables, allowing customization of length periods, color schemes, and compression factors.

Alert Integration: Add Alert() functions to notify when squeeze conditions change on key timeframes.

Label Stacking: Use chart window sizing to stack multiple MTF indicators vertically for comprehensive dashboard views.

Advanced Implementation Strategies

Performance Optimization: The MTF Squeeze can be resource-intensive due to multiple timeframe calculations. Consider limiting timeframes to those most relevant to your trading style. Day traders might focus on 1-minute through 4-hour timeframes, while swing traders emphasize daily through monthly periods.

Integration with Other Indicators: The MTF Squeeze works excellently alongside other multi-timeframe tools. Consider combining with MTF moving averages, RSI conditions, or custom oscillators using the same framework approach.

Market Context Awareness: Different markets behave differently during squeeze conditions. Stocks often see explosive moves after squeezes, while forex pairs might show more gradual trend development. Adjust your interpretation based on the asset class.

Common Implementation Mistakes and Solutions

Variable Definition Errors: Always define variables outside if/else blocks before populating them inside. ThinkScript requires this order for proper compilation.

Aggregation Period Mismatches: Ensure your period strings match ThinkOrSwim's exact naming conventions. "1 Hour" works, but "1hour" doesn't.

Label Overlap Issues: When multiple timeframes show squeezes, labels can overlap. Use different colors or adjust chart window sizing to maintain readability.

False Signal Debugging: If labels don't match expected squeeze conditions, verify your nK and nBB factors match the built-in TTM squeeze settings you're comparing against.

Real-World Trading Applications

Entry Timing: Use multiple timeframe squeeze alignment for high-probability entries. When 3+ timeframes show squeezes simultaneously, subsequent breakouts often have exceptional follow-through.

Exit Strategy: Monitor higher timeframes for squeeze resolution as exit signals. If daily and weekly squeezes resolve while intraday squeezes remain, consider profit-taking approaches.

Market Scanning: Apply the MTF Squeeze to watchlists for systematic opportunity identification. Stocks showing squeeze alignment across multiple timeframes often provide the best risk-reward setups.

Risk Management: Avoid trading during widespread squeeze conditions across many timeframes, as these periods often precede high-volatility events that can be unpredictable in direction.

Framework Extension for Other Indicators

The MTF framework used for the squeeze indicator can be adapted for virtually any trading concept:

MTF Moving Average Crossovers: Track EMA/SMA crossovers across timeframes to identify trend alignment opportunities.

MTF RSI Conditions: Monitor overbought/oversold conditions across multiple timeframes for confluence-based entries.

MTF Support/Resistance: Identify key levels that align across multiple timeframes for high-probability reversal zones.

MTF Volume Analysis: Track volume spikes or unusual activity patterns across different timeframes for breakout confirmation.

Each adaptation follows the same variable definition → aggregation period check → calculation → label display pattern, making the framework highly reusable for systematic indicator development.

The Multi-Time Frame Squeeze indicator represents more than just a trading tool—it's a comprehensive approach to timeframe analysis that can transform how you identify and execute trading opportunities. By mastering both the specific squeeze implementation and the underlying framework concepts, you gain the ability to create sophisticated multi-timeframe analysis tools tailored to your exact trading requirements.

MTF Squeeze.ts
#TOS Indicators

#Home of the Volatility Box

#Indicator Name: Multi-Time Frame Squeeze

#Full Tutorial Available Here: www.tosindicators.com/indicators/mtf-squeeze

#Contains TTM_Squeeze Source Code, found here (http://freethinkscript.blogspot.com/2009/05/ttm-like-squeeze-indicator-with.html)


// ... 33 more lines ...

Unlock This Code

Create a free account to access the full source code and download files.

Create Free Account Login
To build an MTF squeeze indicator, use the aggregation period framework: define variables outside if/else blocks, then populate them using GetAggregationPeriod() checks. For each timeframe, calculate the squeeze using (nBB × Standard Deviation) ÷ (nK × ATR) < 1 logic. Create AddLabel() statements with boolean conditions to display squeeze status. Use text editor find-and-replace to quickly scale from one timeframe to multiple timeframes.
ThinkOrSwim's built-in TTM squeeze function has limitations when used within aggregation period if/else statements, often returning false squeeze signals. The function doesn't properly handle boolean returns across different timeframes. Instead, use custom source code that recreates the squeeze calculation using Bollinger Bands (standard deviation) vs Keltner Channels (ATR) relationships for accurate multi-timeframe analysis.
The Multi-Time Frame (MTF) Squeeze Indicator indicator is designed to not repaint once a candle closes. All calculations are based on confirmed price data, ensuring signals remain consistent for backtesting and live trading. However, always verify this behavior in OnDemand mode before using real capital.
You can access any timeframe equal to or greater than your current chart timeframe. From a 1-minute chart, you can access all timeframes from 1-minute to monthly. From a 5-minute chart, you can only access 5-minute and higher. The indicator includes: monthly, weekly, daily, 4-hour, 2-hour, 1-hour, 30-minute, 20-minute, 15-minute, 10-minute, 5-minute, 4-minute, 3-minute, 2-minute, and 1-minute timeframes.
In the AddLabel() statements, change the color parameters. Use Color.RED for squeeze conditions, Color.DARK_GREEN for no squeeze. For advanced customization, convert the color definitions to input variables: input squeezeColor = Color.RED; then use squeezeColor in your AddLabel statements. This allows users to customize colors directly from the studies menu without editing code.
Yes! The MTF framework is completely reusable. Follow the same pattern: define variables outside if/else blocks, use GetAggregationPeriod() checks, populate calculations inside if statements, set defaults in else statements, and create labels. This works for MTF moving averages, RSI conditions, volume analysis, or any custom indicator. Just replace the squeeze-specific calculations with your desired indicator logic.
Look for squeeze alignment across 3+ timeframes for highest-probability setups. When daily, 4-hour, and 1-hour all show squeezes simultaneously, subsequent breakouts often have exceptional follow-through. Use higher timeframes (daily/weekly) for trend direction bias and lower timeframes (5m/15m) for precise entry timing. Avoid trading when too many timeframes show squeezes, as this often precedes unpredictable high-volatility events.
Add Alert() functions after each squeeze calculation. Example: Alert(monthSqueeze and !monthSqueeze[1], "Monthly Squeeze Started", Alert.BAR) triggers when a monthly squeeze begins. Use Alert(monthSqueeze[1] and !monthSqueeze, "Monthly Squeeze Ended", Alert.BAR) for squeeze endings. Enable "Alert when study condition is true" in your watchlist for push notifications via the ThinkOrSwim mobile app when squeeze conditions change.

Here are some resources that you may find useful:

  • Complete Squeeze Course
  • How to import an indicator into ThinkOrSwim (video tutorial)
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

Dollar Cost Average Calculator

Dollar Cost Average Calculator

Beginner-Friendly • 30 mins
Volume Intensity

Volume Intensity

Beginner-Friendly • 27 mins
MTF Market Pulse

MTF Market Pulse

Beginner • 12 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.