investing

Building a Virtual Stock Portfolio Using the Magic Formula

Last month I wrote about smart investing, highlighting some principles of renowned investors. But how do we actually apply these principles?

In my quest to explore technical analysis for stock investments, I decided to dive into the world of virtual portfolios. My goal? To build a portfolio based on a proven methodology, re-evaluate it every six months, and measure its performance against the broader market.

Approach


To construct this portfolio, I delved into various techniques, watching countless hours of YouTube videos to familiarize myself with the basics of stock screening and selection. Ultimately, I chose the Joel Greenblatt Magic Formula as my guiding principle. This strategy is outlined in a video by the Swedish Investor, which became my blueprint for creating a stock screener.

Step 1: Filtering Stocks

I used TIKR, a robust stock research tool, to compile my initial list of stocks. These were my filtering criteria:

Fundamental Criteria:

  • Exchange: Primary exchanges (e.g., NYSE, NASDAQ)
  • Market Cap: > $30M
  • Total Revenue (2014, 2017, LTM): Minimum thresholds set at $5M and $10M for LTM (Last Twelve Months)
  • Operating Income (2014, 2017, LTM): > $0
  • Shares Outstanding (2014, 2017, LTM): > $0

Display-Only Metrics:

  • Total receivables, inventory, net property, plant, and equipment (LTM)
  • Accounts payable, last TEV, net debt, EBIT, forward P/E (LTM)

I focused on years where I had reliable data: 2014, 2017, and 2021. If you have access to older datasets (e.g., 2006), incorporating them might improve the analysis.

Step 2: Calculating Metrics

I transferred the filtered list into Google Sheets and added custom formulas to calculate key metrics:

  • Operating Margin (LTM): Operating Income ÷ Total Revenues
  • Revenue Growth (2014–LTM, 2017–LTM)
  • Operating Income Growth (2014–LTM, 2017–LTM)
  • Revenue/Share (2014, 2017, LTM)
  • ROIC (Return on Invested Capital)
  • EV/EBIT (Enterprise Value to EBIT)

Additionally, I incorporated insider trading data from InsiderScreener, using XLOOKUP to integrate the values with my spreadsheet.

Step 3: Scoring and Weighting

Each stock was scored based on four key criteria, with assigned weights:

  • Growth: 20%
  • ROIC: 20%
  • EV/EBIT: 40%
  • Insider Purchases: 20%

The final score determined the ranking of stocks.

Step 4: Additional Filters

After scoring, I applied additional filters to refine the list:

  1. Growth Threshold: Must exceed -5%.
  2. Short Interest: Must not exceed 5% (data from MarketBeat).
  3. Net Debt/EBIT: Must not exceed 5x.
  4. Exclusions:
    • Oil companies (personal preference).
    • Companies heavily linked to China (potential regulatory risks).
    • Companies based in Israel (personal preference).

Step 5: Normalization

To account for volatility, I normalized metrics such as revenue, operating income, and growth. This adjustment reshuffled the rankings, and I recalculated scores based on normalized values.

Final Portfolio

After thorough analysis, my portfolio consisted of the following 8 stocks:

TickerCompany NameSectorPriceScoreValuation1
LENLennar CorporationHomebuilding$137.1989%18.9% below fair value
UPSUnited Parcel ServiceLogistics$125.3264%25% below fair value
JNJJohnson & JohnsonPharmaceuticals$144.0862.9%46.3% below fair value
DHID.R. Horton, Inc.Homebuilding$139.8261.8%38% below fair value
KMBKimberly-Clark CorporationHousehold Products$131.0461.7%31.3% below fair value
UTMDUtah Medical ProductsHealthcare Equipment$61.4761.9%41.5% below fair value
GPCGenuine Parts CompanyDistributors$116.7660.2%44.3% below fair value
ALSNAllison Transmission HoldingsMachinery$108.6059.9%37.5% below fair value

Note: Verisign was removed after valuation adjustments showed it was slightly overvalued.

Reflections

This methodology aligns with the principles of the Magic Formula but includes additional factors, such as insider trading and market-specific filters, to tailor it to my preferences.

I am curious to see how this portfolio performs over time. Do these principles hold up in real-world scenarios? I’ll revisit this analysis in six months to measure progress and refine the approach.

  1. according to simplywall.st ↩︎