Machine Learning and Algorithmic Pairs Trading in Futures Markets

: This study applies machine learning methods to develop a sustainable pairs trading market-neutral investment strategy across multiple futures markets. Cointegrated pairs with similar price trends are identiﬁed, and a hedge ratio is determined using an Error Correction Model (ECM) framework and support vector machine algorithm based upon the two-step Engle–Granger method. The study shows that normal backwardation and contango do not consistently characterize futures markets, and an algorithmic pairs trading strategy is e ﬀ ective, given the unique predominant price trends of each futures market. Across multiple futures markets, the pairs trading strategy results in larger risk-adjusted returns and lower exposure to market risk, relative to an appropriate benchmark. Backtesting is employed and results show that the pairs trading strategy may hedge against unexpected negative systemic events, speciﬁcally the COVID-19 pandemic, remaining proﬁtable over the period examined.


Introduction
The classic rationale for futures prices is that the current futures contract price reflects the market consensus of the spot price at maturity. Since investors' demand is conveyed in futures markets, the changes in futures prices and spot prices are strongly correlated [1][2][3][4]. Further, Tilton et al. [2] suggest that spot and futures prices exhibit a high correlation in strong contango, while they are less related during periods of backwardation. It is well documented that returns to futures investors are highly associated with market conditions [5][6][7]. In futures markets, there are two important market conditions: contango and backwardation, which are terms used to explain the structure of the forward curve. A futures market in a contango condition exhibits a futures contract forward price that is higher than the spot price. In contrast, a futures market in a backwardation condition exhibits a futures contract forward price below the spot price.
Various papers have studied investor's ability to forecast futures prices [6][7][8], but the evidence is inconclusive. The absence of consistent results regarding forecasting ability may be due to a focus on certain futures markets over relatively short intervals, the impact of changes in market conditions, and the heterogeneous assumption that the rate of returns on futures contracts is normally distributed. In order to provide a more rigorous output, we hypothesize that hypothetical naïve speculators do not demonstrate persistent performance in futures markets using a nonparametric method, as suggested by Henriksson and Merton [9], and Chang [1]. Since the hypothetical speculators do not command any forecasting ability, a rejection of the hypothesis means speculators make positive gains from expected risk premiums. Conditional probabilities result in a rejection of the hypothesis, evidence of the effectiveness of speculator forecasting ability of a price trend. This suggests that investors can exploit a price trend over time in both contango and backwardation market conditions.
Previously, studies have identified that trend-following strategies (or momentum strategies) create significant abnormal returns in futures markets [10][11][12][13][14]. For example, Miffre and Rallis [12] show that trend-following strategies in commodity futures produce sizable returns after transaction costs. Clare et al. [15] identify that trend-following strategies offer appealing risk-adjusted returns. Hurst et al. [14] find that time-series momentum was achieved even during past crisis periods. Previous studies have had a common view on the performance of trend-following strategies-the outperformance of the strategy is not attributed to cross-sectional differences in expected returns across markets, but due to time-series dependence in realized returns [13].
However, there is very little research that has applied machine learning methods to futures investments, as Creamer [15] summarizes. Few studies employ Neural Network [16], Genetic Algorithm [17,18], Support Vector Machine [19], or Reinforcement Learning [20]. Most previous studies limited the application of these methods to index futures trading using technical indicators. Moreover, trend following strategies typically see reversals when futures contracts that previously signaled an upward trend unexpectedly reverse (e.g., COVID-19 market crash). To mitigate this risk, we use a pairs trading market neutral strategy, which involves long and short positions in two different futures contracts with similar time-series price trends. As Rad et al. [21] suggest, the presence of a cointegration relation between two securities indicates a long-term relationship between the two; helping investors accurately implement a pairs trading strategy. Thus, we choose cointegrated pairs that have a similar predominant price trend (e.g., contango and backwardation) and use Support Vector Machine (SVM) to determine a hedge ratio in an Error Correction Model (ECM) framework based upon the two-step Engle-Granger method [22].
From the empirical analysis of the U.S. futures markets, we find that normal backwardation and forecasting theory may not be mutually exclusive, although they can be contrasting. This study shows that normal backwardation and contango do not consistently characterize futures markets, but each futures market presents unique predominant price trends. This finding supports our approach of constructing pairs of futures contracts in the same futures markets as appropriate in developing algorithmic pairs trading strategies. We find that our pairs trading strategy makes notable risk-adjusted returns in various futures markets. Interestingly, our backtesting results show that our strategies can hedge against an unexpected decline in futures prices and importantly remain profitable through the COVID-19 pandemic.
The remainder of the paper is organized as follows. Section 2 presents the development of a measure of futures market conditions, details the model architecture, and a description of the methodology. Results and conclusions are presented in Sections 3 and 4, respectively.

Measurement for Backwardation and Contango
Normal backwardation includes the following assumptions regarding speculators: (i) they take net long positions, (ii) want positive profits, and (iii) do not have the skill to forecast prices. The implication of normal backwardation is that, on average, futures prices rise approaching maturity. Conversely, under the contango market condition, hedgers are net short, and the futures price lies above the expected future spot price; the price of the futures contract falls as the contract approaches maturity.
Assuming speculators are not equipped to forecast prices, the profits they generate can be categorized as a reward for bearing risk rather than for accurate forecasting. To examine this, we define the values and returns of long and short trading positions following Rockwell [23]. Let V L m and V S m be the total value of the trading group's long and short positions, in a specific market m, aggregated over the selected period. Let R m be the rate of return on the long open position in that market. The net return of a trading group credited to basic forecasting skill is defined as in Equation (1).
R A m denotes the actual return for the group; the measure of the special forecasting skill is then obtained, defined as the residual.
Hence, the aggregate return on any set of markets is defined as and its corresponding forecasting skill is computed by When, on average, the group takes a net long position (V L m − V S m > 0), and R m is positive, the R B m measure will be positive. Conversely, the group is roughly net short (V L m − V S m < 0) when R m is negative. From this relationship, we can define the basic skill as (i) the capacity to take a net long position in markets with rising prices, and (ii) the capacity to take a net short position in markets with falling prices.
The definition of the basic skill reflects the long-run skills of a trading group to generate profits in the futures market. Furthermore, forecasting skill reflects the facility of a trading group to alter its position over time in order to take advantage of short-run price trends. In markets where no strong evidence of backwardation or contango appears, forecasting skills will be crucial to make positive returns. For example, both contango and backwardation reflect the term structure of futures prices. Backwardation refers to prices that decline with maturity (downward sloping term structure), and contango is the opposite, with an upward slope. The future spot price is expected to remain similar to the current value so that in backwardation, low futures prices for distant maturities are expected to rise over time. This would provide an expected profit to the speculators who, in aggregate, took on the price risk from hedgers who were holding inventories in the spot market and selling futures to protect against a price drop. A similar argument when hedgers are net-long leads to a contango pattern and expected profits to speculators who are net short.
By analyzing the number of price increase periods over the total number periods (i.e., PIP/TP), we are able to understand price behaviors in futures markets. In terms of PIP/TP, we classify four patterns of futures prices over time: (i) normal backwardation (i.e., prices in the futures markets rise) if PIP/TP > 51%, (ii) contango (i.e., prices in the futures markets decline) if PIT/TP < 49%, (iii) weak backwardation if PIP/TP is between 50% and 51%, and (iv) weak contango if PIP/TP is between 49% and 50%.

Nonparametric Statistical Procedure
To evaluate forecasting ability, we use a nonparametric statistical procedure, as suggested by Henriksson and Merton [9] and Chang [1]. Originally, Henriksson and Merton [9] present this procedure to identify market-timing forecasting skills. As the test suggested by Henriksson and Merton [9] evaluates forecasting skills between any two assets, even though their test procedure is of market timing, Chang [1] altered their procedure to fit the test of forecasting ability. Following their Sustainability 2020, 12, 6791 4 of 21 procedure, we describe (i) the rational behavior of speculators in futures markets is to take a long position when futures contract prices are below prices projected for the point of liquidation; (ii) they will take a short position in futures contracts priced above those projected for the offset point. Let F(t) represent the futures contracts price at t, and R(t) represent the change in futures prices during the period t, given as Thus, speculators forecast either R(t) > 0 or R(t) ≤ 0 before they liquidate or change their investment positions. γ(t) represents the speculator's forecast variable. We consider two forecasting events. The first event is γ(t) = 1, indicating that the forecast at t-1 for period t is R(t) > 0. The second event is γ(t) = 0, indicating that the forecast at t − 1 is R(t) ≤ 0. Following Chang, we suggest conditional probabilities for γ(t) as in Equations (6) and (7).
P s 1 (t) represents the conditional probability of a correct forecast at t − 1 given that R(t) ≤ 0. P s 2 (t) represents the probability of an accurate forecast at t − 1 given that R(t) > 0.
When an investor incorrectly predicts the futures market, it implies there is zero value in forecasting. Our research hypothesis suggests that speculators do not have positive gains. H 0 : P S 1 (t) + P S 2 (t) = 1, P s 1 (t) and P s 2 (t) are unknown. Henriksson and Merton [9] and Chang [1] show this null hypothesis is defined and tested by the hypergeometric distribution.
Utilizing the hypergeometric distribution does not require the estimation of conditional probabilities. Distribution is independent for P s 1 (t) and P s 2 (t) and forecasts are known [1]. For large samples, the hypergeometric distribution is approximately equal to the normal distribution under the central limit theorem. We use parameters in the hypergeometric distribution for this approximation, as in Equations (8) and (9).

Cointegration and Pairs Trading
The pairs trading strategy is developed based on Geometric Brownian Motion (GMB), S(t), which is given by: where X(t) = µt + σB(t) is the Brownian Motion (BM) with drift and S(0) = S 0 > 0 is the inception value. Taking the logarithm provides: where S(t) is log-normally distributed for each t, ∆S(t) = ln(S(t)) − ln(S(0)), and E t (∆S(t)) = µ. Consider S 1 (t) and S 2 (t), which are non-stationary I(1) variables, we can expect any form of a linear combination of S 1 (t) and S 2 (t) to be I(1) as well. However, we can conclude that S 1 (t) and S 2 (t) are cointegrated and have similar stochastic trends if the following linear form is a stationary I(0) process: where ν t is a stationary residual, or spread, and β is the cointegration efficient. As Rad et al. [21] summarize, the Error Correction Model describes the cointegration relationship between two time series variable S 1 (t) and S 2 (t) as in the following forms: where ε(t) is white noise, γ represents a rate of correction, S 2 (t − 1) − βS 1 (t − 1) is the cointegration term, and γ[S 2 (t − 1) − βS 1 (t − 1)] represents an error correction term associated with the mean-reversion property of cointegrated time series. A cointegrated time series demonstrates long-term equilibrium. The error correction term rectifies any short term deviations from equilibrium that may occur in some cases. Hence, the change of spread between time t and t − 1 is given by Let denote E t (∆S 1 (t)) = µ 1 as the expected value of ∆S 1 (t), and E t (∆S 2 (t)) = µ 2 as the expected value of ∆S 2 (t). Then, the expected value of the spread, ∆ν t , is specified as Setting µ 2 − βµ 1 = 0 gives β = µ 2 µ 1 . Replacing β to µ 2 µ 1 yields the following form: The change of the spread for the time period, ∆t, is associated with the profit of buying S 2 (t) and selling the quantity of β for that period.
A two-step Engle-Granger method is utilized to identify the presence of any cointegration between pairs. We first estimate the cointegration coefficient of β, and we estimate the ECM in the next step. In the first step, we use the SVM regression method, which is a machine learning tool suggested by Vapnik [24]. SVM regression is considered a nonparametric method in that it depends on kernel functions (e.g., polynomial kernel, gaussian kernel, radial basis kernel, sigmoid kernels, etc.). As Cao and Tay [25] summarize, given a set of data points (x 1 , y 1 ), (x 1 , y 1 ), . . . , (x N , y N ), which are randomly and independently generated, where x i ∈ X ⊆ R n , y i ∈ Y ⊆ R, and N is the total number of the training sample, SVM approximates the linear function using the form: where x represents the high-dimensional feature spaces. We find β that minimizes the following optimal function Sustainability 2020, 12, 6791 6 of 21 where L ε represents the linear ε the insensitive loss function, x i represents a vector of N input variables x with observed response values y i , ξ i and ξ * i are slack variables for each point, C is constant, and ε is the tube size. By using Lagrange multipliers, we reach the following form: where a i and a * i are non-negative Lagrange multipliers. The β parameter can be obtained using a linear combination of the variables, given by Employing the mean reverting properties and a hedge ratio of β, a systemic pairs trading strategy is designed. The strategy utilizes the cointegrated pairs deviations from long-term equilibrium to determine the long and short positions.

Systemic Trading Architecture
Our trading model, as depicted in Figure 1, consists of five modules, including a data step procedure, analytics procedures, hedging based on the machine learning method, pairs trading, and evaluation of trading performance. where represents the linear the insensitive loss function, ′ represents a vector of N input variables with observed response values , and * are slack variables for each point, C is constant, and is the tube size. By using Lagrange multipliers, we reach the following form: where and * are non-negative Lagrange multipliers. The β parameter can be obtained using a linear combination of the variables, given by ∑ * Employing the mean reverting properties and a hedge ratio of β, a systemic pairs trading strategy is designed. The strategy utilizes the cointegrated pairs deviations from long-term equilibrium to determine the long and short positions.

Systemic Trading Architecture
Our trading model, as depicted in Figure 1, consists of five modules, including a data step procedure, analytics procedures, hedging based on the machine learning method, pairs trading, and evaluation of trading performance. In the first module, we let the trading system automatically gather futures daily data. In the second module, we select pairs among assets in the same market condition (e.g., contango or backwardation) using cointegration based on the error correction model (ECM) suggested by Engle and Granger [22]. In the third module, we calculate a hedge ratio from the SVM-regression after selecting a cointegrated pair from in-sample data. In the fourth module, we generate the spreads based on the hedge ratio using out-of-sample data. We determine long and short signals when the spread deviated from a range of upper and lower levels. In the last trading module, we evaluate our trading strategy using performance measures, including annualized return, annualized standard deviation, Sharpe ratio, and maximum drawdown. In the first module, we let the trading system automatically gather futures daily data. In the second module, we select pairs among assets in the same market condition (e.g., contango or backwardation) using cointegration based on the error correction model (ECM) suggested by Engle and Granger [22]. In the third module, we calculate a hedge ratio from the SVM-regression after selecting a cointegrated pair from in-sample data. In the fourth module, we generate the spreads based on the hedge ratio using out-of-sample data. We determine long and short signals when the spread deviated from a range of upper and lower levels. In the last trading module, we evaluate our trading strategy using performance measures, including annualized return, annualized standard deviation, Sharpe ratio, and maximum drawdown.
Trading Strategy and Hedge Ratio from SVM Extending on Rad et al. [21], we employ a three step approach in selecting the pairs among futures contracts using cointegration. We first classify futures contracts into seven types of contracts, Sustainability 2020, 12, 6791 7 of 21 including grain oil seeds, live stocks, soft, lumber, metal, energy, and financial futures. Secondly, we sort combinations of pairs within each type of futures contract based upon the sum of squared residuals using standardized futures prices. Last, we test cointegration for each selected pair and choose pairs that are statistically significant in the framework of the error correction model. The Engle-Granger two-step approach [22] is used to test whether the selected pairs are cointegrated. The first step utilizes the SVM to estimate the cointegration regression. The second step is to estimate the error correction model (ECM). The SVM regression method in the first step provides the estimation of the cointegration coefficient β. Upon calculation of the spread, the long and short positions are simultaneously opened and closed. Specifically, if the spread at time t is greater than the 15-day rolling moving average plus the 15-day rolling standard deviation, we take a short position. In contrast, if the spread at t is less than the 15-day rolling moving average plus the 15-day rolling standard deviation, we take a long position. When the spread reverts toward the mean, we exit both positions as that is indicative of reverting to long-term equilibrium.

Research Data
Our data include futures settlement prices from January 1998 through December 2018 (the last trading day of each month) published in the Wall Street Journal (WSJ) Futures section and Investor's Business Daily (IBD). The prices are used to create semi-monthly data points, from the first to the 15th day of the month and from the 16th to the end of the month. If the 15th day falls on a non-trading day, the next closest day which results in two equal, or as close to equal, semi-monthly data points is used. Subsequently, there are 504 data points for the futures contracts included in the study. The first data point included is on 15 January 1998 (settlement price on 15 January 1998 minus settlement price on 31 December 1997), and the last data point is obtained on 31 December 2018 (settlement price on 31 December 2018 minus settlement price on 15 December 2018). We then count the number of price increases and decreases in a semi-monthly period over the entire study period.
The price at the start and end point of the period is reported in each futures market, and the change in price over the period is calculated. Price changes are estimated for the most active trading months, an average annual percentage price change of the contract during the period is defined as: The fraction of semi-annual periods where prices increase relative to the total number of periods is calculated.
In order to examine the progression of the pricing mechanisms in futures markets, the sample is divided into two sub-periods 1998-2007 and 2008-2018. The resulting data points for the sub-periods are 240 for the first and 264 for the second. The purpose of this division is to determine if one pricing mechanism is dominant in each futures market and if the dominant mechanism is stable and sustained over the entire sample period. Table 1 reports descriptive price changes across 28 futures markets over the period 1998 to 2018. The Annual Percentage Price Change (APPC) for most futures contracts, excluding the coffee and British Pound markets, shows a positive price increase, with a rising price trend in futures markets over 504 semi-monthly periods. The key reason for the negative APPC in coffee futures stems from Brazil, which represents 40% of global coffee production and has overproduced. Additionally, its currency (REAL) has substantially depreciated-approximately 60% since 2006. The negative APPC in GBP futures can be attributed to market participants' concern regarding the currency market's deeper decline due to Brexit uncertainty. The t-statistic for the difference between the starting and ending price across each futures market is shown in column (4) and indicates almost total support for rejecting the null hypothesis of zero equivalence. Most of the futures contracts experience price increases, excluding coffee and sterling, and the differences are statistically significant at the 1% level. In addition, based on PIP/TP, we observe that 11 futures markets are either contango or weak contango, while the remaining 17 markets are either normal backwardation or weak normal backwardation. APPC in column (5) shows that futures prices in metal and energy markets have sharply increased relative to other futures prices, with an APPC for energy and metal futures ranging from 9.74 to 16.43. To investigate whether the impact of market mechanisms changes over time, we conduct a split sample analysis, dividing the futures price movement into two sub-periods. Table 2 summarizes price changes in futures markets over 240 semi-monthly periods from 1998 to 2007. The prices for the futures contracts have increased in APPC, excluding coffee, lumber, and T-bonds futures. The last column of Table 2 shows that 21 futures markets exhibit price increases of over 50% of the total periods. Noticeably, energy and metal futures are backwardation oriented markets over the sub-sample period. The APPCs of metal and energy futures are approximately nine times greater than that of other futures (32.26 for metal and energy vs. 9.34 for others).   Table 3 includes the number of semi-annual periods in 28 futures markets where there have been price increases. The fraction of the increased periods relative to the total number of periods is reported in parentheses. The majority of futures markets exhibit increases in more than 50% of total periods, indicating that an increasing pattern in futures prices is dominant in the period following the 2007 financial crisis.

Empirical Results and Discussions
Interestingly, in column (6), the grain and oilseeds and energy futures clearly display backwardation, although the energy market has experienced a price decline since the 2007 financial crisis. We observe that speculators could create trading profits by taking a simple long position. However, in column (4) and (5), all the differences for the markets are negative, and the t-statistics are statistically significant at a 1% level. Since this also indicates that naïve speculators could have gone short of creating trading profits, it is not conclusive that the rising trend in prices results in a gain to investors for bearing risk.
In summary, the tables show that the mechanisms exhibit a degree of consistency. For the majority of futures markets examined, the dominant mechanism remains constant. However, we also observe a change in the dominant mechanism of some markets over time (for example, corn, bean, meal, gold, platinum, crude oil, etc.).

Heterogeneous Price Movements
Results indicate heterogeneity exists across futures markets. We observe the coexistence of weak backwardation and weak contango mechanisms in futures markets. The frequency of each mechanism's dominance for all futures markets, applying the fractional definitions presented in the previous section, are presented in Table 4. Contango, weak contango, weak backwardation, and backwardation account for 25.00%, 14.29%, 7.14%, and 53.57% of the frequency of the dominant price mechanism. During the last two decades, approximately one-fourth of the contracts exhibit a sellers' hedge, one-half of the contracts indicate buyers have an incentive to hedge, but 21 percent of contracts do not show strong future price directions. Additionally, during the first sub-sample period, 32 percent of contacts present a buyers' hedge, and 35 percent of contracts display a sellers' hedge. Since the financial crisis, the dominant market mechanism has shifted. During the second sub-sample period, the majority of contracts (60 percent) indicate investors who intend to hedge a price increase. Subsequently, each market is examined thoroughly, and the implications behind the functional mechanisms are discussed. Contrary to a priori belief that sellers in the grain markets will demonstrate a propensity to hedge, only soybean futures show the farmer's incentive to limit downside risk. Wheat contracts show the buyers' (e.g., grain processors) incentive to hedge outweighs that of sellers. We find evidence of backwardation in the feeder cattle market. Alternatively, live cattle and lean hogs contracts show less consistency in price movement, indicating that the trader's forecasting ability (i.e., weak contango or weak backwardation) may better determine their profits. In the remaining agriculture markets, evidence of both backwardation and contango is exhibited. In the livestock sector, live cattle in the second period and feeder cattle in both periods show ranchers' incentives to hedge (52% and 53% respectively); conversely, there is no clear pattern in the lean hogs market. The results reveal the contango market condition, with price increase periods of less than 49%, in "soft" commodities such as coffee and cotton. The conclusion from these results is that over the last twenty years, selling futures contracts may have resulted in a higher probability for profits. Simultaneously, buyers (e.g., coffee brewers like Starbucks) have a strong incentive to hedge risk through buys in the futures market.
Energy markets primarily exhibit strong backwardation. For example, 56% of price increase periods are observed in crude oil. One explanation may be that oil-producing countries (e.g., OPEC members) are prepared to incur a premium to hedge risk. Among industrial commodities, only copper and silver show a mild backwardation in the first period (53% each). Even with a significant surge in price during the evaluation period, the gold futures market does not show backwardation over the whole period (49%). Rather it presents a mild form of contango in the first decade (47%). A short position in the gold futures market may have resulted in higher profitability over this period.
Additionally, we find that sizeable contango occurs in some financial futures markets. Most pronounced in the first period of our study are the Japanese Yen and Swiss Franc futures (46% and 45%, respectively). Logically, the financial futures markets should be the most efficient markets, partly due to higher trading volumes and open interests. However, the S&P 500 futures contracts present a substantial measure of backwardation (53% over the entire period and 55% in the second period). Why does the stock market show backwardation? The current spot index builds in the market's belief that the expected stock return is the risk-free rate plus an equity risk premium, equaling approximately 5%. An investor who owns the index portfolio can hedge by shorting the index future. In order to prevent arbitrage, the futures price must be equal to the current spot price plus the riskless rate r minus the dividend yield d. This is less than the expected future spot price, which would be the current spot price plus r-d + 5%. That is, the future price is 5% lower than the expected spot price; thus the market is in backwardation, and short hedgers expect to pay 5% to speculators as the cost of insurance.
The backwardation indicates a high premium conferred from buyers to sellers in interest futures markets, Eurodollars and T-bonds. For example, the U.S. Treasury is strongly incentivized to pay an insurance premium to establish the sale price of government securities. One factor potentially driving this pattern is that over the observation period, the general interest rate levels have fallen. Decreasing interest rates and resulting in rising bonds prices, appear linked through normal backwardation.

Normal Backwardation and Contango: Price Patterns Over Time
Sub-periods are examined to determine the time-series consistency of functional mechanisms for each market, as shown in Table 5. The results in Table 5 indicate that the mechanisms exhibit a tendency toward backwardation (60.7%), as observed in Table 4, most pronounced is the continuation from backwardation to backwardation (25.0%). Another distinct trend is that over the observation period, the contango mechanism seems to lose intensity (14.3%). We observe zero transitions from the backwardation to contango. The implication of the change in the pattern of futures contract prices is an increase in the sellers' needs to hedge. Only coffee and wheat begin and remain contango in both decades. Some markets, such as gold, change from contango to backwardation. In these markets, buyer dominance, driven by large and small speculators, transforms into seller dominance, driven by large hedgers such as mining companies. In the currency market, Swiss Franc, British Pound, and Japanese Yen all convert from the contango to weak contango or weak backwardation mechanism. While there may be many explanations for these price pattern changes, conclusions should be interpreted with caution as multiple factors may drive the change. Table 5. Cross Tabulated Patterns from Sub-period 1 to Sub-period 2. Additionally, we run a nonparametric χ 2 test of independence in order to examine whether there is an association between market dominance over the first and the second sub-sample periods. The χ 2 of 13.67 rejects the null hypothesis that the past market mechanism is independent of the current market mechanism. This is consistent with our findings and supporting evidence that speculators generate positive expected risk premiums based on superior forecasting ability.

Sub-Period (2008-2018) Total Contango Weak Contango Weak Backwardation Backwardation
In summary, presented in Tables 4 and 5, the prevailing trend across futures markets is backwardation, although there are cross-sectional differences. This implies that futures prices incorporate the insurance premiums of sellers seeking to shed risk. In addition, it indicates that futures prices reflect less of the buyer's needs and more of the seller's needs, as futures markets were originally intended.

Nonparametric Statistical Test
In addition to analyzing forecasting ability, nonparametric procedures are applied to futures contract price changes for each semi-monthly period. Following Chang (1985), "up-futures" are defined as positive price changes, and "down-futures" are defined as all negative price change intervals. Table 6 summarizes the null hypothesis H 0 : P S 1 (t) + P S 2 (t) = 1 and the estimated conditional probabilities of speculators in 28 up and down futures contracts. The results show that traders may not be as consistent in their ability to forecast down-futures contracts as they are in forecasting up-futures. For example, the forecasting ability of the agricultural speculators in down-futures outperforms relative to that of other market traders. The average conditional probability in down-futures for agricultural, mineral, currency, and financial futures are 44.0%, 37.5%, 43.3%, 3.25%, respectively. Comparing conditional probabilities of down-futures in column 3 and those of up-futures in column 4, we find that, generally, speculators tend to have better forecasting ability in up-futures than in down-futures. Speculator positions are impactful across agricultural, mineral, currency, and financial futures markets. These findings are consistent with those of Chang [1] and Schwarz [26]. Table 6. Sum of Conditional Probabilities of a Correct Market Position of Speculation Given that R(t) ≤ 0 and R(t) > 0 for H 0 : P s 1 (t) + P s 2 (t) = 1 and H 1 : P s 1 (t) + P s 2 (t) > 1.

Systemic Pairs Trading
To evaluate our pairs trading strategy, daily futures data are collected using Bloomberg over the sample period 2 January2015 to 9 July 2020. The dataset is divided into two sub-samples: in-sample data (2 January 2015-31 December 2017); out-of-sample data (2 January 2018-9 July 2020). The trading strategy is developed using in-sample-data, and backtesting is performed using the out-of-sample dataset. By using in-sample-data, we examine combinations of pairs in the same futures markets. Pairs that can be constructed across futures markets are not considered, as our previous findings suggest that each market has its own unique price trend. Regressions are run using various combinations of pairs constructed within the same markets. Next, the sum of squared residuals is calculated, and the pairs are ranked by the sum of squared residuals. Five pairs of futures remain after excluding pairs that are not statistically cointegrated: CME E-Mini S&P 500 and CME NASDAQ100 futures; COMEX Gold and COMEX Silver futures; COMEX Copper and NYMEX Platinum futures; CBOT Oats and CBOT Corn futures; CME Feeder cattle and CME Live cattle futures. The SVM regression analysis is performed with a tuning process using in-sample-data to estimate the best hedge ratios for the five selected pairs. Table 7 summarizes the hedge ratios for the pairs, ranging from 0.02 (Oats and Corn) to 0.72 (S&P500 and NASDAQ 100). By utilizing the hedge ratios, we calculate spreads, and determine the size of hedging for backtesting. For example, we buy 1 dollar of E-mini S&P500 futures and sell 0.72 dollars of NASDAQ 100 when the spread between the two futures is below a specified lower bound. Conversely, when the spread is above a specified upper bound, 1/0.72 dollars of E-Mini S&P500 futures is shorted, and 1 dollar of NASDAQ 100 is purchased. The lower and upper bounds at time t are dynamically calculated based on the 15-day rolling average and standard deviation of the past spread.  Figure 2 illustrates cumulative returns for the five pairs traded over the out-of-sample period. In order to examine each pair's performance, we compare our pairs trading approach and a buy-and-hold investment strategy. In each panel, a solid black line represents a time series of cumulative returns for pairs trading and a solid red line represents cumulative returns for a corresponding benchmark. In panel (a), the cumulative returns for the pair between E-mini S&P500 and NASDAQ 100 futures steadily grow over the out-of-sample period, while the cumulative returns for the S&P 500 index futures buy-and-hold strategy show wide fluctuation. Notably, when the number of deaths due to the COVID-19 pandemic steeply increased after 24 February 2020, the cumulative return for the benchmark plummeted, and the slope of the time series line reverted to negative. In contrast, the cumulative return for pairs trading still shows an upward trend. Pairs trading two index futures appears to hedge against unexpected systemic risk during the backtesting period. In panel (b), the cumulative returns for the gold and silver futures pair and for gold futures both show an upward trend, but the cumulative returns for pairs trading outperform the benchmark. In panel (c), pairs trading utilizing copper and platinum futures achieves an exceptional outcome. The time series line for pairs trading shows relatively little fluctuation and stays above the benchmark (i.e., a buy-and-hold copper trading) over the trading period. Additionally, the graph shows that pairs trading was not markedly affected by COVID-19, unlike the benchmark. The backtesting result for oats and corn futures in panel (d) shows the return from pairs trading is stable relative to the movement in the cumulative return of the oat futures benchmark. Similarly, in panel (e), pairs trading with feeder and live cattle futures is  To examine whether the application of SVM to estimate cointegration coefficients can improve pairs trading performance in futures markets, we further estimate cointegration coefficients using the ordinary linear square (OLS) estimation method. Figure 3 exhibits the comparison of the cumulative returns of pairs trading between the SVM method and the OLS approach. Each panel provides evidence that SVM improves the pairs trading strategy. The pairs trading algorithm implemented by the SVM coefficient outperforms the OLS pairs trading strategy. Notably, the performance of SVM consistently outperforms prior to COVID-19 and through the pandemic compared to the performance of OLS. SVM can add considerable value in pairs trading with futures contacts. To examine whether the application of SVM to estimate cointegration coefficients can improve pairs trading performance in futures markets, we further estimate cointegration coefficients using the ordinary linear square (OLS) estimation method. Figure 3 exhibits the comparison of the cumulative returns of pairs trading between the SVM method and the OLS approach. Each panel provides evidence that SVM improves the pairs trading strategy. The pairs trading algorithm implemented by the SVM coefficient outperforms the OLS pairs trading strategy. Notably, the performance of SVM consistently outperforms prior to COVID-19 and through the pandemic compared to the performance of OLS. SVM can add considerable value in pairs trading with futures contacts.
In addition to the cumulative returns, performance measures are examined to evaluate the pairs trading system. Table 8 reports the pairs trading performance for the five pairs. Panel A presents the performance of the pairs trading strategy for the E-mini S&P 500 and NASDAQ 100 index futures. The annualized return for the pairs trading is 4.23 percent, which is 3.32 percentage points less than that of the benchmark. However, the Sharpe Ratio (SR) of the pairs trading is higher, as the standard deviation of the benchmark is approximately four times greater than that of the pairs trading. The maximum drawdowns and the maximum observed loss from peak to trough during the trading period, are 3.51 percent for the pairs trading and 34.95 percent for the benchmark, respectively. This suggests that the pairs trading strategy is not considerably riskier than the E-mini S&P 500 index futures benchmark. In panel B, the gold and silver futures pair and gold futures benchmark are presented. They display similarities in annualized return and standard deviation. The pairs trading strategy has slightly higher SR than the benchmark (1.22 vs. 1.11) and has a lower maximum drawdown (6.59 vs. 11.82), which indicates that the pairs trading between gold and silver futures exhibits a relatively neutral performance to market risk events. Panel C reports that the pairs trading strategy for copper and platinum futures outperforms the benchmark. The annualized return for the pairs trading is approximately ten percentage points higher than that of the buy-and-hold copper futures benchmark. The SR of the pairs trading is around six times higher than that of the benchmark (0.85 vs. 0.14). The risk measurements (annualized standard deviation, and maximum drawdown) show the pairs trading strategy is less sensitive to market risk (Ann. Std. Deviation: 14.05 vs. 20.96; Max. Drawdown: 15.51 vs. 27.82). Panel D presents the performance of the oats and corn futures pair. The annualized returns are similar for the pairs trading and oats futures benchmark. The SR for the pairs trading is greater than the benchmark, indicating a larger risk-adjusted return from the pairs trading than the benchmark. The maximum drawdown also shows that the pairs trading is less exposed to downside risk than the oats futures benchmark (13.45 vs. 22.39). Similarly, the feeder and live cattle futures pair is examined in panel E, the annualized return for the pairs trading is 9.15 percentage points greater than that of the feeder cattle benchmark. The annualized standard deviation for the pairs trading is lower than the benchmark, with a higher SR for the pairs trading. During the trading period, the pairs trading strategy had a considerably lower maximum drawdown compared to the benchmark (8.19 vs. 32.63).    In addition to the cumulative returns, performance measures are examined to evaluate the pairs trading system. Table 8 reports the pairs trading performance for the five pairs. Panel A presents the performance of the pairs trading strategy for the E-mini S&P 500 and NASDAQ 100 index futures. The annualized return for the pairs trading is 4.23 percent, which is 3.32 percentage points less than that of the benchmark. However, the Sharpe Ratio (SR) of the pairs trading is higher, as the standard  In short, the backtesting simulations for the selected pairs and benchmarks show the pairs trading strategy, devised from the SVM regression, demonstrates superior performance. Given the period examined includes the systemic impact of COVID-19 on the US futures markets, we examine how the pairs trading strategy can hedge against this systemic shock. The findings indicate that the pairs trading strategy results in higher risk-adjusted returns, with substantially lower exposure to downside risk.

Conclusions
This study develops an algorithmic pairs trading strategy developed through applied machine learning methods. The strategy is motivated by an examination of futures market price trends. We identify that normal backwardation and contango do not consistently characterize futures markets. Our results support certain a priori expectation for futures contract price behavior. For instance, the contango or normal backwardation condition in agriculture and metal markets indicates incentives for a buyer or seller hedging. However, a notable trend this study finds is that over the last two decades, the backwardation mechanism dominates the contango market condition. This implies that the prevailing influence on futures prices is the seller's need for hedging, as was the original intention for futures markets.
Five combinations of statistically cointegrated pairs in the same futures markets are examined: CME E-Mini S&P 500 and CME NASDAQ100 futures; COMEX Gold and COMEX Silver futures; COMEX Copper and NYMEX Platinum futures; CBOT Oats and CBOT Corn futures; CME Feeder cattle and CME Live cattle futures. An SVM regression analysis is performed to estimate the hedge ratios, based upon the Engle-Granger two-step method (Engle and Granger, 1987). By comparing the pairs trading strategy to a buy-and-hold strategy in an appropriate benchmark, we find the pairs trading strategy consistently outperforms the benchmark and exhibits less fluctuation. Finally, the pairs trading strategy demonstrates an ability to withstand the negative impact of COVID-19, whereas the benchmark investments were all negatively impacted by the escalation of the pandemic.
Further examination of the performance of the pairs trading vs. benchmark strategies supports the conclusion that the pairs trading strategy results in higher risk-adjusted returns and lower downside risk. The Sharpe ratios for each pair are meaningfully larger and the maximum drawdowns are meaningfully smaller, than the respective benchmark values. Importantly, the utilization of a pairs trading strategy creates larger risk-adjusted returns and is characterized by a relatively neutral response to market risk events. Constructing pairs following the devised methodology of calculating spreads Sustainability 2020, 12, 6791 20 of 21 and hedge ratios based on the SVM machine learning algorithm can generate a more sustainable market neutral trading strategy.
However, our trading approach is limited to a theoretical price. The proposed method assumes that an asset can be bought and sold at the target price without any restriction. Expanding on our study, future research could make contributions to the literature by considering the actual order book dynamics and a scenario where stock trades might be queued.