Home Documentation Changelog Paper Trading Download Scanner
Documentation

Dividend Capture Scanner

A complete guide to setting up, running, and understanding the scanner.

On this page

📘 1. Overview

The Dividend Capture Scanner finds and ranks stocks that are about to pay a dividend, so you can buy before the ex-dividend date, collect the dividend, and sell once the price recovers.

It scans a large list of stocks each morning, keeps only the ones worth considering, measures how quickly each one has historically rebounded after past dividends, and ranks them so the best opportunities sit at the top.

🧩 2. Requirements

One-time setup

pip install yfinance pandas requests lxml openpyxl

▶️ 3. Running the Scanner

Open PowerShell or Command Prompt, go to the folder where you saved the scanner, and run it. Replace the path with your actual folder location.

cd "C:\Users\YourName\Documents\stock scanner" python dividend_scanner_v8.py

It scans roughly 576 stocks in parallel and runs a rebound analysis on every stock that passes the filters, finishing in about 1 to 2 minutes. When it finishes, the ranked list prints in the window and is saved in the same folder in two formats: a plain candidates_YYYYMMDD.csv and a formatted candidates_YYYYMMDD.xlsx for Excel, with a bold locked header row and sized columns so it is easy to read.

Tip: Close any open candidates_*.csv or candidates_*.xlsx file before running, otherwise the scanner cannot save the new one.

Automatic morning run

Instead of remembering to run the scanner each day, Windows can start it for you every morning. The helper script run_daily.ps1 runs the scanner and saves each day's output to a dated log file in a logs folder, alongside the usual CSV.

Save run_daily.ps1 in the same folder as the scanner, then register the daily task once (this example uses 8:00 AM):

schtasks /create /tn "DividendScannerDaily" /tr "powershell.exe -NoProfile -ExecutionPolicy Bypass -File \"C:\Users\YourName\Documents\stock scanner\run_daily.ps1\"" /sc daily /st 08:00

To check that the task is set up and see when it will run next:

schtasks /query /tn "DividendScannerDaily"

The kill switch: pause or resume the morning run at any time with one command. No need to delete anything.

schtasks /change /tn "DividendScannerDaily" /disable schtasks /change /tn "DividendScannerDaily" /enable
Note: The path in the first command is an example. Replace it with the folder where you saved the scanner. The computer needs to be on at the scheduled time for the run to happen.

🌐 4. The Stock Universe

The scanner searches the S&P 500 plus a curated set of high-yield income names, combined:

Together this is about 576 stocks. Mutual funds are intentionally left out, as they rarely yield enough to be worthwhile. A couple of funds whose headline yields are mostly a return of the investor's own capital were also removed, since those numbers are misleading for capture.

🔎 5. Filters

Every stock must pass all four checks below. If it fails any one, it is skipped.

FilterDefaultWhy it matters
Ex-dividend dateNext 30 daysOnly shows stocks with a dividend coming up soon. Wide enough to plan a sequence of trades.
Annual yield3% or higherKeeps the dividend worth the risk. Higher yields rank better.
Avg daily volume100,000+ sharesBasic liquidity floor. Thinly-traded names that pass are flagged so you can judge them.
Stock price$5 to $500Avoids penny stocks and keeps position sizes manageable, while still allowing lower-priced CEFs and preferreds.

📈 6. The Rebound Metric

This is the key part of the tool. When a stock pays a dividend, its price usually drops by about that amount on the ex-dividend date. The important question is how long it takes to climb back to the price you paid.

For each stock that passes the filters, the scanner looks at the last two years of price history. For every past ex-dividend date it measures:

A faster, more reliable rebound means your capital is freed up sooner, so it pushes the stock higher in the ranking.

Entry timing and the real drop

The same two years of history are also used to answer two practical questions for each stock:

🏆 7. How Scoring Works

The score is built around capital rotation: the goal is to keep the same money working continuously. You hold a stock through its dividend, sell once the price is back to even or better, then move that money straight into the next upcoming dividend, over and over. The less time your money sits idle, the more dividends it can collect in a year.

So the score rewards the combination of a high yield and a fast rebound, then adjusts for risk:

FactorEffect on score
YieldHigher yield means more collected per trade. Ranked directly by percentage, no tiers.
Rebound speedA faster rebound frees the money sooner, so it can be redeployed into the next dividend. This is the biggest lever.
Recovery ratePast dividends that never recovered are charged at the full 60-day wait in the efficiency math, so unreliable stocks score honestly lower.
Price trendA downward trend lowers the score, since the price may not recover after the dividend. The trend is measured on total-return (dividend-adjusted) prices, so big payers are not unfairly flagged as falling.
LiquidityThinly-traded names are marked down, since they are harder to exit.
The headline number is Ann.Eff%, a theoretical annualised after-tax return assuming the money is rotated continuously. It is a way to compare opportunities on an even footing, not a promise of returns. A lower-yielding stock can still rank well if it rebounds very quickly and reliably.

📊 8. Reading the Output

Each row in the results represents one candidate. Here is what every column means:

ColumnMeaning
TickerThe stock's trading symbol.
PriceCurrent share price.
Days UntilTrading days until the ex-dividend date.
Annual YieldThe full year's dividend as a percentage of the stock price. The list is ranked by yield and rebound together.
Capture YieldThe single dividend payment as a percentage of the price. This is what you actually collect per trade.
Div/100shThe dividend in dollars for one 100-share round lot.
CapitalThe cost of buying 100 shares.
AfterTax35/100The dividend per 100 shares after 35% tax (the conservative estimate).
AfterTax25/100The dividend per 100 shares after 25% tax (the optimistic estimate).
Avg RebAverage trading days to recover to the pre-dividend price. Lower is better.
Worst RebWorst-case recovery time over the period. Shows ">60" if any past dividend never recovered in the window.
RecoveredHow often the stock recovered within the test window.
Best EntryThe back-tested sweet spot: how many trading days before the ex-date buying has historically worked best for this stock.
Drop RatioHow much of the dividend the price actually gives up on the ex-date. 1.0 means the full dividend; below 1.0 means it drops less, which is good.
TrendPrice trend: Up, Down, or Mixed. Downtrends are discouraged.
LiquidityThin, Moderate, or High, based on daily trading volume.
BetaHow much the stock moves relative to the market. Lower is steadier.
Ann.Eff%Theoretical annualised after-tax return if the capital is rotated continuously, taxed at the conservative 35% rate.
ScoreAnn.Eff% adjusted down for a downtrend and thin liquidity. The list is sorted by this.

Round lots

The dollar figures use 100-share round lots because round numbers are far easier to sell than odd amounts.

A note on taxes

Dividend-capture trades are held only days, so both the dividend and any price gain are short-term, taxed at your ordinary income rate rather than the lower 15% to 20% long-term capital-gains rate (which requires holding for over a year). The exact rate depends on deductions and the year's tax rules, so every after-tax figure is shown at two rates side by side: 35% as the conservative estimate and 25% as the optimistic one. Both rates can be changed in the settings.

The Rotation Plan sheet

The Excel file has a second sheet called Rotation Plan. It is a trade calendar that rolls one pot of capital (default $50,000) from one dividend into the next, so the same money is reused as often as possible:

ColumnMeaning
BuyThe day to buy, based on that stock's back-tested Best Entry day. If the money is still tied up then, the plan buys as soon as the cash is free.
Ex-DateThe ex-dividend date you hold through to earn the dividend.
Est. SellThe expected sell day: the ex-date plus that stock's average rebound time.
Cash FreeWhen the money is ready for the next trade (one settlement day after the sale).
Worst RebThe honest risk: the longest that stock has ever taken to recover.
Shares / Cost $Whole 100-share lots bought with the available capital, and what they cost.
Gross Div $The dividend collected before tax and fees.
Net 35% $ / Net 25% $What is kept after any financing fee and tax, shown at both tax rates.
Running 35% $ / Running 25% $The total profit building up across the sequence of trades, at each tax rate.

When the capital is free, the plan looks at the candidates that can be bought within the next 5 trading days and takes the one with the best score, so the money never sits idle waiting for a distant trade.

The visual calendar

Each run also saves a dated rotation_calendar_YYYYMMDD.html in the same folder, matching the CSV and Excel filenames, so each day's plan is kept as a record. Open it in any browser to see the plan as a month-grid calendar: each trade has its own colour, the buy, ex-date, sell, and cash-free days are labelled, and the days in between are tinted so you can see exactly when the money is occupied and when it is free for the next trade. Like the CSV and Excel files, it stays on your computer and is never uploaded.

⚙️ 9. Configuration

All the filter settings live at the top of dividend_scanner_v8.py and can be changed at any time:

MIN_ANNUAL_YIELD = 0.03 # 3% floor MIN_AVG_VOLUME = 100_000 # shares per day MIN_STOCK_PRICE = 5.0 # dollars MAX_STOCK_PRICE = 500.0 # dollars EX_DATE_WINDOW_DAYS = 30 # how far ahead to look TAX_RATE_HIGH = 0.35 # conservative estimate of the tax rate TAX_RATE_LOW = 0.25 # optimistic estimate of the tax rate ROUND_LOT = 100 # shares per lot CAPITAL = 50_000 # dollars rotated in the Rotation Plan FINANCE_FEE = 0.00 # cut taken by a trade-financing company, if any

For example, to only see stocks paying 5% or more, change MIN_ANNUAL_YIELD to 0.05. To change the tax estimates, adjust TAX_RATE_HIGH and TAX_RATE_LOW (for example 0.24 for 24%); the column names follow automatically.

🔌 10. Data Sources

Why Yahoo Finance and not Dividend.com?

Dividend.com does not offer a public data connection, and automatically pulling from its website is unreliable and against most sites' terms of service. Yahoo Finance provides the same dividend calendar data through a clean, free connection.

Why is Interactive Brokers not connected yet?

Interactive Brokers does have a data connection, but it has not been enabled on the account yet. Once it is, the scanner will be able to check live prices, confirm there are enough shares to trade, and place orders directly. That is planned for Stage 2, and it starts with paper trading: the whole strategy runs on simulated money until the real results match the predictions. The step-by-step plan is on the Paper Trading page.