Profit from Volatility Based on Investment Strategy Model

. The investment market is rapidly changing and asset prices may vary greatly in a relatively short period of time due to their instability. We analyze the variation characteristics of gold and bitcoin prices. Obviously, the gold price movements are significantly more stable than bitcoin, so we consider using a long- term low-frequency trading strategy with wavelet transform for gold and a short-term high- frequency trading strategy for bitcoin. Based on these indicators, a multilayer perceptual (MLP) neural network was used to develop price prediction models for each of the two assets. These models achieve accurate forecasting of future prices based on historical data, and the models’ test error levels are both about 2%.


Introduction
As a traditional safe-haven asset that has been in the public domain for a long time, gold has always maintained a relatively stable position in the financial market. Bitcoin is the first distributed anonymous digital currency in the world, which was officially launched in 2008. Bitcoin has gained popularity among speculators and investors because of its sizable returns and high volatility (Baek and Elbeck, 2015) [1] , also known as digital gold.
Based on unrounded data, the average daily gold production for U.S. mines was about 483 kg in June (USGS, 2021) [2] . As of February 2021, Coin Market Cap data shows that the market value of Bitcoin has exceeded one trillion US dollars [3] . The inclusion of Bitcoin and gold into the investment portfolio is certainly in line with the trend of our times and has strong universal significance. To maximize its value and formulate corresponding trading strategies, it has good practicability for traders.

Data Processing
Gold is one of the most important risk management tools. If you want to use it for risk aversion, you need to fully understand the changing laws of its volatility which help you be able to make the best investment strategy. Wavelet transform is a signal processing tool that can effectively reduce noise and detect mutation points [4] . Since wavelet transform helps to obtain a higher rate of return in long-term low-frequency transactions, this paper uses wavelet transform to process gold daily prices to explore the changing characteristics of gold volatility better. We establish a soft and hard threshold wavelet model which is 5-layer and based on the sym8 wavelet basis to achieve one-dimensional data wavelet threshold noise reduction. The corresponding threshold formula is: represents the detail coefficient of the layer i decomposition. N represents the data length. In order to better reflect the characteristics of price data, this paper refers to the technical indicators of the stock market to calculate the increase(change) of gold daily prices and bitcoin daily prices,5day mean value(MA5), 10-day mean value(MA10), 20-day mean value(MA20), moving average convergence and divergence(MACD), BOLL(including upper band and lower band) [5] . These indicators will serve as the main input variables for the following model building.

Important Metric Filtering
To keep the prediction model concise, efficient and accurate, it is necessary to screen the technical indicators and select the more important indicators as the input variables of the prediction model. It is generally considered that the data with a strong correlation with the prediction data is more important.
Spearman correlation [6] coefficient is the nonparametric indicator used to measure the dependence of two variables. It uses a monotonic equation to evaluate the correlation of two statistical variables, often denoted by ρ. The formula is shown as follows: Through calculation, it is found that the multi-day average prices of gold and bitcoin and the upper and lower limits of BOLL are highly positively correlated with their prices. To find out the suitable indicators for prediction, we use the data in the t-1 period to infer the price in the t+k period, that is, the technical indicators on the t-1 period as the explanatory variable, and the price after the k day as the explained variable.
Considering the nonlinear correlation of the data, the least square regression tree is selected for prediction evaluation, and the feature importance function in the sklearn tool library is used to obtain the importance weights of each indicator at different tree depths. In this way, we can obtain technical indicators with higher importance for the next bitcoin and gold price predictions.
A decision tree is a tree-like structure composed of nodes and directed edges, including two types of nodes: internal nodes and leaf nodes, which are used to represent features and categories. When a decision tree performs a classification or regression task, the samples are recursively tested and allocated. So that the samples start from the root node to test a certain feature layer by layer, and finally match the leaf node (category) it belongs according to the result.
In particular, in the recursive process of the binary decision tree, each region is divided into two sub-regions which determine their output values, and solve the formula shown as follows to select the optimal segmentation variable j and cutpoint s. (3) We traverse the variable j and scan the fixed segmentation variable j for cutpoint s to select the pair (j, s) that makes the formula reach the minimum value. Then, we use the selected pair (j, s) to divide the region and determine the corresponding output value. The formula is shown as follows: We continue calling the above steps for the two sub-regions until the stopping condition is met. Then, we divide the input control into regions 1 , 2 , ⋯ , and generate a decision tree. The formula is shown as follows:

Price Prediction Model Based on MLP
Considering that the neural network has a strong ability to describe nonlinear relationships, we use the obtained high-importance technical indicators to establish a multi-layer perceptron (MLP) [7] neural network model to predict bitcoin and gold prices. By training the neural network model, we can use the day t-1 indicator data to predict the price of day t+k on day t, to determine our respective trading directions for bitcoin and gold on day t (current day).
The MLP neural network structure has the feature that each neuron contains an activation function, and the structure also can contain one or more hidden layers [8] . The hidden layers are connected to each other and the joint strength is determined by the weight levels between the neurons. In order to solve the problem that the learning process of the hidden layer is relatively difficult, we use the back propagation algorithm during training to calculate the weight value adjustment of the neurons in the hidden layer. The formula is shown as follows: ∆ ( ) represents weight value adjustment. Parameter represents learning rate.
( ) represents local gradient. ( ) represents the input of neuron .
For the selection of activation functions, MLP neural network generally uses nonlinear and differentiable functions. We choose two kinds of activation functions: logistic function and ReLU function. As for Logistic function, this kind of sigmoid function, generally expression is shown as follows: ( ) represents local induced fields of neurons. The range of values of Logistic function is 0 ≤ ( ( )) ≤ 1. ReLU function is a kind of common activation function, its expression is shown as follows: ( ) = max(0, ) After comparing the performance of the two activation functions on MLP, we find that the logistic activation function has a larger amount of computation and it is more prone to the problem of gradients disappearance. The ReLU activation function can show the more complex relationship between the input variable and the output variable. Finally, we choose the ReLU function as the activation function of our MLP neural network.
Meanwhile, for the neural network, choosing the appropriate number of hidden layers and neurons greatly affects its performance. We calculate the number of hidden layers of our MLP neural network by the following formulas: To determine the number of neurons in the hidden layers, there is the following formula: ℎ = ( * ( + 0 )) (11) represents the number of neurons in the input layers. 0 represents the number of neurons in the output layers.
represents the number of samples in the training alpha represents arbitrary value. Usually, the range is two to ten.
Accordingly, the gold price prediction model we finally designed is an MLP neural network with 3 input variables, 2 hidden layers (20, 10), and 1 output variable; the bitcoin price prediction model is an MLP neural network that has 3 input variables and 2 hidden layers (25, 20) and 1 output variable.  Using the small-batch stochastic gradient descent method to estimate the parameters, and realizes the price prediction of day t+k in day t-1. The neural network is trained with 70% random data.
It can be seen from the above results that the training results of the MLP neural network are good. When the number of iterations reaches 20, the squared loss values of the bitcoin and gold price prediction models decrease by 98.6% and 99.5% respectively, and the test errors are only 0.02 and 0.01.
In actual investment decision-making, the understanding of data and information continues to evolve over time. At the beginning (September 11, 2016, September 12, 2016), we did not have any data, so it is impossible to make the prediction. We need to keep holding the initial $1000 and collect more data. Therefore, we need to understand how much data is required at least to train a better model to participate in prediction. This can help decision-makers enter the market early to invest. We train the model by adding 10-day data information each time according to the chronological order and observe its changes. With the continuous increase of training samples over time, it can be found that when the bitcoin price prediction model only accepts 10-day data information, and the number of its iterations reaches a certain level, it can also achieve the 0.02 test error. The gold price prediction model can only achieve the 0.02 test error after we have 50-day trading data, so it is possible to start making bitcoin trading decisions after 12 days and make gold trading decisions after 56 days.
Because the input variables of day t-1 are used to predict the real price of day t+k, so as to make a trading judgment in the day t. So we need to use the input variables from the 1st day to the t-k-2 day and the real price from day k+2 to day t-1 as the sample to train the model. The output variable (Y) corresponding to the input variable (X) in day t-1 is the forecast price in day t+k. For example, if you want to train the bitcoin price prediction model with 10-day data samples, it won't start the decision until the 13th day, and the input variables of the 12th day are substituted to predict the price of the 14th day.

Portfolio Strategy Model Based on CRITIC
According to the above analysis results, we start predicting the future price of bitcoin on the 13th day and predict the future price of gold on the 57th trading day. The data before these days are used to train the initial neural network. And we calculate the long-term rate of return (the change of the asset current price compared to the first-period price) and the short-term rate of return (the change of the asset price at the end of the past week compared to the beginning of the past week for each trading day according to the specified data. Generally, one week has 5 trading days for gold and 7 trading days for bitcoin), long-term volatility (since the first period), short-term volatility (in the past week).
Generally speaking, the assets which have a higher rate of return and lower volatility should be allocated more funds. Therefore, this paper chooses to use the CRITIC method to calculate the allocation weight of funds between cash, gold and bitcoin to achieve dynamic changes about the weight of capital allocation. Among them, the indicators of cash are always 0. Since the volatility is negatively related to the weight of capital allocation, it is necessary to make positive treatment firstly. Then, because of the calculation requirement, we perform 0-1 normalization processing on all data.
CRITIC method aimed at objectively solving multi-criteria decision problems, which uses the objective attributes of data itself to scientifically weigh [9] . Compared with the entropy weight method and factor analysis method, the CRITIC method can give better results. The weight calculation process is as follows: Firstly, a raw data matrix is constructed, where n is the number of samples and j is the number of indicators. The formula is shown as follows: Then, the variability of indicators is shown by standard deviation. The formula is shown as follows: represents standard deviation. The larger the standard deviation, the greater the numerical difference of the indicator, the more information it can reflect, and the stronger the evaluation strength of the indicator itself, which means the indicator will be assigned more weights.
To further calculate the indicator conflict by the following formulas: ′ represents the correlation coefficient between and ′ . The stronger the correlation coefficient is, the smaller the conflict between this indicator and other indicators, the higher the similarity between indicators, the more homogeneity of the evaluated content. The evaluation strength of the indicator is weakened and assigned less weight correspondingly.
Finally, the required weight is obtained on the basis of calculating the amount of information. The formula is shown as follows: