Yuehan's Blog

Can AI Help a Retail Investor Find Market Rhymes?

History doesn't repeat itself, but it often rhymes - Mark Twain

Motivation

As a passionate retail investor, I’ve often found myself staring at price charts, wondering if the "Bull Flag" I see is a genuine signal or just a Rorschach test of my own optimism. While technical analysis offers a framework, it often feels uncomfortably subjective and a lot of the time just confirms one's biases. However, as I began to wonder if there is a way to identify patterns in stock price movements that humans might miss, I hypothesized that if I could find historical moments where the market's mathematical structure resembled today's, I could predict future moves with greater confidence. This led me to build a Vector Similarity Engine, which ignores subjective opinions and instead hunts for objective, mathematical rhymes in the last decade of market data.

How It Works

To make the search engine effective, I realized that simply matching the line of a price chart wasn't enough; comparing raw dollar amounts is misleading because a $5 move can be a massive breakout for a cheap stock but just daily noise for an expensive one. I engineered a "12-Factor Model" to capture the complete market state, normalizing every data point using Z-scores to focus purely on structural relationships rather than absolute dollar values. The 12 factors include Structure (price shape, moving average deviations), Momentum (RSI, MACD, stochastic), Energy (normalized volume, on-balance volume), and Volatility (ATR, Bollinger Band Width). Besides, the price pattern doesn't exist in a vacuum. A breakout during a period of zero interest rates behaves very differently from one during a credit crunch. To account for this economic context, I added a macroeconomic filter using the 10-Year Treasury Yield (the cost of money) and the VIX (a measure of market volatility and fear). Before the model accepts a historical match, it validates the economic conditions of that specific date. If the historical interest rate environment or market volatility levels were drastically different from today's, the match would be rejected even if the price chart matched perfectly.

TO BE CONTINUED