# Using Machine Learning and Candlestick Patterns to Predict the Outcomes of American Football Games
## Methodology  
### Data Transformation into Candlestick  
Candlestick charts used for sports outcome analysis are plotted based on the odds of the sports betting market and the relative actual match outcome. Each candlestick represents a game. The line on winning/losing margin between the team and its opponent (denoted as LD), the line on the total points scored by both teams (denoted as LT), the actual margin (denoted as D) and the actual total points scored (denoted as T) are gathered as the raw data for each game to plot the candlestick. In general, a candlestick in the stock market is defined by the open-high-low-close (OHLC) price, as shown in Figure 1a. In the sports betting market, we refer to [PERSON]'s method [32] and take LD as \"open\" and D as \"close\". The gambling shock reflecting the gap between expectation and reality is defined as the difference between a game outcome and its corresponding line. The difference between \"open\" and \"close\" is treated as the gambling shock related to the line on the winning/losing margin between the team and its opponent, denoted as GSD. GSD is similar to the price spread in the stock market and forms the candlestick's body length. The difference between LT and T is treated as the gambling shock related to the line on the total points scored by both teams, denoted as GST. GST is similar to the intraday price fluctuation degree in the stock market and forms the candlestick's wick length. If GST \(>\) 0, the wick extends above the body. If GST \(<\) 0, the wick extends below the body. If GST \(=\) 0, no wick exists. In general, the wick is called the shadow, and the lower wick is called the tail. The candlestick's body colour is dependent on the relationship of D and LD. If D \(>\) LD, the body colour is white, and the body's maximum and minimum values are defined by D and LD. If LD \(>\) D, the body colour is black, and the body's maximum and minimum values are defined by LD and D. Figure 1b illustrates the use of the candlestick chart in this study. The notations and definitions are as follows:  
D: Team winning/losing margin (i.e., the difference in points scored between the team and its opponent) LD: Line (or spread) on the winning/losing margin between the team and its opponent; the side line in the betting market  
T: Total points scored by both teams  
LT: Line on the total points scored by both teams; the over/under (O/U) line in the betting market  
\[\text{GSD}=\text{D }-\text{LD} \tag{1}\]  
\[\text{GST}=\text{T }-\text{LT} \tag{2}\]  
In this study, we redefine D by calculating the points scored by the opponent team minus the points scored by the favourite team. The opposite value differs according to the value proposed by [PERSON]. However, by this modification, winning/losing based on the negative/positive value of D and LD becomes consistent. For example, when LD is \(-\)5.5, the favourite team wins and may exceed the opposing team's score by 5.5 points. In other words, if the value of LD is negative, the favourite team wins; if it is positive, the favourite team loses. Using this method would reflect the gambling shock appropriately. Finally, the candlestick chart defined by OHLC and the body colour are formulated as follows:  
\[\text{O}=\text{LD} \tag{3}\]  
\[\text{H}=\left\{ \begin{array}{c}\text{MAX}(\text{D},\text{ LD})\ +\ \text{GST}\ (\text{if GST}\ >\ 0)\\ \text{MAX}(\text{D},\text{ LD})\ (\text{if GST}\ <\ 0)\end{array} \right. \tag{4}\]  
\[\text{L}=\left\{ \begin{array}{c}\text{MIN}(\text{D},\text{ LD})\ (\text{if GST}\ >\ 0)\\ \text{MIN}(\text{D},\text{ LD})\ -\ \text{GST}\ (\text{if GST}\ <\ 0)\end{array} \right. \tag{5}\]  
\[\text{C}=\text{D} \tag{6}\]  
\[\text{Body color}=\left\{ \begin{array}{c}\text{White}\ (\text{if D}\ >\ \text{ LD})\\ \text{Black}\ (\text{if LD}\ >\ \text{ D})\end{array} \right. \tag{7}\]  
Seattle's candlestick chart during the 2012-2013 and 2013-2014 seasons, including the pre-season, regular season, and post-season, is plotted in Figure 2 as an example. Figure 1: Candlestick.