Skip to main content Dividend Yield Indicator For ThinkOrSwim (FREE) 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 32 mins ThinkOrSwim

Dividend Yield

Learn how to build a comprehensive dividend yield indicator for ThinkOrSwim that calculates yield using two methods, tracks payout frequency, and provides color-coded alerts based on your threshold settings.

Download Indicator
How to install in ThinkOrSwim →
Table of Contents
  • Why Most Dividend Yield Calculators Get It Wrong
  • The GetDividend Function: Foundation of Dividend Analysis
  • Two Dividend Yield Calculation Methods
  • Smart Payout Frequency Detection
  • Special Dividend Handling
  • Threshold-Based Color Coding
  • Chart Bubble Integration
  • Error Handling and Edge Cases
  • Real-World Application Examples
  • Integration with Broader Dividend Strategy
  • Advanced Customization Options
  • Performance and Data Considerations
  • Troubleshooting Common Issues
  • Dividend Yield Indicator vs. Other Tools
  • Building Your Dividend Investment Process

Follow in Pat Monroe’s Footsteps with Smart Dividend Analysis

During the Great Depression, banker Pat Monroe convinced his small town to invest in Coca-Cola shares. That single share is now worth over $10 million and generates $270,000 in annual dividends. This dividend yield indicator helps you find similar opportunities today.

What this dividend yield indicator provides:

  • Two calculation methods: standard multiplier vs. 1-year lookback
  • Automatic payout frequency detection and special dividend handling
  • Color-coded threshold alerts for quick screening
  • Chart bubbles showing yield directly on price action
  • Works only on daily charts for accurate dividend data access

Perfect for dividend investors who want to analyze yield trends and identify attractive entry points.

For Volatility Box members, I have a special “Pro” version of this indicator available, which also includes a Fair Value Calculation, using the Dividend Discount Model.

Why Most Dividend Yield Calculators Get It Wrong

Most platforms show you current dividend yield, but they don’t handle special dividends correctly or let you analyze yield trends over time. This dividend yield indicator fixes those problems by giving you two calculation methods and visual analysis tools.

The Pat Monroe story isn’t just inspirational – it highlights how dividend analysis can uncover generational wealth opportunities. This dividend yield indicator helps you spot when quality dividend stocks are trading at unusually high yields.

The GetDividend Function: Foundation of Dividend Analysis

ThinkOrSwim’s GetDividend() function returns dividend amounts, but only on daily charts. The dividend yield indicator starts by capturing this data properly:

def dividend = if IsNaN(GetDividend()) then dividend[1] else GetDividend();

This creates a persistent dividend value that carries forward until the next ex-dividend date. But for summation calculations, we need a different approach:

def dividend2 = if IsNaN(GetDividend()) then 0 else GetDividend();

This second variable stores zero on non-dividend days, allowing accurate sum calculations for the 1-year lookback method.

Two Dividend Yield Calculation Methods

The dividend yield indicator offers two calculation approaches because each has advantages:

Method 1: Standard Multiplier
Takes the current dividend and multiplies by expected annual payouts:

dividendYield = (dividend * payoutsMult) / close;

This matches what you see on Yahoo Finance and other platforms. The dividend yield indicator automatically detects payout frequency and handles special dividends.

Method 2: 1-Year Lookback
Sums actual dividends paid over the past 252 trading days:

dividendYield = sumPastYrDividends / close;

This method captures special dividends and varying payout amounts more accurately. Your dividend yield indicator switches between methods via user input.

Smart Payout Frequency Detection

The dividend yield indicator automatically counts dividend payments over the past year:

def totalDividends = Sum(if IsNaN(GetDividend()) then 0 else 1, 252);

This counts actual dividend events, not just carries forward the same value. The dividend yield indicator then determines the appropriate multiplier:

def payoutsMult = if totalDividends >= 12 then 12 else 4;

If there are 12+ payments (monthly dividends), it uses 12. Otherwise, it assumes quarterly (4). This handles most dividend schedules automatically.

Special Dividend Handling

Companies like Permian Basin Royalty Trust (PRT) sometimes issue special dividends. The dividend yield indicator accounts for this by offering both calculation methods. When you see 5 payouts instead of 4, the 1-year lookback method includes that special dividend while the standard method doesn’t.

This flexibility makes the dividend yield indicator more accurate than simple online calculators that can’t distinguish between regular and special dividends.

Threshold-Based Color Coding

The dividend yield indicator includes visual alerts based on your threshold settings:

input threshold = 0.04; // 4% default threshold

When dividend yield exceeds your threshold, labels turn light green. When below, they turn yellow. This makes the dividend yield indicator perfect for screening multiple stocks quickly.

Set your threshold based on your dividend strategy – maybe 4% for conservative income investing or 6% for higher-yield hunting.

Chart Bubble Integration

The dividend yield indicator places bubbles directly on ex-dividend dates:

AddChartBubble(chartBubblesOn and getDividend(), close, AsPercent(dividendYield), 
               if dividendYield > threshold then color.light_green else color.yellow);

This shows you exactly what the yield was when each dividend was declared. Track yield trends over time and spot when current yields are unusually high or low compared to historical levels.

Error Handling and Edge Cases

The dividend yield indicator handles common problems:

Non-Dividend Stocks: Shows “This company does not pay dividends” for growth stocks

Wrong Timeframes: Assert function prevents use on intraday charts:

Assert(getAggregationPeriod() == AggregationPeriod.Day, 
       "The Dividend Yield indicator works on a daily time frame chart only.");

Data Availability: Only displays dividend information when totalDividends > 0

Real-World Application Examples

Verizon Analysis: The dividend yield indicator might show VZ with a 7.48% yield when historical average is 4.3-4.5%. This signals either opportunity (if company fundamentals are solid) or concern (if dividend cut is possible).

Special Dividend Detection: When PRT issues a special dividend, the 1-year lookback method in your dividend yield indicator captures the true annual yield including that special payment.

Monthly vs Quarterly: REITs often pay monthly. The dividend yield indicator automatically detects this and uses the 12x multiplier instead of 4x.

Integration with Broader Dividend Strategy

Use this dividend yield indicator as part of comprehensive dividend analysis:

Yield Trends: High current yields might indicate either opportunity or trouble. Check fundamentals to determine which.

Sector Comparison: Run the dividend yield indicator across utility stocks to find the highest-yielding names in the sector.

Historical Context: Use chart bubbles to see if current yield is high compared to the stock’s own history.

Entry Timing: Consider initiating positions when quality dividend stocks hit yield levels that historically provided good returns.

Advanced Customization Options

Enhance your dividend yield indicator with these modifications:

Dividend Growth Rate: Add calculations to show year-over-year dividend growth

Payout Ratio Integration: Combine with earnings data to calculate payout ratios

Sector Yield Comparison: Compare individual stock yield to sector ETF yield

Alert Integration: Add alerts when yield crosses above/below threshold levels

Performance and Data Considerations

The dividend yield indicator uses 252-day lookbacks for annual calculations. This provides accurate trailing 12-month data while maintaining reasonable performance.

GetDividend() function only works on daily charts because dividend data isn’t available on intraday timeframes. The Assert statement prevents confusion by blocking the indicator on wrong timeframes.

Troubleshooting Common Issues

No Labels Showing: Check that you’re on a daily chart and the stock actually pays dividends

Wrong Yield Calculations: Verify which calculation method you’re using and whether special dividends are involved

Chart Bubbles Missing: Ensure chartBubblesOn is set to yes and you’re viewing ex-dividend dates

Threshold Colors Wrong: Double-check your threshold percentage – remember it’s decimal format (0.04 = 4%)

Dividend Yield Indicator vs. Other Tools

Compared to basic yield displays:

More Accurate: Handles special dividends and varying payout schedules

Visual Analysis: Chart bubbles show yield trends over time

Customizable: Set your own thresholds and calculation methods

Integrated: Works directly in your ThinkOrSwim charts alongside technical analysis

Building Your Dividend Investment Process

Use this dividend yield indicator as part of a systematic approach:

Step 1: Screen for stocks with yields above your threshold using the color coding

Step 2: Analyze yield trends using chart bubbles – is current yield historically high?

Step 3: Compare both calculation methods – do they align or show discrepancies?

Step 4: Investigate fundamental reasons for unusual yield levels

Step 5: Consider position sizing based on yield sustainability analysis

The dividend yield indicator transforms basic yield analysis into a comprehensive tool for dividend investing. Like Pat Monroe identifying Coca-Cola’s opportunity during the Depression, this indicator helps you spot when quality dividend stocks are offering unusually attractive yields.

Whether you’re building a retirement income portfolio or seeking high-yield opportunities, this dividend yield indicator provides the analysis tools needed to make informed dividend investment decisions.

Dividend Yield Indicator .ts
# Dividend Yield Indicator for ThinkOrSwim

# TOS Indicators

# Home of the Volatility Box

# Indicator: Dividend Yield

# Code written in 2023


// ... 57 more lines ...

Unlock This Code

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

Create Free Account Login
To build a dividend yield indicator in ThinkOrSwim, use the GetDividend() function to access dividend data, then create two calculation methods: (1) current dividend multiplied by annual payouts, and (2) sum of past year's actual dividends. The dividend yield indicator requires daily charts since GetDividend() only works on daily timeframes. Include user controls for calculation type, threshold settings, and display options.
The dividend yield indicator offers two methods: "default" multiplies current dividend by expected annual payouts (matching Yahoo Finance), while "1-yr lookback" sums actual dividends paid over 252 trading days. The default method is faster but may miss special dividends. The 1-year lookback method in the dividend yield indicator captures all actual payments including special dividends and varying amounts.
The dividend yield indicator handles special dividends through its dual calculation system. When companies issue special dividends (like a 5th quarterly payment), the 1-year lookback method includes these payments while the default method uses standard multipliers. The dividend yield indicator also automatically adjusts payout multipliers, using 12 for monthly dividends and 4 for quarterly payments.
The dividend yield indicator requires daily charts because ThinkOrSwim's GetDividend() function only provides dividend data on daily timeframes. The dividend yield indicator includes an Assert statement to prevent errors: Assert(getAggregationPeriod() == AggregationPeriod.Day, "Works on daily timeframe only"). This ensures accurate dividend data access rather than returning null values on intraday charts.
Set threshold alerts in your dividend yield indicator using the input threshold parameter (default 0.04 = 4%). When dividend yield exceeds your threshold, the dividend yield indicator displays green labels and chart bubbles. When below threshold, they appear yellow. Adjust threshold based on your strategy - 4% for conservative income investing or 6% for higher-yield hunting.
Yes, the dividend yield indicator automatically detects non-dividend stocks using totalDividends <= 0 condition. When no dividends are found, the dividend yield indicator displays "This company does not pay dividends" in red text. The dividend yield indicator also hides other labels for non-dividend stocks to avoid confusion, showing only the appropriate error message.
The dividend yield indicator counts actual dividend events over 252 trading days using Sum(if IsNaN(GetDividend()) then 0 else 1, 252). This counts actual ex-dividend dates rather than carrying forward values. The dividend yield indicator then sets multipliers: 12 for monthly dividends (≥12 payouts detected) or 4 for quarterly dividends, automatically adapting to different payout schedules.
Chart bubbles in the dividend yield indicator appear on ex-dividend dates showing the dividend yield percentage at that time. They use the same color coding as labels (green above threshold, yellow below). These bubbles let you track yield trends over time and compare current yield to historical levels. The dividend yield indicator only shows bubbles when chartBubblesOn is enabled and actual dividend dates occur.

Here are some resources that you may find useful:

  • Dividend Yield Pro
  • 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

Multi-Time Frame (MTF) Squeeze Indicator

Multi-Time Frame (MTF) Squeeze Indicator

Beginner • 21 minutes
Dollar Cost Average Calculator

Dollar Cost Average Calculator

Beginner-Friendly • 30 mins
P/E Ratio

P/E Ratio

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