Pattern Recognition Trading — The Five Spikes

Presenting and Coding the Five Spikes Pattern

Sofien Kaabar, CFA
7 min readJun 7, 2024


Pattern recognition is a vast field and can have many innovative ideas or unexplored techniques. This article sheds some light on a type of pattern that can be applied in a different way.

Introduction to Candlesticks

Candlestick charts are a widely used form of financial charting that visually represents the price movements of an asset over a specific period of time. These charts provide traders and analysts with valuable insights into the price dynamics of stocks, commodities, currencies, and other financial instruments. Candlestick charts originated in Japan in the 18th century and were used to track the price movements of rice, but they have since become a staple tool in modern technical analysis.

The primary purpose of candlestick charts is to display the open, high, low, and closing prices of an asset for a given time interval, such as a day, week, or month. Each time interval is represented by a single “candlestick,” which consists of a rectangular body and two lines extending from the top and bottom of the body, known as wicks.

Here’s a breakdown of the different components of a candlestick:

  1. Body: The rectangular portion of the candlestick…