# Research on Multistage Dynamic Trading Model Based on Gray Model and Auto-Regressive Integrated Moving Average Model

Authors: Zishan Xu; Chuanggeng Lin; Zhe Zhuang; Lidong Wang
Journal: Discrete Dynamics in Nature and Society
 (2023)

---

## Abstract

Quantitative portfolio investment mainly depends on historical data analysis and market trend prediction to make appropriate decisions, which is an important mean to reduce risks and increase returns. Based on summarizing the existing traditional single forecasting models and multiobjective dynamic programming models, this paper puts forward a new quantitative portfolio model to improve the accuracy of asset price forecasting results and the appropriateness of investment trading strategies, to better realize the maximization of investment returns. This model analyzes and forecasts daily price data by establishing a combination forecasting model of the gray GM (1,1) model and the ARIMA time series model and establishes a multiobjective dynamic programming model with moving average convergence divergence (MACD) and Sharpe ratio indicators as risk constraints to formulate appropriate investment trading strategies. The results show that by solving the quantitative portfolio trading model established in this paper and analyzing the sensitivity and robustness of the model, the price of gold and Bitcoin, two volatile assets, can be accurately predicted, and the best investment portfolio trading strategy can be effectively worked out on the premise of considering the risk level.


---

## Body

## 1. Introduction

In recent years, quantitative portfolio investment strategies have been rapidly developed to reduce risk and increase profit. Quantitative portfolio investment mainly depends on historical data analysis, market trend forecast, potential profit, and risk analysis to make appropriate decisions. In today’s society, more and more people seek to boost their income by investing in assets as the economy continues to grow. Among these assets, the gold price is moderately volatile and liquid, allowing investors to avoid investment risks. Compared to gold, Bitcoin has higher yields, greater volatility, and is not subject to regulation and taxation, which makes ith lot of room for growth in financial markets [1]. Therefore, the investment and trading portfolio of gold and Bitcoin is essential. Every market trader wants to know how to correctly predict their price trends and maximize their profits through the right risk control and trading methods.Then, to predict the price trend of gold and Bitcoin, it is also necessary to understand and study the concepts related to the opening price. The opening price, that is, the market price, is generated through a call auction. Call auction adopts the principle of maximum transaction volume, that is, the maximum transaction volume can be obtained by closing a transaction at this price. In today’s financial market, there are many acts of manipulating the market. These market manipulators use the trading strategy of “selling up” to manipulate the opening price of assets so that the price of assets is consistent with the interests of the manipulators [2]. The results show that the manipulation of the opening price will increase the bid-ask spread and volatility, thus, leading to pricing errors, which will have a great impact on the financial market. Therefore, in order to better study the price forecast and market investment and trading strategies of gold and Bitcoin, local regulators need to focus on market manipulation.To make a better portfolio strategy, it is necessary to conduct further modeling research based on forecasting asset prices. At present, the research hotspots of scholars on asset price prediction mainly include the gray theory forecasting method, time series forecasting method, artificial neural network prediction method, and random forest prediction method, which have a certain role in the prediction of stable time series and draw a series of important conclusions. For example, Abdullah established the ARIMA model to study the gold price and found that the ARIMA model has a good effect on the short-term prediction of the price of gold [3]. Dubey established a gray GM (1,1) forecasting model to make a short-term forecast of the monthly gold price data of the United States from 2010 to 2014 and found that the gray forecasting model has the problem of slow convergence. Therefore, a gray prediction model of metabolism was proposed to improve the calculation speed of the prediction model [4]. Song used the backpropagation (BP) neural network model to forecast the price of gold futures in China and compared the prediction results with those obtained by the gray GM (1,1) method and ARIMA (0,2,1) model. The outcomes demonstrated the superior accuracy of the BP neural network prediction model [5].To obtain better prediction results, many researchers apply the combination forecasting model in the field of price forecasting. Among them, Xiao et al. used two single models, the ARIMA model, and the BP neural network, and the combination of the two models to predict the stock price. The results showed that the ARIMA-BP combination model had the highest prediction accuracy [6]. Kim and Won studied the forecasting ability of the GARCH-LSTM combination model. The results show that the model not only improves the prediction accuracy of stock price but also improves the applicability of the model [7].In modern portfolio management, in 1952, Markowitz proposed the mean-variance model, pioneering the portfolio theory and mean-variance model by solving quadratic programming problems based on the mean yield and variance, but it does not distinguish between high and low deviations from the yield [8]. To overcome this limitation, many scholars, such as Cai et al. have established a multiobjective portfolio optimization model (Mult-M-V-S-SE) and a single-objective portfolio optimization model (M-V-SSE) under uncertainty. Through the comparison of empirical results, it was concluded that the M-V-S-SE model has more advantages and can achieve higher returns [9]. Li and Ng proposed a multistaged mean-variance portfolio model and obtained the optimal investment strategy and effective frontier [10].Many researchers use a single forecasting model to forecast the price data, but the single forecasting model has some limitations in some cases, and the accuracy of the forecasting results is poor. In addition, most people ignore the risk level when establishing the portfolio trading model. Based on this, this paper puts forward a combined forecasting model based on the gray forecasting model and time series model, and a multiobjective dynamic programming model considering risk indicators, which can effectively solve the limitations of a single forecasting model and more accurately deduce the investment transaction formula. In this combined forecasting model, the gray GM (1,1) model and the time series ARIMA model are constructed by MATLAB software and R software, respectively, and the two models are combined. Based on the closing price data of gold and Bitcoin in 2016–2021, the gray GM (1,1) model, ARIMA model, and GM (1,1)–ARIMA combined model are used to forecast. By analyzing the prediction results of the three models, it can be found that the GM (1,1)–ARIMA combined model has higher prediction accuracy and certain practicability. Then, based on the portfolio theory, the mean-variance model is constructed, and it is applied to the resulting portfolio prediction result to formulate the best daily investment trading strategy and help investors maximize their returns. This paper’s originality mostly manifests in two areas:(1)
In view of the linear and nonlinear characteristics of the closing price data of gold and Bitcoin, a GM (1,1)–ARIMA combined forecasting model is proposed, which combines the gray GM (1,1) model with the time series ARIMA model, considers them as a whole, and weights the forecasting results obtained by each forecasting model. In this way, the advantages of each forecasting model can be utilized to a greater extent, the influence of a single forecasting model on various uncertainties can be reduced, and the accuracy of model forecasting can be improved.(2)
Based on the prediction results obtained from the abovementioned combined prediction models, a multiobjective dynamic programming model (mean-variance model) considering risks is established with the Sharpe ratio index as the constraint of risk control. Through the convergence and divergence of the moving average (MACD), the general trend of the future market direction is obtained.To carry out this work, the introduction is presented in Section1. The research methodology used is described in Section 2. Model preparation and establishment are mainly presented in Section 3. Results and discussions are detailed in Section 4. Conclusions are provided in Section 5.In summary, the whole modeling process is shown in Figure1.Figure 1
Model overview.


## 2. Research Methodology

According to the closing price data of gold and Bitcoin in 2016–2021, in order to make market traders get the highest rate of return, that is, to maximize the total return, this paper mainly adopts three research methods to establish a dynamic portfolio model, to work out the best investment trading strategy every day. The three research methods are as follows:


### 2.1. Gray Prediction Method

The gray prediction method is an important method and theory for researchers to predict, evaluate, and analyze data, because of its accurate prediction results and simple implementation process, which is widely used in various fields of society. Zhao thinks that the gray forecasting method is very suitable for data forecasting with small samples, a large fluctuation range, and no obvious rules. Therefore, for the characteristics of the information technology industry of the New Third Board, such as late start and little historical data, he uses the gray forecasting method to forecast the free cash flow of the information technology enterprises of the New Third Board, and the results obtained through verification have a small error and high accuracy [11]. Lao and Sun used a gray forecasting model with small sample characteristics to study the consumption and production of natural gas in China and developed a new discrete fractional nonlinear gray Bernoulli model with a power term (DFNGBM (1,1, α)) to forecast. The results show that the forecasting ability of this model is better than the other models, and it is feasible and effective [12].The gray prediction method is a way to forecast a system with ambiguous variables. All the information about the white system is known, but all the information about the black system is unknown. In between the white system and the black system lies the gray system. The gray system’s prediction is made using the gray prediction technique. By processing the original data, gray prediction can determine the degree of similarity of the development trend of system factors, examine the degree of correlation, and create the appropriate differential equation model, to forecast the current state of things and their likely future evolution. In this paper, the gray model GM (1,1) is mainly established by MATLAB software for quantitative analysis. This method has the characteristics of convenient operation, a small amount of data required, and verifiability.


### 2.2. Time Series Analysis Method

The modeling process of time series analysis is simple, and many researchers use this method to make predictions. Akhtar Sohail et al. used the time series method to predict the exchange rate of the Pakistani rupee, and established the autoregressive moving average model (ARIMA) and the generalized autoregressive conditional heteroscedasticity model (GARCH), respectively. By comparing the results of the two models and their combined models, it was concluded that the combined model (ARCH) was superior to other models in predicting the exchange rate [13]. Chang et al. used the exponential smoothing method and autoregressive moving average model in time series analysis to predict the effect of vaccination outpatient quantity. The results showed that the exponential smoothing method had a higher fitting accuracy and smaller error and had a better prediction effect on vaccination outpatient quantity [14].The time series analysis approach involves creating a statistical time series from a collection of observed values for the same variable, such as purchasing power, sales shift, and economic development. Utilizing certain digital techniques, you may then expand it, anticipate the market’s future development tendency, and calculate its projected value. R software is primarily used in this study to create the time series ARIMA (auto-regressive integrated moving average) model. The main feature of this method is to predict the market demand trend by studying the passage of time, and it is not affected by other external factors. In the process of establishing the ARIMA model, the sequence diagram is used to determine that the sequence is a nonstationary sequence, and then logarithmic transformation and difference operations are performed to make the nonstationary sequence stable. Then, the stationary sequence is tested with white noise, and the original data is a stationary nonwhite noise sequence. According to the auto-correlation diagram and local auto-correlation diagram and their characteristics, the order of the model is determined and the preliminary ARIMA model is gained. Eventually, parameter estimation and residual tests are carried out to determine whether the model fits well and can be used accurately for prediction and analysis. The establishment process of the ARIMA model can be presented in Figure2.Figure 2
Step diagram of ARIMA modeling.


### 2.3. Dynamic Multiobjective Programming Method

At present, researchers mainly use multiobjective dynamic programming to solve various complex optimization problems. Song et al. built a multiobjective programming model of a dynamic wireless energy transmission link based on the dynamics of wireless energy transmission link and used two evolutionary algorithms to solve the model by two-level iteration. The solution findings validated the model’s efficacy and the impact of microwave energy relay transmission on raising the dynamic wireless energy transmission links' average efficiency [15]. Wei et al. established a multiobjective programming model of time function and relative stability under linear weighting according to different situations of dynamic scheduling problems of intelligent RGV and solved it by genetic algorithm with multisegment genetic coding. It was verified that the average time of this model was shortened by 13% compared with the traditional model, and the stability of the processing system was improved [16].The multiobjective programming method is to study the optimization of multiple mutually constrained objectives in a given area at the same time, and the objective functions, constraints, and related parameters may change dynamically with time. In this paper, a multiobjective dynamic programming model (mean-variance model) is established by MATLAB software. In this paper, the daily trading decision is regarded as a cycle, the trading day is divided into several stages, and the corresponding state variables and equations are established. Then, at a given risk level, a multistage mean-variance model considering background risks is found.Based on the aforementioned research techniques, this study first combines the time series ARIMA model and gray model GM (1,1) to provide the best possible combined forecasting model. Then, combined with the combination forecasting model and the mean-variance model, a multistage and multiconstraint dynamic portfolio model is established. In addition to considering the risk of the portfolio itself, the best trading strategy can be successfully deduced by integrating the mean-variance model and other risk constraints to control the risk. The comprehensive design idea of the study is displayed in Figure3.Figure 3
Overall research design idea diagram.


## 2.1. Gray Prediction Method

The gray prediction method is an important method and theory for researchers to predict, evaluate, and analyze data, because of its accurate prediction results and simple implementation process, which is widely used in various fields of society. Zhao thinks that the gray forecasting method is very suitable for data forecasting with small samples, a large fluctuation range, and no obvious rules. Therefore, for the characteristics of the information technology industry of the New Third Board, such as late start and little historical data, he uses the gray forecasting method to forecast the free cash flow of the information technology enterprises of the New Third Board, and the results obtained through verification have a small error and high accuracy [11]. Lao and Sun used a gray forecasting model with small sample characteristics to study the consumption and production of natural gas in China and developed a new discrete fractional nonlinear gray Bernoulli model with a power term (DFNGBM (1,1, α)) to forecast. The results show that the forecasting ability of this model is better than the other models, and it is feasible and effective [12].The gray prediction method is a way to forecast a system with ambiguous variables. All the information about the white system is known, but all the information about the black system is unknown. In between the white system and the black system lies the gray system. The gray system’s prediction is made using the gray prediction technique. By processing the original data, gray prediction can determine the degree of similarity of the development trend of system factors, examine the degree of correlation, and create the appropriate differential equation model, to forecast the current state of things and their likely future evolution. In this paper, the gray model GM (1,1) is mainly established by MATLAB software for quantitative analysis. This method has the characteristics of convenient operation, a small amount of data required, and verifiability.


## 2.2. Time Series Analysis Method

The modeling process of time series analysis is simple, and many researchers use this method to make predictions. Akhtar Sohail et al. used the time series method to predict the exchange rate of the Pakistani rupee, and established the autoregressive moving average model (ARIMA) and the generalized autoregressive conditional heteroscedasticity model (GARCH), respectively. By comparing the results of the two models and their combined models, it was concluded that the combined model (ARCH) was superior to other models in predicting the exchange rate [13]. Chang et al. used the exponential smoothing method and autoregressive moving average model in time series analysis to predict the effect of vaccination outpatient quantity. The results showed that the exponential smoothing method had a higher fitting accuracy and smaller error and had a better prediction effect on vaccination outpatient quantity [14].The time series analysis approach involves creating a statistical time series from a collection of observed values for the same variable, such as purchasing power, sales shift, and economic development. Utilizing certain digital techniques, you may then expand it, anticipate the market’s future development tendency, and calculate its projected value. R software is primarily used in this study to create the time series ARIMA (auto-regressive integrated moving average) model. The main feature of this method is to predict the market demand trend by studying the passage of time, and it is not affected by other external factors. In the process of establishing the ARIMA model, the sequence diagram is used to determine that the sequence is a nonstationary sequence, and then logarithmic transformation and difference operations are performed to make the nonstationary sequence stable. Then, the stationary sequence is tested with white noise, and the original data is a stationary nonwhite noise sequence. According to the auto-correlation diagram and local auto-correlation diagram and their characteristics, the order of the model is determined and the preliminary ARIMA model is gained. Eventually, parameter estimation and residual tests are carried out to determine whether the model fits well and can be used accurately for prediction and analysis. The establishment process of the ARIMA model can be presented in Figure2.Figure 2
Step diagram of ARIMA modeling.


## 2.3. Dynamic Multiobjective Programming Method

At present, researchers mainly use multiobjective dynamic programming to solve various complex optimization problems. Song et al. built a multiobjective programming model of a dynamic wireless energy transmission link based on the dynamics of wireless energy transmission link and used two evolutionary algorithms to solve the model by two-level iteration. The solution findings validated the model’s efficacy and the impact of microwave energy relay transmission on raising the dynamic wireless energy transmission links' average efficiency [15]. Wei et al. established a multiobjective programming model of time function and relative stability under linear weighting according to different situations of dynamic scheduling problems of intelligent RGV and solved it by genetic algorithm with multisegment genetic coding. It was verified that the average time of this model was shortened by 13% compared with the traditional model, and the stability of the processing system was improved [16].The multiobjective programming method is to study the optimization of multiple mutually constrained objectives in a given area at the same time, and the objective functions, constraints, and related parameters may change dynamically with time. In this paper, a multiobjective dynamic programming model (mean-variance model) is established by MATLAB software. In this paper, the daily trading decision is regarded as a cycle, the trading day is divided into several stages, and the corresponding state variables and equations are established. Then, at a given risk level, a multistage mean-variance model considering background risks is found.Based on the aforementioned research techniques, this study first combines the time series ARIMA model and gray model GM (1,1) to provide the best possible combined forecasting model. Then, combined with the combination forecasting model and the mean-variance model, a multistage and multiconstraint dynamic portfolio model is established. In addition to considering the risk of the portfolio itself, the best trading strategy can be successfully deduced by integrating the mean-variance model and other risk constraints to control the risk. The comprehensive design idea of the study is displayed in Figure3.Figure 3
Overall research design idea diagram.


## 3. Model Preparation and Establishment

### 3.1. Assumptions and Justifications

We adopt the following fundamental assumptions, each of which is well supported, to reduce the complexity of the issue. The accuracy of GM (1,1) relies on certain key simplifying assumptions, which are as follows:(i)
Assumption 1: assuming that the attachment sample size is sufficient, the sample data is realistic, and it can reflect the specific situation and eliminate the erroneous data.Justification: assuming that the sample data is not true, there must be a large error in the predicted values predicted by the model.(ii)
Assumption 2: assume that the literature and conclusions cited in the text are correct and reliable.Justification: the gray prediction model used in this article directly uses the conclusions of the existing model and predicts them in combination with the actual situation, so it must be studied based on the correctness of the conclusions.(iii)
Assumption 3: assume that market fluctuations do not affect price changes.Justification: Combining with real life, it can be seen that gold is easily affected by various factors at home and abroad, and market risk is also the biggest potential risk in the gold futures market. Price fluctuations have a big impact. At the same time, the factors affecting the price of Bitcoin are more extensive and have more content. Looking at the world and the international environment, even individual investors are concerned and involved. Therefore, this article does not consider the impact of market fluctuations on the prices of the two investment products.The assumptions based on the dynamic programming model (mean-variance model) are as follows:(iv)
Assumption 4: investors invest all their assets unless they cannot trade gold or make a profit.Justification: think from the investor’s point of view. If there is a profit, invest. On the contrary, keep holding. There is no cost to hold assets.(v)
Assumption 5: the entire investment environment is relatively closed, and the amount that investors finally get is bought and sold for the initial amount in n stages.Justification: the investment market is divided into bull and bear markets, buy in a bull market, sell in a bear market, and invest in stages with an initial amount of $1,000.(vi)
Assumption 6: suppose that the entire investment is continuous, that is, the end of then-1 phase is the same period as the beginning of the n stage, and the assets held by the investor at this time are the same.Justification: the first day of the investment market’s closing price serves as the opening price of the next day. The status variable must be continuous, and the daily trading profit is settled after the close of the market on the same day.


### 3.2. Notations

In this work, we use the nomenclature in Table1 in the model construction. Other uncommon symbols will be introduced once they are used.Table 1
Notations used in this paper.
SymbolDescriptionEkResidualsekRelative residualsX¯Themeanofx0S1The variance ofx0E¯The mean of the residualsS2The variance of the residualsCPosterior difference ratioPMinimum error probabilityLBWhite noise sequence test statistic∇xiTime series first-order differenceQβThe sum of the residuals squared by the time series parameter estimatexnOn the nth day, gold and Bitcoin have the valuePnThe price of Bitcoin on the nth dayBnHave the number of Bitcoin units on the nth dayQnThe price of gold on the nth dayGnHave the number of gold units on the nth dayφThe amount of Bitcoins purchased on the same dayxInitial fundingxtThe anticipated value of the combined forecast model’st periodejThe sum of the squares of errors of thej modelωjThe weights in the prediction model


### 3.3. Model Preparation

In the process of data processing, some data were found to be true, and the mean imputation method was used to make up for it.The analysis of the data provided shows that Bitcoin shows a volatile upward trend and a large fluctuation trend, with an average annual growth rate of 104%. Gold exhibits a fluctuating upward tendency and a little fluctuation trend, with an average yearly growth rate of only 5%, and income is generally stable. Comparing Bitcoin with gold, it can be found that Bitcoin has the characteristics of high yield, but it is difficult to achieve the effect of accurate prediction because of its large fluctuation. In comparison, gold has the characteristics of high stability and accurate prediction results.


### 3.4. Model I: Gray Predictive Model

#### 3.4.1. Establish a GM (1,1) Prediction Model

(1) Additive Processing.X01,X02,…,X0n is the raw data of a certain indicator to be predicted, and the raw data is generated once 1-AGO to obtain a new sequence:(1)x1n=∑i=1nx0.This new sequence has increased stationarity and decreased randomness.(2) Differential Representations. Approximate the trend of the newly generated sequence of numbers described in differential equations, and set a section of ordinary differential equations to be satisfied X1:(2)dx1dt+ax1=u,where a and u are the pending parameters, which can be fitted by the least-square method (OLS).(3)au=BTB−1BTYn.Here,(4)B=−z211−z311...−zn11,Y=x20x30...xn0.(3) Determining the model.(5)dx1dt+a^x1=u^,and time responsiveness(6)x^1n+1=x11−u^a^e−a^k+u^a^.At that time,k=1,2,3,…,n−1 the fitted value calculated from the equation (6) was x^1k+1.At the time, it was a forecast value. This is the fitted value relative to an accumulated sequence, and then reduced with a postsubtraction operation; at that time, the fitted value of the original sequence can be obtained. At that time, the forecast value of the original sequence could be obtained.k≥nx^1k+1x1k=1,2,…,n−1x0x^0k+1k≥nx0


#### 3.4.2. Accuracy Test

(1)
Residual test(7)Residuals:Ek=x0k−x^0k,k=2,3,…,N,Relativeresiduals:ek=x0k−x^0kx0k,k=2,3,…,N.(2)
Posterior residuals test(8)x0Mean:X¯=1N∑k=1Nx0k,x0Variance:S1=1N∑k=1Nx0−X¯2,Meanoftheresiduals:E¯=1N−1∑k=2NEk,Varianceofresiduals:S2=1N−1∑k=2NEk−E¯2,Posteriordifferenceratio:C=S2S1.


### 3.5. Model II: ARIMA Model Based on Time Series

To study the best daily trading strategy for Bitcoin and gold, the ARIMA model is established by using the relevant theory of time series analysis, and then the price data from September 11th, 2016 to September 10th, 2021 are analyzed and predicted according to the model structure.A time series is a sequence obtained by arranging a set of data at certain time intervals, often through its analysis to determine the inherent laws and changes, and using the resulting information to predict future data, the total process is shown in Figure4.Figure 4
The flow of time series forecasting.


#### 3.5.1. Timing Plot Testing

Before performing a time series analysis, the existing data is first converted into a time series format (ts), and then a time series plot is drawn to see if the sequence is stable. A stationary time series always oscillates or fluctuates randomly around a constant value and does not easily change with time, while a nonstationary time series has a clear trend, periodicity, or seasonality. To describe the price stability of gold and Bitcoin over the five-year trading period from September 11, 2016, to September 10, 2021, the stability of gold and Bitcoin was tested using R software, and a timing diagram of the two was drawn (where red represents gold and blue represents bitcoin), as shown in Figure5.Figure 5
Time series chart of the five-year trading period between gold and Bitcoin.As can be seen, the price difference between gold and Bitcoin between September 11, 2016, and September 10, 2021, is very large, and Bitcoin began to rise sharply after 2020, growing faster. Because the price difference between gold and Bitcoin is too large, it is impossible to judge the stability of gold based on Figure5. It can be seen that between the five-year trading periods, the price of gold also has a clear upward trend. In summary, it can be seen from the trend of these data that the original data is a nonstationary series and has strong nonstationarity.


#### 3.5.2. Logarithmic Transformations and Differences

According to the above conclusions, the original data is a nonstationary series, and the changing trend is large. Since building the ARIMA model requires the sequence to be stationary, here we need to perform differential operations on it. First, as can be seen from Figure6, the variances of gold and Bitcoin are unstable, and here they are logarithmically transformed to smooth out the variances of the sequence. Then it is differentially processed, that is, the difference between adjacent observations is calculated, some of the various characteristics of the sequence are removed, the trend of the sequence is reduced, and the nonstationary sequence becomes a stationary sequence. Wherein, the first-order differential operation principle is as follows:(9)∇xi=xi−xi−1.Figure 6
Time series plot after log smoothing and the second-order difference between gold and Bitcoin.It can be observed from Figure6 that after the second-order difference, the timing plot of both is presented in a range of fluctuations, that is, the stationary sequence data comes after the second-order difference, that is, the sequence after the second-order difference is stationary, so the differential order of the ARIMA model is d = 2. This is how the ARIMA model can be built.


#### 3.5.3. Pure Randomness Test

After obtaining the stationary sequence, to judge whether the sequence has analytical and research value, it is necessary to perform a pure randomness test for the sequence, that is, a white noise test. If the result is a white noise sequence, it means that there is no statistical law to follow in the fluctuations of the sequence, so the analysis of the sequence can be stopped, and if the nonwhite noise sequence is obtained, the model fit can continue.The hypothetical conditions of a pure randomness test can be expressed in mathematical terms:(10)H0:ρ1=ρ2=…=ρm=0,H1:thereisatleastonenotequalto0.The test statistic is(11)LB=nn+2∑k=1mρk2n−k∼x2m.If you can reject the null hypothesis and think that the sequence is a nonwhite noise sequence, you can do model fitting;LB>xα2m.If so, the sequence is regarded as white noise, and the study of it can be ended. Otherwise, the null hypothesis cannot be rejected.LB<xα2m.The results of the white noise test on the sequence following the second-order difference are displayed in Table2.Table 2
Results of a white noise test for two sequences after second-order differential.
Box-Ljung testdata: bic_diff2data: gold_diff2X-squared = 1018.5df = 6p value < 2.2e − 16X-squared = 669.53df = 6p value < 2.2e − 16data: bic_diff2data: gold_diff2X-squared = 1033.4df = 12p value < 2.2e − 16X-squared = 690.51df = 12p value < 2.2e − 16Table 2 shows the white noise test results of the 6th and 12th order differences between two sets of data of gold and bitcoin.According to the white noise test in Table2, both the p values of the LB statistic for the 6th order delay of the gold and Bitcoin sequences are less than 2.2 × 10−16, that is, less than the significance level of 0.05, so the original hypothesis that the sequence is significantly rejected as a purely random sequence is considered a nonwhite noise sequence and the model fit can be performed.


#### 3.5.4. Model Ordering

In the case that the sequence is a stationary nonwhite noise sequence, the auto-correlation and partial auto-correlation plots of Bitcoin and gold are plotted, respectively, to determine thep value and q value of the ARIMA (p, d, q) model.The autocorrelation graph of the second-order differential series of Bitcoin shows that the autocorrelation coefficient, after the delay of the 3rd order gradually decays, has a downward trend, and fluctuates within the range of zero values, and the partial autocorrelation plot decays exponentially to zero, that is, it is a tail properties, so a preliminary model can be obtained as ARIMA (1, 2, 3).The autocorrelation diagram and partial autocorrelation diagram of the golden second-order differential sequence show that the autocorrelation coefficient and partial auto-correlation coefficient basically fluctuate around zero. As for the tailing characteristics, the preliminary model is ARIMA (1, 2, 1).


#### 3.5.5. Parameter Estimation

The model is parameterized when the order of the model has been established. That is, combined with the previous analysis, the unknown parameter values in the model are estimated, and the model is evaluated whether it is reasonable. The least squares estimation method is used here to estimate the parameters of the model.Principle: the least squares estimate is the collection of parameter values that minimizes the sum of squares of the residuals.(12)Qβ^=minQβ=min∑i=1nxt−φ1xt−1−L−φpxt−p−θ1εt−1−L−θqεt−q2.Assumptions:xt=0,t>0Residual sum of squares equation:(13)Qβ=∑i=1nεi2=∑i=1nxt−∑i=1tπixt−12.Applying the least squares estimation method to the information of each observation of the series, thep value of the significance test is less than the significance level α = 0.05, that is, the parameter estimation of the model passes the significance test.


#### 3.5.6. Model Testing

After passing the above analysis, to verify whether the model is correct, a test of the residual sequence is required.Also, according to the residual test, the significancep value of the LB statistic of the residual series of Bitcoin and gold is above 0.5, and the null hypothesis cannot be rejected, that is, the residual sequence can be regarded as having successfully passed the white noise test and being a white noise sequence, demonstrating that the model’s ability to fit the data well and that the modeling process was effective.


#### 3.5.7. Model Prediction

By using the above steps, it can be proved that the model passes the stationary test, the pure random test, the parametric test, and the residual test, and that the residual sequence of the model approximates the normal distribution, so you can use this model to make predictions. Using this model, the price forecast for Bitcoin and gold in the coming week is shown in Figures7 and 8.Figure 7
Forecast graph of the Bitcoin ARIMA (1, 2, and 3) model for the coming week.Figure 8
Forecast chart for the coming week of the gold ARIMA (1, 2, and 1) model.According to the following figures, the blue line is the predicted trend for the coming week, and it can be seen from the above chart that both Bitcoin and gold have a slight upward trend in the coming week at a confidence level of 99.5%.


### 3.6. Model III: Combined Predictive Models

The gray prediction model can solve the problems of insufficient data, low sequence integrity, and reliability, and can generate regular new sequences from irregular raw data, but it is only suitable for short- and medium-term predictions and predictions that approximate exponential growth. Time series models may identify the traits, patterns, and development laws of variable changes in time series, allowing them to accurately forecast future changes in variables. However, when significant changes in the external environment take place, huge deviations will result. A single model has certain limitations, which tend to make the error larger, and it is difficult to ensure accurate prediction results. The combined forecasting model combines the gray forecasting model and the time series model, considers them as a whole, and weights the prediction results obtained by each forecasting model. In this way, the advantages of each prediction model can be used to a greater extent, the influence of a single prediction model on various uncertainties can be reduced, and it is possible to increase model prediction accuracy.Suppose the actual observations for the price prediction problem for gold and Bitcoin the next day are vectorsX=x1,x2,…,xn, There are m (m ≥ 2) different prediction methods, and combining the weights in the prediction model in vectors, ω=ω1,ω2,…,ωmT indicates that the predicted value of the j prediction method is, x^1j,x^2j,…,x^nj,j=1,2,…,m, then the combined forecast model’s expected value for the t period is as follows:(14)xt=∑j=1mωjx^tj=ω1x^t1+ω2x^t2+…+ωmx^tm,where, ej is the sum of the squares of errors in the j model, ej=∑t=1nxt−x^tj2Therefore, through the above formula, it can be seen that the weight is calculated from the sum of the error squares of each prediction method and then multiplied by the prediction value of the individual prediction methods, and the prediction results of the combined prediction model can be obtained.


### 3.7. Model IV: Dynamic Programming Models (Mean-Variance Model)

The dynamic programming model was first proposed by Bellman, and the principle of optimality is the core of his theory, which is described as follows:Suppose that the stage variable of a multistage decision process ist = 1, 2, …, T, then the strategy P1,T∗=u1∗,u2∗,…,uT∗ is a sufficient requirement for the best strategy: for any t(1 < t < T), when the initial state is x1, is as follows:(15)V1,Tx1,P1,x∗=minp1,t−1x1V1,t−1x1,P1,t−1+minp1,Tx¯tV1,Tx¯t,P1,t−1,where P1,T=P1,t−1,P1,T, x¯t=Tt−1xt−1,ut−1, xt is the state of the t-stage determined by the given initial state x1 and substrategy P1,t−1.This principle has an essential property that all remaining subdecisions, regardless of previous decisions, must constitute optimal subdecisions.Taking into account the background risk, the equation of state for a multistage portfolio is as follows:(16)xt+1=∑t=1netiuti+xt−utb−∑i=1nutiet0+ubetb=xtet0+Pt′ut+etb−et0ub,where Pt=et1−et0,et2−et0,…,etn−et0,ut=ut1,ut2,…,utn,t = 0, 1, 2, …, T-1In the multistage mean-variance model problem, investors seek a feasible optimal investment strategiesut, so that at a given level of risk, the investor’s expectation of ending wealth xT reaches a maximum ExT, or at a given expected level of termination wealth, the variance VarxT of the investor termination wealth xT is minimized.When the investor’s risk level is given, that is, the varianceVarxT=σ2 of the given investor’s termination wealth xT, the multistage mean-variance model considering the background risk is as follows:(17)xn=C1PnBn+C2QnGn+Cn,max′fxn=C1φPnPm+C2xn−φQnQm.According to Formula (17), the pseudo-code for compiling a dynamic programming model considering risk is shown in Table3 in the appendix.Table 3
Pseudocode of dynamic programming model considering risk.
Algorithm 2: dynamic programming models that consider riskinessInput:Pn,Bn,xOutput:Xn,Qnforx=1 to donIf gold is closedIf the price of Bitcoin fallsSell BitcoinElseIf you have cash, you can buy Bitcoin under the premise of risk controlEndelse, gold does not stop marketingIf today’s total assets are greater than tomorrow’s total assetsfor doj=1toxn−1Calculates the current maximum total asset and retains the maximum valueEndTotal assets under the if optimal scheme have increasedRepurchase assets under the premise of risk controlElseContinue to holdEndElseContinue to holdEndFind out the total assets for todayEndEndWe can know that without risk control, the income in the later period will show an exponential upward trend. After joining the risk control, although the return is reduced, it ensures the safety of our funds.Short-term buy-sell can make a steady income, but such income is very small, through the MACD (moving average convergence divergence) can get a rough trend of the future direction of the market.(18)EMA12=LastdayEMA12∗1113+Priceoftoday∗213,EMA26=LastdayEMA26∗2527+Priceoftoday∗227,DIF=TodayEMA12−TodayEMA26.When both the EMA and the DIF are greater than 0 and the DIF breaks out of the DEA upwards, the system determines that it should buy.With the Sharpe ratio, we can adjust our buying strategy in a timely manner.(19)Sharperatio=ARR−free−riskreturnStandarddeviation.Among them, the average rate of return means the average of the growth rate of the net worth of gold or BitcoinThe risk-rate of return means bank interest rates for the same period. Standard deviation means the variance of the growth rate of the net value of gold or Bitcoin.When the Sharpe ratio of gold is greater than that of Bitcoin, gold is chosen to invest, and if it is not, Bitcoin is chosen to invest. After optimizing it, it is shown in Figure9.Figure 9
Comparison chart of no risk consideration and risk consideration.


## 3.1. Assumptions and Justifications

We adopt the following fundamental assumptions, each of which is well supported, to reduce the complexity of the issue. The accuracy of GM (1,1) relies on certain key simplifying assumptions, which are as follows:(i)
Assumption 1: assuming that the attachment sample size is sufficient, the sample data is realistic, and it can reflect the specific situation and eliminate the erroneous data.Justification: assuming that the sample data is not true, there must be a large error in the predicted values predicted by the model.(ii)
Assumption 2: assume that the literature and conclusions cited in the text are correct and reliable.Justification: the gray prediction model used in this article directly uses the conclusions of the existing model and predicts them in combination with the actual situation, so it must be studied based on the correctness of the conclusions.(iii)
Assumption 3: assume that market fluctuations do not affect price changes.Justification: Combining with real life, it can be seen that gold is easily affected by various factors at home and abroad, and market risk is also the biggest potential risk in the gold futures market. Price fluctuations have a big impact. At the same time, the factors affecting the price of Bitcoin are more extensive and have more content. Looking at the world and the international environment, even individual investors are concerned and involved. Therefore, this article does not consider the impact of market fluctuations on the prices of the two investment products.The assumptions based on the dynamic programming model (mean-variance model) are as follows:(iv)
Assumption 4: investors invest all their assets unless they cannot trade gold or make a profit.Justification: think from the investor’s point of view. If there is a profit, invest. On the contrary, keep holding. There is no cost to hold assets.(v)
Assumption 5: the entire investment environment is relatively closed, and the amount that investors finally get is bought and sold for the initial amount in n stages.Justification: the investment market is divided into bull and bear markets, buy in a bull market, sell in a bear market, and invest in stages with an initial amount of $1,000.(vi)
Assumption 6: suppose that the entire investment is continuous, that is, the end of then-1 phase is the same period as the beginning of the n stage, and the assets held by the investor at this time are the same.Justification: the first day of the investment market’s closing price serves as the opening price of the next day. The status variable must be continuous, and the daily trading profit is settled after the close of the market on the same day.


## 3.2. Notations

In this work, we use the nomenclature in Table1 in the model construction. Other uncommon symbols will be introduced once they are used.Table 1
Notations used in this paper.
SymbolDescriptionEkResidualsekRelative residualsX¯Themeanofx0S1The variance ofx0E¯The mean of the residualsS2The variance of the residualsCPosterior difference ratioPMinimum error probabilityLBWhite noise sequence test statistic∇xiTime series first-order differenceQβThe sum of the residuals squared by the time series parameter estimatexnOn the nth day, gold and Bitcoin have the valuePnThe price of Bitcoin on the nth dayBnHave the number of Bitcoin units on the nth dayQnThe price of gold on the nth dayGnHave the number of gold units on the nth dayφThe amount of Bitcoins purchased on the same dayxInitial fundingxtThe anticipated value of the combined forecast model’st periodejThe sum of the squares of errors of thej modelωjThe weights in the prediction model


## 3.3. Model Preparation

In the process of data processing, some data were found to be true, and the mean imputation method was used to make up for it.The analysis of the data provided shows that Bitcoin shows a volatile upward trend and a large fluctuation trend, with an average annual growth rate of 104%. Gold exhibits a fluctuating upward tendency and a little fluctuation trend, with an average yearly growth rate of only 5%, and income is generally stable. Comparing Bitcoin with gold, it can be found that Bitcoin has the characteristics of high yield, but it is difficult to achieve the effect of accurate prediction because of its large fluctuation. In comparison, gold has the characteristics of high stability and accurate prediction results.


## 3.4. Model I: Gray Predictive Model

### 3.4.1. Establish a GM (1,1) Prediction Model

(1) Additive Processing.X01,X02,…,X0n is the raw data of a certain indicator to be predicted, and the raw data is generated once 1-AGO to obtain a new sequence:(1)x1n=∑i=1nx0.This new sequence has increased stationarity and decreased randomness.(2) Differential Representations. Approximate the trend of the newly generated sequence of numbers described in differential equations, and set a section of ordinary differential equations to be satisfied X1:(2)dx1dt+ax1=u,where a and u are the pending parameters, which can be fitted by the least-square method (OLS).(3)au=BTB−1BTYn.Here,(4)B=−z211−z311...−zn11,Y=x20x30...xn0.(3) Determining the model.(5)dx1dt+a^x1=u^,and time responsiveness(6)x^1n+1=x11−u^a^e−a^k+u^a^.At that time,k=1,2,3,…,n−1 the fitted value calculated from the equation (6) was x^1k+1.At the time, it was a forecast value. This is the fitted value relative to an accumulated sequence, and then reduced with a postsubtraction operation; at that time, the fitted value of the original sequence can be obtained. At that time, the forecast value of the original sequence could be obtained.k≥nx^1k+1x1k=1,2,…,n−1x0x^0k+1k≥nx0


### 3.4.2. Accuracy Test

(1)
Residual test(7)Residuals:Ek=x0k−x^0k,k=2,3,…,N,Relativeresiduals:ek=x0k−x^0kx0k,k=2,3,…,N.(2)
Posterior residuals test(8)x0Mean:X¯=1N∑k=1Nx0k,x0Variance:S1=1N∑k=1Nx0−X¯2,Meanoftheresiduals:E¯=1N−1∑k=2NEk,Varianceofresiduals:S2=1N−1∑k=2NEk−E¯2,Posteriordifferenceratio:C=S2S1.


## 3.4.1. Establish a GM (1,1) Prediction Model

(1) Additive Processing.X01,X02,…,X0n is the raw data of a certain indicator to be predicted, and the raw data is generated once 1-AGO to obtain a new sequence:(1)x1n=∑i=1nx0.This new sequence has increased stationarity and decreased randomness.(2) Differential Representations. Approximate the trend of the newly generated sequence of numbers described in differential equations, and set a section of ordinary differential equations to be satisfied X1:(2)dx1dt+ax1=u,where a and u are the pending parameters, which can be fitted by the least-square method (OLS).(3)au=BTB−1BTYn.Here,(4)B=−z211−z311...−zn11,Y=x20x30...xn0.(3) Determining the model.(5)dx1dt+a^x1=u^,and time responsiveness(6)x^1n+1=x11−u^a^e−a^k+u^a^.At that time,k=1,2,3,…,n−1 the fitted value calculated from the equation (6) was x^1k+1.At the time, it was a forecast value. This is the fitted value relative to an accumulated sequence, and then reduced with a postsubtraction operation; at that time, the fitted value of the original sequence can be obtained. At that time, the forecast value of the original sequence could be obtained.k≥nx^1k+1x1k=1,2,…,n−1x0x^0k+1k≥nx0


## 3.4.2. Accuracy Test

(1)
Residual test(7)Residuals:Ek=x0k−x^0k,k=2,3,…,N,Relativeresiduals:ek=x0k−x^0kx0k,k=2,3,…,N.(2)
Posterior residuals test(8)x0Mean:X¯=1N∑k=1Nx0k,x0Variance:S1=1N∑k=1Nx0−X¯2,Meanoftheresiduals:E¯=1N−1∑k=2NEk,Varianceofresiduals:S2=1N−1∑k=2NEk−E¯2,Posteriordifferenceratio:C=S2S1.


## 3.5. Model II: ARIMA Model Based on Time Series

To study the best daily trading strategy for Bitcoin and gold, the ARIMA model is established by using the relevant theory of time series analysis, and then the price data from September 11th, 2016 to September 10th, 2021 are analyzed and predicted according to the model structure.A time series is a sequence obtained by arranging a set of data at certain time intervals, often through its analysis to determine the inherent laws and changes, and using the resulting information to predict future data, the total process is shown in Figure4.Figure 4
The flow of time series forecasting.


### 3.5.1. Timing Plot Testing

Before performing a time series analysis, the existing data is first converted into a time series format (ts), and then a time series plot is drawn to see if the sequence is stable. A stationary time series always oscillates or fluctuates randomly around a constant value and does not easily change with time, while a nonstationary time series has a clear trend, periodicity, or seasonality. To describe the price stability of gold and Bitcoin over the five-year trading period from September 11, 2016, to September 10, 2021, the stability of gold and Bitcoin was tested using R software, and a timing diagram of the two was drawn (where red represents gold and blue represents bitcoin), as shown in Figure5.Figure 5
Time series chart of the five-year trading period between gold and Bitcoin.As can be seen, the price difference between gold and Bitcoin between September 11, 2016, and September 10, 2021, is very large, and Bitcoin began to rise sharply after 2020, growing faster. Because the price difference between gold and Bitcoin is too large, it is impossible to judge the stability of gold based on Figure5. It can be seen that between the five-year trading periods, the price of gold also has a clear upward trend. In summary, it can be seen from the trend of these data that the original data is a nonstationary series and has strong nonstationarity.


### 3.5.2. Logarithmic Transformations and Differences

According to the above conclusions, the original data is a nonstationary series, and the changing trend is large. Since building the ARIMA model requires the sequence to be stationary, here we need to perform differential operations on it. First, as can be seen from Figure6, the variances of gold and Bitcoin are unstable, and here they are logarithmically transformed to smooth out the variances of the sequence. Then it is differentially processed, that is, the difference between adjacent observations is calculated, some of the various characteristics of the sequence are removed, the trend of the sequence is reduced, and the nonstationary sequence becomes a stationary sequence. Wherein, the first-order differential operation principle is as follows:(9)∇xi=xi−xi−1.Figure 6
Time series plot after log smoothing and the second-order difference between gold and Bitcoin.It can be observed from Figure6 that after the second-order difference, the timing plot of both is presented in a range of fluctuations, that is, the stationary sequence data comes after the second-order difference, that is, the sequence after the second-order difference is stationary, so the differential order of the ARIMA model is d = 2. This is how the ARIMA model can be built.


### 3.5.3. Pure Randomness Test

After obtaining the stationary sequence, to judge whether the sequence has analytical and research value, it is necessary to perform a pure randomness test for the sequence, that is, a white noise test. If the result is a white noise sequence, it means that there is no statistical law to follow in the fluctuations of the sequence, so the analysis of the sequence can be stopped, and if the nonwhite noise sequence is obtained, the model fit can continue.The hypothetical conditions of a pure randomness test can be expressed in mathematical terms:(10)H0:ρ1=ρ2=…=ρm=0,H1:thereisatleastonenotequalto0.The test statistic is(11)LB=nn+2∑k=1mρk2n−k∼x2m.If you can reject the null hypothesis and think that the sequence is a nonwhite noise sequence, you can do model fitting;LB>xα2m.If so, the sequence is regarded as white noise, and the study of it can be ended. Otherwise, the null hypothesis cannot be rejected.LB<xα2m.The results of the white noise test on the sequence following the second-order difference are displayed in Table2.Table 2
Results of a white noise test for two sequences after second-order differential.
Box-Ljung testdata: bic_diff2data: gold_diff2X-squared = 1018.5df = 6p value < 2.2e − 16X-squared = 669.53df = 6p value < 2.2e − 16data: bic_diff2data: gold_diff2X-squared = 1033.4df = 12p value < 2.2e − 16X-squared = 690.51df = 12p value < 2.2e − 16Table 2 shows the white noise test results of the 6th and 12th order differences between two sets of data of gold and bitcoin.According to the white noise test in Table2, both the p values of the LB statistic for the 6th order delay of the gold and Bitcoin sequences are less than 2.2 × 10−16, that is, less than the significance level of 0.05, so the original hypothesis that the sequence is significantly rejected as a purely random sequence is considered a nonwhite noise sequence and the model fit can be performed.


### 3.5.4. Model Ordering

In the case that the sequence is a stationary nonwhite noise sequence, the auto-correlation and partial auto-correlation plots of Bitcoin and gold are plotted, respectively, to determine thep value and q value of the ARIMA (p, d, q) model.The autocorrelation graph of the second-order differential series of Bitcoin shows that the autocorrelation coefficient, after the delay of the 3rd order gradually decays, has a downward trend, and fluctuates within the range of zero values, and the partial autocorrelation plot decays exponentially to zero, that is, it is a tail properties, so a preliminary model can be obtained as ARIMA (1, 2, 3).The autocorrelation diagram and partial autocorrelation diagram of the golden second-order differential sequence show that the autocorrelation coefficient and partial auto-correlation coefficient basically fluctuate around zero. As for the tailing characteristics, the preliminary model is ARIMA (1, 2, 1).


### 3.5.5. Parameter Estimation

The model is parameterized when the order of the model has been established. That is, combined with the previous analysis, the unknown parameter values in the model are estimated, and the model is evaluated whether it is reasonable. The least squares estimation method is used here to estimate the parameters of the model.Principle: the least squares estimate is the collection of parameter values that minimizes the sum of squares of the residuals.(12)Qβ^=minQβ=min∑i=1nxt−φ1xt−1−L−φpxt−p−θ1εt−1−L−θqεt−q2.Assumptions:xt=0,t>0Residual sum of squares equation:(13)Qβ=∑i=1nεi2=∑i=1nxt−∑i=1tπixt−12.Applying the least squares estimation method to the information of each observation of the series, thep value of the significance test is less than the significance level α = 0.05, that is, the parameter estimation of the model passes the significance test.


### 3.5.6. Model Testing

After passing the above analysis, to verify whether the model is correct, a test of the residual sequence is required.Also, according to the residual test, the significancep value of the LB statistic of the residual series of Bitcoin and gold is above 0.5, and the null hypothesis cannot be rejected, that is, the residual sequence can be regarded as having successfully passed the white noise test and being a white noise sequence, demonstrating that the model’s ability to fit the data well and that the modeling process was effective.


### 3.5.7. Model Prediction

By using the above steps, it can be proved that the model passes the stationary test, the pure random test, the parametric test, and the residual test, and that the residual sequence of the model approximates the normal distribution, so you can use this model to make predictions. Using this model, the price forecast for Bitcoin and gold in the coming week is shown in Figures7 and 8.Figure 7
Forecast graph of the Bitcoin ARIMA (1, 2, and 3) model for the coming week.Figure 8
Forecast chart for the coming week of the gold ARIMA (1, 2, and 1) model.According to the following figures, the blue line is the predicted trend for the coming week, and it can be seen from the above chart that both Bitcoin and gold have a slight upward trend in the coming week at a confidence level of 99.5%.


## 3.5.1. Timing Plot Testing

Before performing a time series analysis, the existing data is first converted into a time series format (ts), and then a time series plot is drawn to see if the sequence is stable. A stationary time series always oscillates or fluctuates randomly around a constant value and does not easily change with time, while a nonstationary time series has a clear trend, periodicity, or seasonality. To describe the price stability of gold and Bitcoin over the five-year trading period from September 11, 2016, to September 10, 2021, the stability of gold and Bitcoin was tested using R software, and a timing diagram of the two was drawn (where red represents gold and blue represents bitcoin), as shown in Figure5.Figure 5
Time series chart of the five-year trading period between gold and Bitcoin.As can be seen, the price difference between gold and Bitcoin between September 11, 2016, and September 10, 2021, is very large, and Bitcoin began to rise sharply after 2020, growing faster. Because the price difference between gold and Bitcoin is too large, it is impossible to judge the stability of gold based on Figure5. It can be seen that between the five-year trading periods, the price of gold also has a clear upward trend. In summary, it can be seen from the trend of these data that the original data is a nonstationary series and has strong nonstationarity.


## 3.5.2. Logarithmic Transformations and Differences

According to the above conclusions, the original data is a nonstationary series, and the changing trend is large. Since building the ARIMA model requires the sequence to be stationary, here we need to perform differential operations on it. First, as can be seen from Figure6, the variances of gold and Bitcoin are unstable, and here they are logarithmically transformed to smooth out the variances of the sequence. Then it is differentially processed, that is, the difference between adjacent observations is calculated, some of the various characteristics of the sequence are removed, the trend of the sequence is reduced, and the nonstationary sequence becomes a stationary sequence. Wherein, the first-order differential operation principle is as follows:(9)∇xi=xi−xi−1.Figure 6
Time series plot after log smoothing and the second-order difference between gold and Bitcoin.It can be observed from Figure6 that after the second-order difference, the timing plot of both is presented in a range of fluctuations, that is, the stationary sequence data comes after the second-order difference, that is, the sequence after the second-order difference is stationary, so the differential order of the ARIMA model is d = 2. This is how the ARIMA model can be built.


## 3.5.3. Pure Randomness Test

After obtaining the stationary sequence, to judge whether the sequence has analytical and research value, it is necessary to perform a pure randomness test for the sequence, that is, a white noise test. If the result is a white noise sequence, it means that there is no statistical law to follow in the fluctuations of the sequence, so the analysis of the sequence can be stopped, and if the nonwhite noise sequence is obtained, the model fit can continue.The hypothetical conditions of a pure randomness test can be expressed in mathematical terms:(10)H0:ρ1=ρ2=…=ρm=0,H1:thereisatleastonenotequalto0.The test statistic is(11)LB=nn+2∑k=1mρk2n−k∼x2m.If you can reject the null hypothesis and think that the sequence is a nonwhite noise sequence, you can do model fitting;LB>xα2m.If so, the sequence is regarded as white noise, and the study of it can be ended. Otherwise, the null hypothesis cannot be rejected.LB<xα2m.The results of the white noise test on the sequence following the second-order difference are displayed in Table2.Table 2
Results of a white noise test for two sequences after second-order differential.
Box-Ljung testdata: bic_diff2data: gold_diff2X-squared = 1018.5df = 6p value < 2.2e − 16X-squared = 669.53df = 6p value < 2.2e − 16data: bic_diff2data: gold_diff2X-squared = 1033.4df = 12p value < 2.2e − 16X-squared = 690.51df = 12p value < 2.2e − 16Table 2 shows the white noise test results of the 6th and 12th order differences between two sets of data of gold and bitcoin.According to the white noise test in Table2, both the p values of the LB statistic for the 6th order delay of the gold and Bitcoin sequences are less than 2.2 × 10−16, that is, less than the significance level of 0.05, so the original hypothesis that the sequence is significantly rejected as a purely random sequence is considered a nonwhite noise sequence and the model fit can be performed.


## 3.5.4. Model Ordering

In the case that the sequence is a stationary nonwhite noise sequence, the auto-correlation and partial auto-correlation plots of Bitcoin and gold are plotted, respectively, to determine thep value and q value of the ARIMA (p, d, q) model.The autocorrelation graph of the second-order differential series of Bitcoin shows that the autocorrelation coefficient, after the delay of the 3rd order gradually decays, has a downward trend, and fluctuates within the range of zero values, and the partial autocorrelation plot decays exponentially to zero, that is, it is a tail properties, so a preliminary model can be obtained as ARIMA (1, 2, 3).The autocorrelation diagram and partial autocorrelation diagram of the golden second-order differential sequence show that the autocorrelation coefficient and partial auto-correlation coefficient basically fluctuate around zero. As for the tailing characteristics, the preliminary model is ARIMA (1, 2, 1).


## 3.5.5. Parameter Estimation

The model is parameterized when the order of the model has been established. That is, combined with the previous analysis, the unknown parameter values in the model are estimated, and the model is evaluated whether it is reasonable. The least squares estimation method is used here to estimate the parameters of the model.Principle: the least squares estimate is the collection of parameter values that minimizes the sum of squares of the residuals.(12)Qβ^=minQβ=min∑i=1nxt−φ1xt−1−L−φpxt−p−θ1εt−1−L−θqεt−q2.Assumptions:xt=0,t>0Residual sum of squares equation:(13)Qβ=∑i=1nεi2=∑i=1nxt−∑i=1tπixt−12.Applying the least squares estimation method to the information of each observation of the series, thep value of the significance test is less than the significance level α = 0.05, that is, the parameter estimation of the model passes the significance test.


## 3.5.6. Model Testing

After passing the above analysis, to verify whether the model is correct, a test of the residual sequence is required.Also, according to the residual test, the significancep value of the LB statistic of the residual series of Bitcoin and gold is above 0.5, and the null hypothesis cannot be rejected, that is, the residual sequence can be regarded as having successfully passed the white noise test and being a white noise sequence, demonstrating that the model’s ability to fit the data well and that the modeling process was effective.


## 3.5.7. Model Prediction

By using the above steps, it can be proved that the model passes the stationary test, the pure random test, the parametric test, and the residual test, and that the residual sequence of the model approximates the normal distribution, so you can use this model to make predictions. Using this model, the price forecast for Bitcoin and gold in the coming week is shown in Figures7 and 8.Figure 7
Forecast graph of the Bitcoin ARIMA (1, 2, and 3) model for the coming week.Figure 8
Forecast chart for the coming week of the gold ARIMA (1, 2, and 1) model.According to the following figures, the blue line is the predicted trend for the coming week, and it can be seen from the above chart that both Bitcoin and gold have a slight upward trend in the coming week at a confidence level of 99.5%.


## 3.6. Model III: Combined Predictive Models

The gray prediction model can solve the problems of insufficient data, low sequence integrity, and reliability, and can generate regular new sequences from irregular raw data, but it is only suitable for short- and medium-term predictions and predictions that approximate exponential growth. Time series models may identify the traits, patterns, and development laws of variable changes in time series, allowing them to accurately forecast future changes in variables. However, when significant changes in the external environment take place, huge deviations will result. A single model has certain limitations, which tend to make the error larger, and it is difficult to ensure accurate prediction results. The combined forecasting model combines the gray forecasting model and the time series model, considers them as a whole, and weights the prediction results obtained by each forecasting model. In this way, the advantages of each prediction model can be used to a greater extent, the influence of a single prediction model on various uncertainties can be reduced, and it is possible to increase model prediction accuracy.Suppose the actual observations for the price prediction problem for gold and Bitcoin the next day are vectorsX=x1,x2,…,xn, There are m (m ≥ 2) different prediction methods, and combining the weights in the prediction model in vectors, ω=ω1,ω2,…,ωmT indicates that the predicted value of the j prediction method is, x^1j,x^2j,…,x^nj,j=1,2,…,m, then the combined forecast model’s expected value for the t period is as follows:(14)xt=∑j=1mωjx^tj=ω1x^t1+ω2x^t2+…+ωmx^tm,where, ej is the sum of the squares of errors in the j model, ej=∑t=1nxt−x^tj2Therefore, through the above formula, it can be seen that the weight is calculated from the sum of the error squares of each prediction method and then multiplied by the prediction value of the individual prediction methods, and the prediction results of the combined prediction model can be obtained.


## 3.7. Model IV: Dynamic Programming Models (Mean-Variance Model)

The dynamic programming model was first proposed by Bellman, and the principle of optimality is the core of his theory, which is described as follows:Suppose that the stage variable of a multistage decision process ist = 1, 2, …, T, then the strategy P1,T∗=u1∗,u2∗,…,uT∗ is a sufficient requirement for the best strategy: for any t(1 < t < T), when the initial state is x1, is as follows:(15)V1,Tx1,P1,x∗=minp1,t−1x1V1,t−1x1,P1,t−1+minp1,Tx¯tV1,Tx¯t,P1,t−1,where P1,T=P1,t−1,P1,T, x¯t=Tt−1xt−1,ut−1, xt is the state of the t-stage determined by the given initial state x1 and substrategy P1,t−1.This principle has an essential property that all remaining subdecisions, regardless of previous decisions, must constitute optimal subdecisions.Taking into account the background risk, the equation of state for a multistage portfolio is as follows:(16)xt+1=∑t=1netiuti+xt−utb−∑i=1nutiet0+ubetb=xtet0+Pt′ut+etb−et0ub,where Pt=et1−et0,et2−et0,…,etn−et0,ut=ut1,ut2,…,utn,t = 0, 1, 2, …, T-1In the multistage mean-variance model problem, investors seek a feasible optimal investment strategiesut, so that at a given level of risk, the investor’s expectation of ending wealth xT reaches a maximum ExT, or at a given expected level of termination wealth, the variance VarxT of the investor termination wealth xT is minimized.When the investor’s risk level is given, that is, the varianceVarxT=σ2 of the given investor’s termination wealth xT, the multistage mean-variance model considering the background risk is as follows:(17)xn=C1PnBn+C2QnGn+Cn,max′fxn=C1φPnPm+C2xn−φQnQm.According to Formula (17), the pseudo-code for compiling a dynamic programming model considering risk is shown in Table3 in the appendix.Table 3
Pseudocode of dynamic programming model considering risk.
Algorithm 2: dynamic programming models that consider riskinessInput:Pn,Bn,xOutput:Xn,Qnforx=1 to donIf gold is closedIf the price of Bitcoin fallsSell BitcoinElseIf you have cash, you can buy Bitcoin under the premise of risk controlEndelse, gold does not stop marketingIf today’s total assets are greater than tomorrow’s total assetsfor doj=1toxn−1Calculates the current maximum total asset and retains the maximum valueEndTotal assets under the if optimal scheme have increasedRepurchase assets under the premise of risk controlElseContinue to holdEndElseContinue to holdEndFind out the total assets for todayEndEndWe can know that without risk control, the income in the later period will show an exponential upward trend. After joining the risk control, although the return is reduced, it ensures the safety of our funds.Short-term buy-sell can make a steady income, but such income is very small, through the MACD (moving average convergence divergence) can get a rough trend of the future direction of the market.(18)EMA12=LastdayEMA12∗1113+Priceoftoday∗213,EMA26=LastdayEMA26∗2527+Priceoftoday∗227,DIF=TodayEMA12−TodayEMA26.When both the EMA and the DIF are greater than 0 and the DIF breaks out of the DEA upwards, the system determines that it should buy.With the Sharpe ratio, we can adjust our buying strategy in a timely manner.(19)Sharperatio=ARR−free−riskreturnStandarddeviation.Among them, the average rate of return means the average of the growth rate of the net worth of gold or BitcoinThe risk-rate of return means bank interest rates for the same period. Standard deviation means the variance of the growth rate of the net value of gold or Bitcoin.When the Sharpe ratio of gold is greater than that of Bitcoin, gold is chosen to invest, and if it is not, Bitcoin is chosen to invest. After optimizing it, it is shown in Figure9.Figure 9
Comparison chart of no risk consideration and risk consideration.


## 4. Results and Discussion

### 4.1. Summary of Results

#### 4.1.1. Result of Model 1

According to the construction principle of the above gray forecast model GM (1,1), the daily price prediction model of gold and Bitcoin is established, and its accuracy is verified. Finally, the forecast of the current day is made according to the data of the previous 7 days. The Bitcoin daily forecast result is shown in Figure10, and the gold daily forecast chart is shown in Figure 11, where the red line is the original data and the blue line is the forecast data.Figure 10
Bitcoin daily forecast.Figure 11
Gold daily forecast chart.


#### 4.1.2. Result of Model 2

According to the resulting ARIMA model, after a series of estimates and tests, Figure12 illustrates how this model is applied to forecast the price of Bitcoin and gold for the month following September 10, 2021.Figure 12
Forecast chart for Bitcoin and gold in the month after September 10, 2021.From Figure12, we can clearly see that within one month after September 10, 2021, the price range of Bitcoin is roughly between $26666–$40000, while the price of gold is between $750and $2250. Obviously, this result is basically consistent with that of the gray prediction model GM (1,1), which indicates that our model has a small prediction error and a good prediction effect.


#### 4.1.3. Result of Model 3

Applying the combined forecasting model to the forecasting problems of gold and Bitcoin, the results of the gray forecasting model, and the time series forecasting models are combined to obtain Tables4 and 5.Table 4
Predictions for the price of gold in three models.
DateThe actual price of goldARIMA modelGM (1,1) modelCombined predictive modelsForecast/dollarRelative errorForecast/dollarRelative errorForecast/dollarRelative error2016-09-121323.651288.812.70%1285.083.00%1326.70.23%2016-09-131321.751293.742.17%1280.153.25%1334.780.99%2016-09-141310.801267.363.43%1270.553.17%1322.680.91%2016-09-151308.351280.682.16%1297.830.81%1312.960.35%2016-09-161314.851312.750.16%1310.350.34%1309.32−0.42%……………………2021-09-021823.71780.462.43%1791.121.82%1822.65−0.06%2021-09-031821.61683.318.22%1713.526.31%1932.56.09%2021-09-061802.151745.733.23%1736.343.79%1824.71.25%2021-09-0717861733.123.05%1714.034.20%1813.151.52%2021-09-081788.251788.472.43%1773.790.82%1766−1.24%Table 5
Predictions for the price of Bitcoin in three models.
DateThe actual price of bitcoinARIMA modelGM (1,1) modelCombined predictive modelsForecast/dollarRelative errorForecast/dollarRelative errorForecast/dollarRelative error2016-09-12621.65609.142.05%612.151.55%622.78−0.18%2016-09-13609.67626.27−2.65%616.71−1.14%631.56−3.59%2016-09-14610.92636.52−4.02%629.72−2.99%640.15−4.78%2016-09-15608.82628.55−3.14%625.55−2.67%628.7−3.27%2016-09-16610.38630.99−3.27%625.57−2.43%630.4−3.28%……………………2021-09-0247112.1945628.823.25%44445.076.00%45632.743.14%2021-09-0347056.4146625.870.92%46638.540.90%46987.320.15%2021-09-0645982.5546747.55−1.64%45892.130.20%46993.26−2.20%2021-09-0744648.5744980.86−0.74%44448.250.45%45362.78−1.60%2021-09-0844777.8644172.461.37%43704.762.46%44367.820.92%It can be seen from the table that the average relative error of the joint prediction model is lower than that of the GM (1,1) and ARIMA models, indicating that the joint prediction model has a high prediction accuracy and can better combine the advantages of the two single prediction models to improve their prediction effect.


#### 4.1.4. Result of Model 4

We all know that the optimal goal of investment is to minimize risk and maximize benefits, and it is known that the Sharpe ratio is a standardized indicator for the performance evaluation of investment products, which has a fundamental role in risk assessment.Through the MACD model and the Sharp index, we can gain greater benefits by holding gold and Bitcoin for a long time while reducing the risk of long-term holdings.After the model prediction, evaluation, and test are completed, the final profit of gold and Bitcoin can be obtained to help investors better formulate investment trading strategies, as shown in Figure13.Figure 13
The final profit of gold and Bitcoin.According to Figure13, the profit of gold is lower than that of Bitcoin, so the system will choose to buy more Bitcoin.


### 4.2. Sensitivity Analysis

To determine the sensitivity of our model to differing transaction costs, a series of sensitivity analyses are performed. In the analysis, the transaction cost of gold is taken varied from 0.00005 to 0.0030, while the transaction cost of Bitcoin is taken varied from 0.0001 to 0.0030. The result of the sensitivity analysis is shown in Figure14. It is clear that when transaction costs rise relative to gold, Bitcoin has a more substantial impact on the overall return. That’s because the price of Bitcoin is much higher than gold, and transaction cost can easily affect the decision of Bitcoin. Therefore, Bitcoin is more sensitive to transaction costs than gold.Figure 14
Comparison chart of results after changing commission.The results show that when the transaction cost is changed within a certain range, the maximum wave momentum of the final profit is 4.76%. Therefore, as the transaction cost of gold and Bitcoin changes, the total return does not fluctuate significantly, which indicates that the model is fairly robust to the transaction costs of both gold and Bitcoin.The sensitivity of the test model to face the macroeconomic control: we can flexibly switch our commissions, rather than switching commissions, which leads to the loss of our model.


### 4.3. Strengths and Weaknesses

(i)
ARIMA model can have a better embodiment in the short-term prediction, the prediction accuracy is high, the model can be flexibly selected to fit, and the actual error of prediction is small.(ii)
The model’s outputs are reliable, flexible, and closely related to reality. The modeling of the issues produced in conjunction with reality is more accurate, and the model will not falter as a result of changing data.(iii)
In terms of data processing, the results of the two prediction models are combined to reduce the error of the data and make the prediction more accurate, with an error of only 7.2405% in gold and only 13.7012% in Bitcoin.(iv)
The data entered by the ARIMA model must be univariate series and require the sequence to be stationary, i.e., the mean and variance do not change with time. As the forecast period increases, the prediction error gradually increases.


## 4.1. Summary of Results

### 4.1.1. Result of Model 1

According to the construction principle of the above gray forecast model GM (1,1), the daily price prediction model of gold and Bitcoin is established, and its accuracy is verified. Finally, the forecast of the current day is made according to the data of the previous 7 days. The Bitcoin daily forecast result is shown in Figure10, and the gold daily forecast chart is shown in Figure 11, where the red line is the original data and the blue line is the forecast data.Figure 10
Bitcoin daily forecast.Figure 11
Gold daily forecast chart.


### 4.1.2. Result of Model 2

According to the resulting ARIMA model, after a series of estimates and tests, Figure12 illustrates how this model is applied to forecast the price of Bitcoin and gold for the month following September 10, 2021.Figure 12
Forecast chart for Bitcoin and gold in the month after September 10, 2021.From Figure12, we can clearly see that within one month after September 10, 2021, the price range of Bitcoin is roughly between $26666–$40000, while the price of gold is between $750and $2250. Obviously, this result is basically consistent with that of the gray prediction model GM (1,1), which indicates that our model has a small prediction error and a good prediction effect.


### 4.1.3. Result of Model 3

Applying the combined forecasting model to the forecasting problems of gold and Bitcoin, the results of the gray forecasting model, and the time series forecasting models are combined to obtain Tables4 and 5.Table 4
Predictions for the price of gold in three models.
DateThe actual price of goldARIMA modelGM (1,1) modelCombined predictive modelsForecast/dollarRelative errorForecast/dollarRelative errorForecast/dollarRelative error2016-09-121323.651288.812.70%1285.083.00%1326.70.23%2016-09-131321.751293.742.17%1280.153.25%1334.780.99%2016-09-141310.801267.363.43%1270.553.17%1322.680.91%2016-09-151308.351280.682.16%1297.830.81%1312.960.35%2016-09-161314.851312.750.16%1310.350.34%1309.32−0.42%……………………2021-09-021823.71780.462.43%1791.121.82%1822.65−0.06%2021-09-031821.61683.318.22%1713.526.31%1932.56.09%2021-09-061802.151745.733.23%1736.343.79%1824.71.25%2021-09-0717861733.123.05%1714.034.20%1813.151.52%2021-09-081788.251788.472.43%1773.790.82%1766−1.24%Table 5
Predictions for the price of Bitcoin in three models.
DateThe actual price of bitcoinARIMA modelGM (1,1) modelCombined predictive modelsForecast/dollarRelative errorForecast/dollarRelative errorForecast/dollarRelative error2016-09-12621.65609.142.05%612.151.55%622.78−0.18%2016-09-13609.67626.27−2.65%616.71−1.14%631.56−3.59%2016-09-14610.92636.52−4.02%629.72−2.99%640.15−4.78%2016-09-15608.82628.55−3.14%625.55−2.67%628.7−3.27%2016-09-16610.38630.99−3.27%625.57−2.43%630.4−3.28%……………………2021-09-0247112.1945628.823.25%44445.076.00%45632.743.14%2021-09-0347056.4146625.870.92%46638.540.90%46987.320.15%2021-09-0645982.5546747.55−1.64%45892.130.20%46993.26−2.20%2021-09-0744648.5744980.86−0.74%44448.250.45%45362.78−1.60%2021-09-0844777.8644172.461.37%43704.762.46%44367.820.92%It can be seen from the table that the average relative error of the joint prediction model is lower than that of the GM (1,1) and ARIMA models, indicating that the joint prediction model has a high prediction accuracy and can better combine the advantages of the two single prediction models to improve their prediction effect.


### 4.1.4. Result of Model 4

We all know that the optimal goal of investment is to minimize risk and maximize benefits, and it is known that the Sharpe ratio is a standardized indicator for the performance evaluation of investment products, which has a fundamental role in risk assessment.Through the MACD model and the Sharp index, we can gain greater benefits by holding gold and Bitcoin for a long time while reducing the risk of long-term holdings.After the model prediction, evaluation, and test are completed, the final profit of gold and Bitcoin can be obtained to help investors better formulate investment trading strategies, as shown in Figure13.Figure 13
The final profit of gold and Bitcoin.According to Figure13, the profit of gold is lower than that of Bitcoin, so the system will choose to buy more Bitcoin.


## 4.1.1. Result of Model 1

According to the construction principle of the above gray forecast model GM (1,1), the daily price prediction model of gold and Bitcoin is established, and its accuracy is verified. Finally, the forecast of the current day is made according to the data of the previous 7 days. The Bitcoin daily forecast result is shown in Figure10, and the gold daily forecast chart is shown in Figure 11, where the red line is the original data and the blue line is the forecast data.Figure 10
Bitcoin daily forecast.Figure 11
Gold daily forecast chart.


## 4.1.2. Result of Model 2

According to the resulting ARIMA model, after a series of estimates and tests, Figure12 illustrates how this model is applied to forecast the price of Bitcoin and gold for the month following September 10, 2021.Figure 12
Forecast chart for Bitcoin and gold in the month after September 10, 2021.From Figure12, we can clearly see that within one month after September 10, 2021, the price range of Bitcoin is roughly between $26666–$40000, while the price of gold is between $750and $2250. Obviously, this result is basically consistent with that of the gray prediction model GM (1,1), which indicates that our model has a small prediction error and a good prediction effect.


## 4.1.3. Result of Model 3

Applying the combined forecasting model to the forecasting problems of gold and Bitcoin, the results of the gray forecasting model, and the time series forecasting models are combined to obtain Tables4 and 5.Table 4
Predictions for the price of gold in three models.
DateThe actual price of goldARIMA modelGM (1,1) modelCombined predictive modelsForecast/dollarRelative errorForecast/dollarRelative errorForecast/dollarRelative error2016-09-121323.651288.812.70%1285.083.00%1326.70.23%2016-09-131321.751293.742.17%1280.153.25%1334.780.99%2016-09-141310.801267.363.43%1270.553.17%1322.680.91%2016-09-151308.351280.682.16%1297.830.81%1312.960.35%2016-09-161314.851312.750.16%1310.350.34%1309.32−0.42%……………………2021-09-021823.71780.462.43%1791.121.82%1822.65−0.06%2021-09-031821.61683.318.22%1713.526.31%1932.56.09%2021-09-061802.151745.733.23%1736.343.79%1824.71.25%2021-09-0717861733.123.05%1714.034.20%1813.151.52%2021-09-081788.251788.472.43%1773.790.82%1766−1.24%Table 5
Predictions for the price of Bitcoin in three models.
DateThe actual price of bitcoinARIMA modelGM (1,1) modelCombined predictive modelsForecast/dollarRelative errorForecast/dollarRelative errorForecast/dollarRelative error2016-09-12621.65609.142.05%612.151.55%622.78−0.18%2016-09-13609.67626.27−2.65%616.71−1.14%631.56−3.59%2016-09-14610.92636.52−4.02%629.72−2.99%640.15−4.78%2016-09-15608.82628.55−3.14%625.55−2.67%628.7−3.27%2016-09-16610.38630.99−3.27%625.57−2.43%630.4−3.28%……………………2021-09-0247112.1945628.823.25%44445.076.00%45632.743.14%2021-09-0347056.4146625.870.92%46638.540.90%46987.320.15%2021-09-0645982.5546747.55−1.64%45892.130.20%46993.26−2.20%2021-09-0744648.5744980.86−0.74%44448.250.45%45362.78−1.60%2021-09-0844777.8644172.461.37%43704.762.46%44367.820.92%It can be seen from the table that the average relative error of the joint prediction model is lower than that of the GM (1,1) and ARIMA models, indicating that the joint prediction model has a high prediction accuracy and can better combine the advantages of the two single prediction models to improve their prediction effect.


## 4.1.4. Result of Model 4

We all know that the optimal goal of investment is to minimize risk and maximize benefits, and it is known that the Sharpe ratio is a standardized indicator for the performance evaluation of investment products, which has a fundamental role in risk assessment.Through the MACD model and the Sharp index, we can gain greater benefits by holding gold and Bitcoin for a long time while reducing the risk of long-term holdings.After the model prediction, evaluation, and test are completed, the final profit of gold and Bitcoin can be obtained to help investors better formulate investment trading strategies, as shown in Figure13.Figure 13
The final profit of gold and Bitcoin.According to Figure13, the profit of gold is lower than that of Bitcoin, so the system will choose to buy more Bitcoin.


## 4.2. Sensitivity Analysis

To determine the sensitivity of our model to differing transaction costs, a series of sensitivity analyses are performed. In the analysis, the transaction cost of gold is taken varied from 0.00005 to 0.0030, while the transaction cost of Bitcoin is taken varied from 0.0001 to 0.0030. The result of the sensitivity analysis is shown in Figure14. It is clear that when transaction costs rise relative to gold, Bitcoin has a more substantial impact on the overall return. That’s because the price of Bitcoin is much higher than gold, and transaction cost can easily affect the decision of Bitcoin. Therefore, Bitcoin is more sensitive to transaction costs than gold.Figure 14
Comparison chart of results after changing commission.The results show that when the transaction cost is changed within a certain range, the maximum wave momentum of the final profit is 4.76%. Therefore, as the transaction cost of gold and Bitcoin changes, the total return does not fluctuate significantly, which indicates that the model is fairly robust to the transaction costs of both gold and Bitcoin.The sensitivity of the test model to face the macroeconomic control: we can flexibly switch our commissions, rather than switching commissions, which leads to the loss of our model.


## 4.3. Strengths and Weaknesses

(i)
ARIMA model can have a better embodiment in the short-term prediction, the prediction accuracy is high, the model can be flexibly selected to fit, and the actual error of prediction is small.(ii)
The model’s outputs are reliable, flexible, and closely related to reality. The modeling of the issues produced in conjunction with reality is more accurate, and the model will not falter as a result of changing data.(iii)
In terms of data processing, the results of the two prediction models are combined to reduce the error of the data and make the prediction more accurate, with an error of only 7.2405% in gold and only 13.7012% in Bitcoin.(iv)
The data entered by the ARIMA model must be univariate series and require the sequence to be stationary, i.e., the mean and variance do not change with time. As the forecast period increases, the prediction error gradually increases.


## 5. Conclusions

As we know, it is difficult to get a good prediction effect by using a single prediction model because of its shortcomings. Based on the gray GM (1,1) model and time series ARIMA model, this paper combines the two single forecasting models by a weighted combination and selects the daily closing price data of yellow gold and Bitcoin from 2016 to 2021 as the research object to make a short-term forecast of the daily price of gold and Bitcoin. The outcomes demonstrate that the combined model has higher prediction accuracy and stability than the two individual prediction models. Therefore, this combination forecast is effective and feasible for the daily price forecast of gold and Bitcoin.Then, based on the predicted data, this treatise founds a multiobjective dynamic programming model (mean-variance model). We divide the trading data into multiple stages and establish the corresponding state variables and equations. In the mean-variance model, we strive to minimize the risk and maximize the return. According to the established multistage mean-variance model, we can calculate the maximum daily income and consider whether to buy or sell. Finally, by solving the model and analyzing the sensitivity and robustness of the model, the maximum total capital available every day is successfully deduced. It can be accurately predicted that on September 10, 2021, the original investment value of $1,000 will be $68,093.9659.To sum up, the combined forecasting model proposed in this paper is relatively stable and accurate in forecasting gold and Bitcoin, two volatile assets. Constructing the mean-variance model can plan the investment of assets well, and make the best investment trading strategy. Undoubtedly, facing the uncertainty of the futures market, this research will help the government and practitioners to standardize the market more reasonably, formulate the corresponding futures market management system, avoid the excessive fluctuation of the market transaction volume, guarantee the market liquidity, and make the market operate reasonably. At the same time, it is also beneficial for investors to evaluate the asset price accurately for better investment and risk avoidance. However, it should be noted that there are some limitations in this paper. Firstly, in the aspect of forecasting price data, this paper not only considers the advantages and disadvantages of a single forecasting model but also fails to consider various external factors that affect the data. Future research can integrate these factors to further improve the accuracy of the model prediction results. Secondly, in establishing the multistage mean-variance model, this paper only considers a certain risk level of a given investor, while ignoring the risk impact caused by qualitative factors such as monetary policy and government decisions at that time. How quantifying and comprehensively considering these qualitative factors is an important direction for future research in the model. In short, with continuous optimization and improvement in the future, the asset forecasting and investment planning processes can both benefit from the methodologies presented in this study.



---

*Source: 1552074-2023-02-16.xml*