Portfolio Optimizer
Build efficient portfolios using Modern Portfolio Theory
Portfolio Optimizer
The Portfolio Optimizer helps you build efficient portfolios using Modern Portfolio Theory (MPT) and Monte Carlo simulations.
What is Portfolio Optimization?
Portfolio optimization finds the best allocation of your capital across different assets to:
- Maximize returns for a given level of risk
- Minimize risk for a given level of returns
- Find the optimal balance between risk and reward
Using the Optimizer
Step 1: Select Assets
- Go to Portfolio Optimizer from the sidebar
- Enter stock symbols (e.g., AAPL, GOOGL, MSFT)
- Click Add or press Enter for each symbol
- Add at least 3-5 symbols for meaningful diversification
Step 2: Configure Parameters
| Parameter | Description | Default |
|---|---|---|
| Investment Amount | Total capital to allocate | $10,000 |
| Risk-Free Rate | Treasury rate for Sharpe calculation | 4.5% |
| Time Horizon | Historical data period | 1 Year |
| Simulations | Monte Carlo iterations | 10,000 |
Step 3: Run Optimization
Click Optimize Portfolio to generate results.
Understanding Results
Efficient Frontier
The curved line showing all optimal portfolios:
- X-axis: Risk (Standard Deviation)
- Y-axis: Expected Return
- Blue dots: Individual portfolios from simulations
- Red star: Maximum Sharpe Ratio portfolio
- Green star: Minimum Volatility portfolio
Key Metrics
| Metric | Definition |
|---|---|
| Expected Return | Annualized expected return based on historical data |
| Volatility | Standard deviation of returns (risk measure) |
| Sharpe Ratio | Risk-adjusted return: (Return - Risk-Free Rate) / Volatility |
| Max Drawdown | Largest peak-to-trough decline |
Recommended Allocations
The optimizer shows suggested allocations for:
- Max Sharpe Ratio - Best risk-adjusted returns
- Min Volatility - Lowest risk portfolio
- Equal Weight - Simple 1/N allocation for comparison
Optimization Strategies
Maximum Sharpe Ratio
Best for: Investors seeking optimal risk-adjusted returns
- Maximizes return per unit of risk
- Often the "best" portfolio mathematically
- May concentrate in fewer assets
Minimum Volatility
Best for: Conservative investors prioritizing stability
- Minimizes portfolio variance
- Usually more diversified
- Lower expected returns but smoother ride
Risk Parity
Best for: Balanced risk contribution
- Each asset contributes equally to portfolio risk
- Often results in higher bond/low-vol allocations
- Good for long-term stability
Monte Carlo Simulation
The optimizer runs thousands of simulations to:
- Generate random portfolio weights
- Calculate expected return and risk for each
- Plot all portfolios on the efficient frontier
- Identify optimal portfolios
Why 10,000 Simulations?
More simulations = more accurate frontier, but: - 5,000: Good for quick analysis - 10,000: Standard accuracy (default) - 50,000: High precision (slower)
Correlation Matrix
Shows how assets move relative to each other:
| Correlation | Meaning |
|---|---|
| +1.0 | Perfect positive correlation (move together) |
| 0.0 | No correlation (independent) |
| -1.0 | Perfect negative correlation (move opposite) |
Diversification tip: Look for assets with low or negative correlations.
Applying Results
Save Portfolio
- Review the recommended allocation
- Click Save Portfolio
- Name your portfolio
- Access later from Saved Portfolios
Save as Journal
Create a new trading journal with your optimized allocations:
- Run your optimization
- Click Save as Journal (green button)
- Configure your new journal:
- Journal Name - Pre-filled based on optimization method
- Journal Type - Paper, Live, or Backtest
- Starting Balance - Pre-filled with your investment amount
- Description - Auto-generated with settings and stock list
-
Create Positions - Check to create trades for each allocation
-
Click Create Journal
- Optionally navigate to your new journal
This is useful for: - Testing optimized portfolios in paper trading - Tracking performance of different optimization strategies - Comparing allocation methods over time
Rebalance Existing
- Click Apply to Rebalance
- Compare current holdings vs. optimal
- See required trades to reach target allocation
Limitations
- Based on historical data - past performance doesn't guarantee future results
- Assumes normal distribution of returns
- Doesn't account for transaction costs or taxes
- Requires sufficient historical data for each asset
Tips for Better Results
- Diversify across sectors - Don't just optimize tech stocks
- Include uncorrelated assets - Bonds, commodities, international
- Use realistic timeframes - Match your investment horizon
- Reoptimize periodically - Markets and correlations change
- Consider constraints - Set max allocation per asset if needed