02Enter your email and click "Get Free API Key." Your key arrives instantly.
03Paste it below. It's stored only in your browser — never sent anywhere else.
Invalid key or connection failed. Check the key and try again.
— no API key needed, but not real prices
Free tier: 25 requests/day · 5 requests/minute. This app fetches 7 tickers (~91 seconds total due to rate-limit gaps). After the first fetch, data is cached in your browser and re-fetched automatically every hour when you open the page.
TSMOM
Cross-Asset Momentum Strategy
LIVE · INITIALISING
Initialising…
0%
Cache
Fetch
Process
Signals
Simulate
Metrics
Monte Carlo
Pairs
Render
QUANT·RESEARCH
Cross-Asset Time-Series Momentum
● LIVE DATA
Live Strategy · Real Market Data · Auto-Updates Monthly
Time-Series Momentum
Live cross-asset momentum strategy. Real monthly prices from Alpha Vantage —
SPY, QQQ, EEM, TLT, HYG, GLD, USO. Every visit auto-fetches the latest month and reruns the full strategy.
Momentum is one of finance's most persistent anomalies. Investors underreact to new information — anchoring to prior beliefs — then overreact as trends become obvious to the crowd. This creates autocorrelation in 12-month returns: past winners keep winning for ~1 more month before mean-reverting.
Academic Foundation
Moskowitz, Ooi & Pedersen (2012) — "Time Series Momentum", JFE — documented strong positive 12-month return autocorrelation across 58 liquid instruments. The finding held out-of-sample across equities, bonds, currencies, and commodities. This is the paper you cite in interviews.
Why Cross-Asset?
When equities trend down, bonds and gold often trend up. Diversifying across uncorrelated asset classes keeps the strategy productive across different macro regimes. This is why managed futures CTAs (commodity trading advisors) systematically run this framework at billions of AUM.
Core Assumption & Its Failure
The strategy requires persistent trends. In mean-reverting, low-dispersion regimes (2009–2012 post-crisis oscillation, 2022 rate shock with correlated equity/bond selloff), the signal degrades and the strategy loses money. Regime awareness is what separates practitioners from naive backtests.
Full Signal Construction — Mathematical Specification
The most recent month's return reverses rather than continues — driven by microstructure effects (bid-ask bounce, liquidity provision). Including it contaminates the momentum signal. This is the "12-1 month momentum" specification standard in academic literature.
Volatility Scaling: The Institutional Technique
Without vol scaling, a 35%-vol asset (USO) dominates a 12%-vol asset (TLT) despite equal signal strength. Scaling by σ_target/σᵢ equalises each asset's risk contribution — so the portfolio is a diversified bet, not accidental concentration in high-vol names.
Behavioural Economics: The Unifying Thread
This strategy and my wellness-technology startup share the same intellectual foundation: human cognitive bias creates predictable, exploitable patterns. In financial markets, anchoring causes investors to underreact to new price information — they cling to prior reference points — then herding amplifies the delayed reaction into a trend. In consumer health behaviour, the same anchoring and social proof mechanisms drive suboptimal habits. The momentum signal is anchoring and herding mathematically formalised: s = sign(r₁₂) is a quantitative model of mass psychology. Kahneman's dual-process theory underlies both — System 1 (fast, intuitive) creates the initial underreaction; System 2 (slow, deliberate) never fully corrects it in time.
Trend Whipsaw Risk
In choppy markets with no directional trend, every false breakout generates a loss plus transaction costs twice (entry + exit). The strategy is designed for trending environments and loses money structurally in mean-reverting regimes. This is not a bug — it is a known, priced-in feature.
Crisis Event Risk
Correlated asset selloffs (March 2020, August 2015) can hit all positions simultaneously before rebalancing. Volatility scaling helps but does not eliminate this — realised vol lags sudden spikes, leaving positions too large at exactly the wrong moment.
Monthly adjusted close prices for 7 instruments across 4 asset classes, 2016–2026 (123 months). Computed live via Pyodide — real Python running in your browser. In production, replace generate_asset_prices() with yfinance.download() or a Bloomberg API call.
Execution Model
Signal computed at end of month t → position implemented at open of month t+1 (1-period lag). Transaction cost of 10bps one-way applied to gross turnover. This is conservative for institutional accounts but realistic for ETF-based implementation at moderate size.
No Look-Ahead Bias
The most common beginner error. All signals use only information available at time t. Positions are shifted forward 1 period before computing returns. Any leakage of future information produces artificially inflated backtests that collapse completely in live trading.
Volatility Window
60-month rolling volatility window captures multiple market regimes while remaining responsive to structural shifts. Shorter windows (12m) are more reactive but noisier. The academic literature uses 12m for the signal lookback and ~60m for the vol estimator.
Current Signals — All Assets
Based on 12-1 month lookback return · Vol-scaled weight shown below each signal
Portfolio Weights Over Time (Last 36 Months)
Volatility-scaled normalised positions · Positive = Long, Negative = Short
Normalised to 1.0 at start · Strategy vs Benchmarks
Drawdown Profile
% decline from rolling peak · Strategy vs SPY
Monthly Turnover
Gross position change · Higher = more transaction costs
Monthly Returns Heatmap
Each cell = net strategy return for that month · Hover for exact value
Reading the Sharpe Ratio
Sharpe = mean excess return / return vol × √12. A Sharpe of 0.5–0.8 is respectable; >1.0 is excellent. The low annual vol of this strategy reflects the cross-asset diversification benefit — no single asset dominates the portfolio risk.
Why Win Rate Is Below 50%
Trend-following strategies structurally win less than 50% of periods. The edge comes from asymmetric payoff: average win >> average loss (measured by profit factor). This is the "cut losses, let winners run" principle mathematically formalised. Low win rate + high profit factor = profitable.
Max Drawdown Matters Most
Max drawdown determines whether a strategy survives in practice — most investors redeem during drawdowns, not after recovery. A MDD <20% is generally manageable for institutional mandates. The deeper the drawdown, the longer and harder the recovery required.
Calmar Ratio
Calmar = CAGR / |Max Drawdown|. Answers: "how much return per unit of worst-case risk?" Hedge funds target Calmar >1.0; above 0.5 is acceptable. It normalises strategies with different vol targets for fair comparison — more honest than Sharpe alone.
Cointegration-based spread · Entry at ±2σ, exit at ±0.5σ · Market-neutral complement to directional TSMOM
Improvement 1: Multi-Horizon Blending
Instead of a single 12-month lookback, blend signals across 3, 6, and 12-month horizons with inverse-volatility weights. This smooths the entry signal, reduces false positives, and captures momentum at multiple timescales simultaneously.
When realised portfolio volatility spikes above a threshold (e.g. 25% annualised), scale all positions by 50% or go flat entirely. Trend-following degrades in volatility explosions. A simple vol-of-vol regime detector meaningfully reduces drawdown without sacrificing much return in normal regimes.
Rule: if σ_60d > 25% → multiply all wᵢ by 0.5
Improvement 3: Walk-Forward Validation
Instead of one fixed backtest, use expanding windows: train on years 1–3, test on year 4; train on 1–4, test on year 5; etc. This simulates real-time deployment and prevents overfitting to any single period. The reported Sharpe on a walk-forward test is far more credible than in-sample metrics.
Pairs Signal Integration
The SPY/QQQ cointegration signal above is market-neutral — it bets on relative value, not market direction. Correlation with TSMOM is near zero. Blending at 70% TSMOM + 30% pairs overlay improves theoretical Sharpe by ~0.15–0.20 through diversification of uncorrelated alpha sources.
Parameter Sensitivity — Sharpe Ratio vs Lookback Window
Computed live on real data · If robust, Sharpe should be stable across 9–15 months · Fragility = overfit
Sensitivity Table
Key metrics across all tested lookbacks
How to read this:
If Sharpe is only high at one specific lookback, the strategy is fragile — it was fit to the data. If Sharpe is consistently positive across 9–18 months, the signal is robust — momentum genuinely exists at this timescale. This test directly addresses the overfitting concern raised in Phase 5.
Monte Carlo Simulation — Terminal Wealth Distribution
500-path block bootstrap · 60-month forward projection · Red = loss, Green = gain
Critical RiskWhy This Strategy Fails in Real Markets
Every systematic strategy has structural failure modes. A practitioner who cannot articulate these is dangerous. Here are the primary failure vectors for TSMOM:
Crowding. When too many CTAs run the same signal on the same assets, the signal becomes self-fulfilling — until it isn't. When crowded positions unwind simultaneously (August 2007 "quant quake"), losses are correlated and extreme. You cannot diversify away crowding risk within a single strategy family.
Trend reversals. The 2009–2012 post-crisis period saw equities, bonds and commodities oscillating without directional trend. TSMOM strategies lost money for 3+ consecutive years. You need either a regime filter or the conviction (and capital) to hold through extended drawdowns — most investors have neither.
Transaction cost reality. Academic papers model costs at the futures level. For an ETF-based implementation, real-world net Sharpe is typically 0.3–0.4 lower than modelled due to bid-ask spreads, market impact, and short borrow costs.
Capacity constraints. The strategy runs well at $10M–$50M. At $500M+, market impact of monthly rebalancing erodes edge — particularly in less liquid instruments. Scalability is a fundamental limit that institutional allocators probe in due diligence.
Methodology RiskOverfitting: The Cardinal Sin of Backtesting
Overfitting occurs when a strategy is optimised to fit historical data rather than capturing a genuine forward-looking signal. It is the most common cause of live trading underperformance.
Parameter selection bias. Why 12-month lookback? If we tested lookbacks from 1 to 24 months and picked the best, our reported Sharpe is inflated. The correct approach: pre-register parameter choices based on academic priors — not in-sample optimisation.
Universe selection bias. We chose SPY, QQQ, EEM, TLT, HYG, GLD, USO. These performed well in 2016–2026. Including instruments that performed poorly would change the results. This is survivorship bias at the instrument level.
Multiple comparison problem. If we tested 20 strategy variants and reported the best one, the metrics are statistically meaningless. Always apply a Bonferroni correction or equivalent when reporting results from a strategy search.
Deflated Sharpe Ratio — Harvey & Liu (2015) — The Correct Way to Report
SR_deflated = SR × √[(T/12) / (1 + (γ₁/6)SR² − (γ₂/24)SR²)]
Where γ₁ = skewness, γ₂ = excess kurtosis of returns.
This penalises Sharpe for non-normality and number of tests — mandatory for honest strategy evaluation.
Bid-ask spread. For liquid ETFs like SPY: ~1–2bps. For EEM or USO: 5–15bps. Our 10bps flat assumption may be optimistic for the full universe, especially at end-of-month rebalancing when other CTAs are also trading.
Short-selling costs. Going short ETFs requires borrowing. Borrow cost for easy-to-short names (SPY, QQQ): ~20–50bps/year. For harder-to-borrow names: 100–300bps/year. This alone can eliminate short-leg alpha in the small-cap or commodity space.
Bond-equity correlation shift. The 2022 rate shock changed bond-equity correlation from negative to positive for the first time in 20 years. A strategy built on equity-bond diversification failed badly in 2022. Regime detection is not optional — it is a survival requirement for multi-asset strategies.
Execution slippage in stress. In a stress scenario, monthly rebalancing trades while markets move adversely creates slippage well above normal estimates. The 10bps assumption holds in normal conditions — not in the conditions under which the strategy most needs to trade.
PHASE 06Report Structure & Interview PreparationHow to present this in university applications and hedge fund interviews
Document1–2 Page Report Structure
Abstract (3 sentences): Strategy name, asset universe, headline metric. "I designed and backtested a cross-asset time-series momentum strategy across 7 instruments (2016–2026), implementing institutional volatility scaling and proper look-ahead-bias prevention."
Section 1 — Economic Hypothesis: State the specific market inefficiency. Cite Moskowitz, Ooi & Pedersen (2012). Explain the underreaction → herding cycle. 1 paragraph only.
Section 2 — Signal Construction: Write the key equations — signal formula, vol scaling, normalisation. Show you understand the maths, not just the code. 1 paragraph + equations.
Section 3 — Results: Table of metrics vs benchmarks. One equity curve chart. Brief interpretation. Do NOT oversell — explicitly note the limitations. Showing intellectual honesty is more impressive than impressive numbers.
Section 4 — Critical Evaluation: 3 specific failure modes. This section is what separates serious candidates from cargo-cult backtests. Discuss overfitting risk explicitly — mention the deflated Sharpe ratio.
Section 5 — Extensions: Multi-horizon blending, regime filter, pairs overlay. Shows depth and forward thinking. This is where you demonstrate you understand what a real research agenda looks like.
Walk me through your strategy
"I built a cross-asset time-series momentum strategy based on Moskowitz, Ooi & Pedersen (2012). The core idea: assets trending up over the past 12 months tend to continue — driven by investor underreaction then herding. I implemented this across 7 instruments spanning equities, bonds, and commodities. The key institutional technique I added was volatility scaling — dividing each position by realised vol to equalise risk contribution rather than dollar contribution. I backtested with a proper 1-period execution lag and 10bps transaction costs."
What is the biggest risk in this strategy?
"Three things. First, crowding: CTA trend-following is crowded, and correlated unwinds produce sudden, sharp losses uncorrelated with the signal — see August 2007. Second, regime sensitivity: the strategy loses money in non-trending regimes like 2009–2012 or 2022; a vol-regime filter mitigates this. Third, overfitting: the 12-month lookback was chosen based on academic priors, not in-sample optimisation, but I should still apply walk-forward validation to confirm out-of-sample robustness."
How would you improve this?
"Three directions. Signal refinement: blend 3, 6, and 12-month lookbacks with inverse-volatility weights — this smooths entries and captures momentum at multiple timescales. Risk management: add a realised-vol regime filter that halves positions when portfolio vol exceeds 25% annualised. Robustness: implement expanding walk-forward validation to simulate live deployment — in-sample metrics need out-of-sample verification before I'd trust them for capital allocation."
Why is your win rate below 50%?
"This is expected and correct for trend-following. The strategy's edge comes from asymmetric payoff: average win >> average loss (measured by profit factor), not from being right more often. When a trend develops, the position compounds; when it fails, the loss is contained to that month. This is 'cut losses, let winners run' mathematically formalised. Low win rate + profit factor above 1.0 = positive expected value. A win rate above 50% would actually suggest mean-reversion, which is a different strategy class entirely."
What is the Sharpe ratio measuring?
"Sharpe = excess return over risk-free rate, divided by return volatility, annualised. It answers: how much return am I earning per unit of total risk? Its limitation is assuming normally distributed returns — it penalises upside and downside vol equally. For trend-following strategies with fat tails, the Sortino ratio (downside vol only) is more honest. Also note that Sharpe can be smoothed by stale pricing in alternatives — a red flag in fund due diligence. The deflated Sharpe (Harvey & Liu 2015) also adjusts for the number of strategy tests run."
How do you prevent overfitting?
"Four ways. First, use parameters motivated by economic priors, not in-sample optimisation — the 12-month lookback is justified by the MOP 2012 paper. Second, walk-forward testing: reserve the last 20–30% of data as a hold-out set and never touch it during development. Third, report the deflated Sharpe ratio which adjusts for the number of strategy variants tested. Fourth, robustness checks: if performance collapses when you change the lookback from 12 to 11 or 13 months, the strategy is fragile and likely overfit."
DOWNLOADSAll Files — Single SourceEvery file generated from this page · No external dependencies needed
Live Data ControlsCache & API Key Management
Loading cache info…
How hourly refresh works: Every time you open the page, it checks when prices were last fetched. If it's been more than 1 hour, it re-fetches all 7 tickers from Alpha Vantage and reruns the full strategy. If less than 1 hour, it uses the cached data instantly. This means visiting once an hour keeps your signals current without wasting API calls.
GitHub Pages SetupHow to publish this as a live website
Follow these steps exactly. You only need a browser — works on iPad, iPhone, or any computer.
Step 1 — Download all 4 files above. Save them somewhere easy to find: index.html, strategy.py, requirements.txt, README.md, and .nojekyll. Keep them loose — not inside any folder.
Step 2 — Create a GitHub account at github.com if you don't have one. Use your real name. This appears on your public profile.
Step 3 — Create a new repository. Tap the + icon → New repository. Name it anything (e.g. tsmom-strategy). Set to Public. Do not tick any other boxes. Tap Create repository.
Step 4 — Upload all 5 files. On the empty repo page tap "uploading an existing file." Select all 5 files at once from your Downloads folder. Important: upload the files themselves — not a folder containing them. Commit the changes.
Step 5 — Enable GitHub Pages. Go to Settings → Pages → set Source to Branch: main, Folder: / (root) → Save. Wait 60 seconds.
Step 6 — Your live URL appears in Settings → Pages: https://your-username.github.io/tsmom-strategy. Paste this in university applications, LinkedIn, and your CV.
README.md — Preview
This is what appears on your GitHub repo page
strategy.py — Full Source Code
The complete Python engine · 624 lines · Fully annotated · Run standalone with: python strategy.py