Heatmap: 1 Day or 20 Days? Different Time Dimensions Find Different Opportunities
4-section structure: Concept / How We Compute / How to Read / Caveats.
1. Concept
Most heatmaps show only single-day change. Problems:
- News impact typically lands one day, digested over several → single day misses the trend
- Stocks institutions accumulate over days → cumulative percentage reveals "who's being chased"
- Sideways stocks may oscillate ±1% daily but accumulate +15% over 20 days → daily view misses them
Professionals switch time dimensions:
- Intraday → 1 day
- Swing trading → 5 days (week)
- Medium-term → 20 days (month)
- Structural → 1 month / 3 months
Our heatmap now supports 5 time scales.
2. How We Compute
2.1 Cumulative Return Formula
cumulative_return = (close_today / close_N_trading_days_ago) − 1
2.2 Calendar Day vs Trading Day
We approximate trading days using calendar-day lookback:
| Option | Calendar lookback | ≈ Trading days |
|---|---|---|
| daily | previous trading day | 1 |
| 5d | 7 days | ≈ 5 |
| 20d | 28 days | ≈ 20 |
| monthly | 30 days | ≈ 21 |
| quarterly | 91 days | ≈ 63 |
Query: MAX(date) WHERE date <= latest − N_calendar_days.
2.3 Dynamic Color Scaling
Different time scales have very different volatility ranges:
| Period | Color Max | Rationale |
|---|---|---|
| daily | ±9.5% | TW daily limit |
| 5d | ±15% | Weekly typical upper |
| 20d / monthly | ±25% | Monthly typical upper |
| quarterly | ±40% | Quarterly extreme |
Stocks beyond max saturate (deepest red/green); hover for exact value.
2.4 Query String Persistence
Period stored in URL ?period=5d; switching market preserves period. Shareable links include time state.
3. How to Read
3.1 Time Dimension Applications
| Period | Primary Use | Real-World Scenario |
|---|---|---|
| 1 day | Instant momentum | Institutional buying, intraday news shocks |
| 5 days | Short-term swing | Weekly themes, news-cycle reactions |
| 20 days | Medium trend | Sector rotation, earnings effects |
| 1 month | Structural momentum | Cyclical turns, mid-term ranks |
| 3 months | Long-term structure | Bull/bear transitions, theme persistence |
3.2 Cross-Period Reading Art
Most useful technique: switch periods and watch the same stock's color change.
Case 1: 1d green (drop) + 20d deep red (big gain)
→ Healthy pullback. Long-term up-trend; short-term consolidation doesn't break it.
Case 2: 1d red (up) + 20d green (down)
→ Oversold bounce. May not be trend reversal — check volume.
Case 3: 1d / 5d / 20d all deep red
→ Strong sustained momentum across timeframes. If sector peers also red → sector-level rotation.
Case 4: 1d / 5d / 20d all green
→ Broad weakness. If VIX also rising → systemic risk event.
3.3 Market State Diagnostic
Quickly cycle daily → 5d → 20d → quarterly to gauge overall red/green ratio:
- All four mostly red → strong bull
- Mixed, similar ratios → range-bound
- Longer periods redder than shorter (3m red, daily green) → late-bull, momentum fading
- Shorter periods redder (daily red, 3m green) → potential reversal, needs confirmation
4. Caveats
⚠️ Color Saturation Loses Differentiation
Extreme events (2024/8 crash, COVID 2020/3) exceed color maxes → all extreme stocks show identical saturated color.
Mitigate: hover for exact %, or switch to longer periods with wider color range (quarterly ±40%).
⚠️ Calendar-Day Approximation
We approximate trading days with calendar days, which:
- After long holidays (Lunar New Year, national holidays): lookback crosses into pre-holiday prices
- Typhoon days: minor
Strict trading-day query needs ORDER BY date DESC LIMIT N; we traded off for performance.
⚠️ 5d ≠ Week, 20d ≠ Month
- "5 days" (trading) ≠ "1 week" (7 calendar = 5 trading, close but not same)
- "20 days" (trading) ≠ "1 month" (30 calendar = 21 trading, close but not same)
Our 5d ≈ weekly and 20d ≈ monthly are within typical range; no material practical difference.
⚠️ No Dividend Adjustment
Heatmap uses unadjusted prices. Ex-dividend/rights day stocks appear as "big drops" but actually just rights separation. May mislead on loser rankings.
Check "today's announcements" or use adjusted prices via technical indicators.
⚠️ Coverage Limits
- Only listed / OTC / emerging; no ETFs, ADRs, warrants
- Stocks listed < N days lack reference price → absent from longer-period heatmaps
Further Reading
- Using Rankings to Find Strongest Stocks
- Market Breadth (P0.1)
Try It
- Open Heatmap — cycle 1d / 5d / 20d in the header
- Pick a held stock, watch color change across periods
- Observe sector rotation via peer stocks in each period
- For extreme-event days (e.g. 2024/8 drop), switch to 20d and quarterly
- Click 📐 for formulas, color scale rules, calendar-day approximation notes