How EvidInvest's Portfolio Optimizer Works
A plain-language guide to Modern Portfolio Theory, Max Sharpe optimization, and what the numbers actually mean — including honest caveats.
The Problem: Intuition Isn't Precise Enough
Everyone knows diversification is good. “Don't put all your eggs in one basket” has been investment advice for as long as there have been baskets. But not all diversification is equal. Owning five tech mega-caps is not the same as owning one tech stock, one bank, one pharmaceutical, one utility, and one energy company — even if the dollar amounts are identical.
The difference comes down to correlation. AAPL and MSFT move together when “tech is overvalued” narratives take hold. A utility like NextEra tends to hold up when growth stocks sell off. The pairing gives you realdiversification — the first doesn't.
Harry Markowitz formalized this in 1952: what matters for portfolio risk is not just how risky each stock is individually, but how they move relative to each other. You can combine two moderately risky assets with low correlation and end up with a portfolio less volatile than either asset alone.
The Three Core Concepts
1. Expected Return
The average annualized return we'd expect based on historical log returns over a 365-day lookback window. We use log returns because they compound cleanly and are more statistically stable than simple percentage returns.
2. Volatility
How much do those returns swing? A stock that's up 40% one year and down 30% the next is more volatile than one that consistently returns 8%, even if the average is similar. Measured in annualized percentage terms.
3. The Sharpe Ratio
The key metric. It answers: how much return am I getting per unit of risk?
A Sharpe of 1.0 means 1% of excess return per 1% of volatility. A Sharpe of 2.0 is exceptional. Below 0.5 is poor. The Efficient Frontier is the set of all portfolios that maximize return for a given risk level. The point that maximizes Sharpe is the Max Sharpe (tangency) portfolio— that's what we target.
How EvidInvest's Optimizer Works Step-by-Step
Step 1 — Pull Real Price History
We fetch adjusted close prices for every stock in your portfolio from our database, using a 365-day lookback. Adjusted prices account for dividends and splits, so returns are apples-to-apples.
Step 2 — Compute Log Returns and the Covariance Matrix
For each stock, we compute daily log returns and build the covariance matrix— a grid showing how every pair of stocks moves together. The diagonal contains each stock's variance; off-diagonal cells show pairwise covariance.
Step 3 — OAS Covariance Shrinkage
The raw covariance matrix computed from 365 days of data is noisy. With a portfolio of 15–20 stocks and only 365 data points, the matrix can produce extreme estimates: two stocks that happened to move together for a few months get wildly overstated correlation. Feed noisy covariance into an optimizer and it concentrates 80%+ into a single name.
We apply Oracle Approximating Shrinkage (OAS)— a Ledoit-Wolf style estimator that blends the noisy raw estimate with a clean structured prior (scaled identity matrix). The shrinkage intensity is determined analytically based on your sample size and number of assets. The result: a smoother, more stable covariance matrix that doesn't overfit to short-term noise.
Step 4 — Solve the Constrained Optimization
We maximize the Sharpe ratio subject to:
- All weights ≥ 0 (long-only — no shorting)
- Weights sum to 1
We use projected gradient descent with Armijo backtracking line-search and simplex projection — an iterative method that converges to the true constrained optimum. We also compute the Min Variance portfolio and the full Efficient Frontier.
A Concrete Example
Five large-cap tech names — AAPL, MSFT, GOOGL, AMZN, NVDA — using a 365-day lookback:
| Stock | Ann. Return | Volatility | Sharpe |
|---|---|---|---|
| AAPL | 22% | 24% | 0.74 |
| MSFT | 28% | 26% | 0.90 |
| GOOGL | 35% | 28% | 1.10 |
| AMZN | 42% | 33% | 1.14 |
| NVDA | 118% | 58% | 1.97 |
| Portfolio | Return | Vol | Sharpe |
|---|---|---|---|
| Equal-weight (20% each) | 49% | 31% | 1.44 |
| Max Sharpe | 71% | 43% | 1.55 |
| Min Variance | 29% | 21% | 1.16 |
Honest Caveats
Past returns are noisy estimates of future returns
NVDA returning 118% in the last year reflects an extraordinary AI cycle — not a law of nature. The volatility estimate tends to be more stable and meaningful than the return estimate. Most practitioners trust the covariance matrix more than the expected return vector.
Equal-weight beats MPT more often than you'd expect
This is an established empirical finding. Markowitz optimization is sensitive to input assumptions — small errors in estimated returns compound into large errors in final weights. Equal-weight makes no assumptions and is robust to estimation errors. If you're unsure about your return estimates, equal-weight is a serious alternative.
This is a rebalancing signal, not a set-and-forget strategy
Optimal weights change as correlations shift, volatility regimes change, and stock trajectories diverge. The output answers: given what the data says today, where should I be pointing my portfolio? — not what to lock in for three years.
How to Use It
Use Max Sharpe as a reference point and Min Variance as a floor. If you hold 40% NVDA and the optimizer suggests 38%, that's alignment — no action needed. If you hold 5% NVDA and it suggests 38%, that's worth examining: are you underweighting the best risk-adjusted name due to unfamiliarity or inertia?
The real value of a quant tool for a human investor is not to replace judgment, but to surface the implicit bets you're already making — and ask whether you'd make them consciously.
Rebalancing Alerts
The optimizer is most useful when it runs automaticallyand tells you when something has changed enough to act on. EvidInvest's rebalancing alert system does exactly that — it monitors your tracked portfolio and notifies you when a rebalancing opportunity emerges.
You can trigger a rebalancing run in two ways:
- On a schedule — weekly, every two weeks, monthly, or quarterly. A fresh MPT run fires automatically and you receive a summary by email with the new suggested weights.
- When an alert fires — if your portfolio drifts beyond a threshold, drawdown exceeds a limit, or volatility spikes, the system can also trigger a rebalancing run at the same time. This links your risk monitoring directly to your rebalancing workflow.
Each rebalancing suggestion shows you the before/after Sharpe ratio and volatility, the stocks being rotated in or out, and the new target weights. You review it and hit "Apply" if it makes sense — nothing changes automatically.
The Candidate List
A standard rebalancing can only suggest new weights among the stocks you already hold. If you want the optimizer to consider replacing an underperformer with a new name, you need to tell it what alternatives are on the table.
That's what the candidate listis for. It's a secondary list of stocks you're willing to rotate into — stocks you've been watching or researching. When a rebalancing run fires, the optimizer receives your current holdings plus the candidate list as its universe. It finds the max-Sharpe portfolio across all of them and may assign zero weight to some current holdings and positive weight to candidates — surfacing a rotation recommendation.
To set up your candidate list: go to the Optimizer tab, select your tracked portfolio, and use the "Candidate stocks" section to add from any of your watchlists. A 5% minimum weight floor is applied — any stock that doesn't earn at least 5% of the portfolio drops out of the suggestion entirely, so you won't get noise-level micro-allocations.
The result: your rebalancing suggestions evolve as your watchlist evolves, not just as your current holdings drift.
Available on Premium & Professional
Sign up to get started — the portfolio optimizer, rebalancing alerts, and candidate list are included on paid plans.
Sign Up Free →