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

  1. Go to Portfolio Optimizer from the sidebar
  2. Enter stock symbols (e.g., AAPL, GOOGL, MSFT)
  3. Click Add or press Enter for each symbol
  4. 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

The optimizer shows suggested allocations for:

  1. Max Sharpe Ratio - Best risk-adjusted returns
  2. Min Volatility - Lowest risk portfolio
  3. 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:

  1. Generate random portfolio weights
  2. Calculate expected return and risk for each
  3. Plot all portfolios on the efficient frontier
  4. 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

  1. Review the recommended allocation
  2. Click Save Portfolio
  3. Name your portfolio
  4. Access later from Saved Portfolios

Save as Journal

Create a new trading journal with your optimized allocations:

  1. Run your optimization
  2. Click Save as Journal (green button)
  3. Configure your new journal:
  4. Journal Name - Pre-filled based on optimization method
  5. Journal Type - Paper, Live, or Backtest
  6. Starting Balance - Pre-filled with your investment amount
  7. Description - Auto-generated with settings and stock list
  8. Create Positions - Check to create trades for each allocation

  9. Click Create Journal

  10. 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

  1. Click Apply to Rebalance
  2. Compare current holdings vs. optimal
  3. 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

  1. Diversify across sectors - Don't just optimize tech stocks
  2. Include uncorrelated assets - Bonds, commodities, international
  3. Use realistic timeframes - Match your investment horizon
  4. Reoptimize periodically - Markets and correlations change
  5. Consider constraints - Set max allocation per asset if needed