Example codes in MATLAB and Excel
You as a subscriber can gain access to certain example codes written in MATLAB and Excel to be used in my forthcoming book. Go to epchan.com/book to see a tentative list that will expand over time. Use the username and password "sharperatio".

Live spreads for pairs of ETFs':

  • z-score is the spread normalized by their standard deviation. Red cells are oversold, blue cells are overbought.
  • The number of shares for each side of the spread are displayed on numShares1 and numShares2 rows.
  • "Half-life" is the average number of days it takes the spread to revert to half its current value.
  • Refresh the browser to see the latest numbers.

  • Live spreads for XLE vs its Component Stocks:

  • z-score refers to the standardized deviation of this long-short portfolio (XLE and some of its components) from its mean value.
  • The number of shares for each component (including XLE itself) are displayed on the Num Shares row.
  • For an explanation of the XLE vs component stocks, see my article no. 2 below.
  • Refresh the browser to see the latest numbers.

  • Model portfolio for pair trading bank stocks:

  • NOTE: This model portfolio will not be updated starting January 1, 2008. If it is important to you, please email me.

  • This model portfolio is updated at approximately 3:00pm ET every trading day.
  • You may need to refresh the browser to see the latest numbers.
  • The capital on each symbol is about $10,000.
  • Scroll down to the bottom to see the total capital and cumulative realized and unrealized P&L.

  • Articles of interest:

    1. Index tracking and arbitrage using cointegration
    2. Arbitrage between XLE and its Component Stocks
    3. A seasonal trade in gasoline futures
    4. A seasonal trade in Australian dollar futures
    5. A seasonal trade in natural gas futures
    6. Pair Trading Stocks
    7. Updated Charts on ETF Spreads
    8. Updated Chart on IGE-EWC Spread
    9. Cointegration among IGE, EWA and EWC
    10. Small is Beautiful
    11. Using a Machine Learning Tool to Profit from Regime Switching in the Stock Market
    12. MATLAB as an Automated Execution System
    13. Discovering Risk Indicators in the FX Markets
    14. Backtesting and its Pitfalls