ArticlePDF Available

An Empirical Study of Machine Learning Algorithms for Stock Daily Trading Strategy

Authors:

Abstract and Figures

According to the forecast of stock price trends, investors trade stocks. In recent years, many researchers focus on adopting machine learning (ML) algorithms to predict stock price trends. However, their studies were carried out on small stock datasets with limited features, short backtesting period, and no consideration of transaction cost. And their experimental results lack statistical significance test. In this paper, on large-scale stock datasets, we synthetically evaluate various ML algorithms and observe the daily trading performance of stocks under transaction cost and no transaction cost. Particularly, we use two large datasets of 424 S&P 500 index component stocks (SPICS) and 185 CSI 300 index component stocks (CSICS) from 2010 to 2017 and compare six traditional ML algorithms and six advanced deep neural network (DNN) models on these two datasets, respectively. The experimental results demonstrate that traditional ML algorithms have a better performance in most of the directional evaluation indicators. Unexpectedly, the performance of some traditional ML algorithms is not much worse than that of the best DNN models without considering the transaction cost. Moreover, the trading performance of all ML algorithms is sensitive to the changes of transaction cost. Compared with the traditional ML algorithms, DNN models have better performance considering transaction cost. Meanwhile, the impact of transparent transaction cost and implicit transaction cost on trading performance are different. Our conclusions are significant to choose the best algorithm for stock trading in different markets.
This content is subject to copyright. Terms and conditions apply.
Research Article
An Empirical Study of Machine Learning Algorithms for
Stock Daily Trading Strategy
Dongdong Lv ,1Shuhan Yuan,2Meizi Li,1,3 and Yang Xiang 1
1College of Electronics and Information Engineering, Tongji University, Shanghai 201804, China
2University of Arkansas, Fayetteville, AR 72701, USA
3College of Information, Mechanical and Electrical Engineering, Shanghai Normal University, Shanghai 200234, China
Correspondence should be addressed to Yang Xiang; shxiangyang@tongji.edu.cn
Received 17 October 2018; Revised 3 March 2019; Accepted 19 March 2019; Published 14 April 2019
Academic Editor: Kemal Polat
Copyright ©  Dongdong Lv et al. is is an open access article distributed under the Creative Commons Attribution License,
which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.
According to the forecast of stock price trends, investors trade stocks. In recent years, many researchers focus on adopting machine
learning (ML) algorithms to predict stock price trends. However, their studies were carried out on small stock datasets with
limited features, short backtesting period, and no consideration of transaction cost. And their experimental results lack statistical
signicance test. In this paper, on large-scale stock datasets, we synthetically evaluate various ML algorithms and observe the
daily trading performance of stocks under transaction cost and no transaction cost. Particularly, we use two large datasets of 
S&P  index component stocks (SPICS) and  CSI  index component stocks (CSICS) from  to  and compare
six traditional ML algorithms and six advanced deep neural network (DNN) models on these two datasets, respectively. e
experimental results demonstrate that traditional ML algorithms have a better performance in most of the directional evaluation
indicators. Unexpectedly, the performance of some traditional ML algorithms is not much worse than that of the best DNN models
without considering the transaction cost. Moreover, the trading performance of all ML algorithms is sensitive to the changes of
transaction cost. Compared with the traditional ML algorithms, DNN models have better performance considering transaction
cost. Meanwhile, the impact of transparent transaction cost and implicit transaction cost on trading performance are dierent.Our
conclusions are signicant to choose the best algorithm for stock trading in dierent markets.
1. Introduction
e stock market plays a very important role in modern
economic and social life. Investors want to maintain or
increase the value of their assets by investing in the stock
of the listed company with higher expected earnings. As a
listed company, issuing stocks is an important tool to raise
funds from the public and expand the scale of the industry.
In general, investors make stock investment decisions by
predicting the future direction of stocks’ ups and downs. In
modern nancial market, successful investors are good at
making use of high-quality information to make investment
decisions, and, more importantly, they can make quick and
eective decisions based on th e information they have already
had. erefore, the eld of stock investment attracts the
attention not only of nancial practitioner and ordinary
investors but also of researchers in academic [].
In the past many years, researchers mainly constructed
statistical models to describe the time s eries of stock price and
trading volume to forecast the trends of future stock returns
[–]. It is worth noting that the intelligent computing meth-
ods represented by ML algorithms also present a vigorous
development momentum in stock market prediction with
the development of articial intelligence technology. e
main reasons are as follows. () Multisource heterogeneous
nancial data are easy to obtain, including high-frequency
trading data, rich and diverse technical indicators data,
macroeconomic data, industry policy and regulation data,
market news, and even social network data. () e research
of intelligent algorithms has been deepened. From the early
linear model, support vector machine, and shallow neural
network to DNN models and reinforcement learning algo-
rithms, intelligent computing methods have made signicant
improvement. ey have been eectively applied to the elds
Hindawi
Mathematical Problems in Engineering
Volume 2019, Article ID 7816154, 30 pages
https://doi.org/10.1155/2019/7816154
Mathematical Problems in Engineering
of image recognition and text analysis. In some papers, the
authors think that these advanced algorithms can capture the
dynamic changes of the nancial market, simulate the trading
process of stock, and make automatic investment decisions.
() e rapid development of high-performance computing
hardware, such as Graphics Processing Units (GPUs), large
servers, and other devices, can provide powerful storage
space and computing power for the use of nancial big data.
High-performance computer equipment, accurate and fast
intelligent algorithms, and nancial big data together can
provide decision-making support for programmed and auto-
mated trading of stocks, which has gradually been accepted
by industry practitioners. erefore, the power of nancial
technology is reshaping the nancial market and changing
the format of nance.
Over the years, traditional ML methods have shown
strong ability in trend prediction of stock prices [–].
In recent years, articial intelligence computing methods
represented by DNN have made a series of major break-
throughs in the elds of Natural Language Processing, image
classication, voice translation, and so on. It is noteworthy
that some DNN algorithms have been applied for time series
prediction and quantitative trading [–]. However, most
of the previous studies focused on the prediction of the
stock index of major economies in the world ([, , , ,
,,,,],etc.)orselectingafewstockswith
limited features according to their own preferences ([–, ,
, , , , ], etc.) or not considering transaction cost
([,,,],etc.),ortheperiodofbacktestingisvery
short([,,,,,,,],etc.).Meanwhile,thereis
no statistical signicance test between dierent algorithms
which were used in stock trading ([–, ], etc.). at is, the
comparison and evaluation of the various trading algorithms
lack large-scale stocks datasets, considering transaction cost
and statistical signicance test. erefore, the performance of
backtesting may tend to be overly optimistic. In this regard,
we need to clarify two concerns based on a large-scale stock
dataset: () whether the trading strategies based on the DNN
models can achieve statistically signicant results compared
with the traditional ML algorithms without transaction cost;
() how do transaction costs aect trading performance
of the ML algorithm? ese problems constitute the main
motivation of this research and they are very important
for quantitative investment practitioners and portfolio man-
agers. ese solutions of these problems are of great value for
practitioners to do stock trading.
In this paper, we select  SPICS and  CSICS from
 to  as research objects. e SPICS and CSICS
represent the industry development of the world’s top two
economies and are attractive to investors around the world.
e stock symbols are shown in the “Data Availability”. For
each stock in SPICS and CSICS, we construct  technical
indicators as shown in the “Data Availability”. e label
on the -th trading day is the symbol for the yield of
the +1-th trading day relative to the -th trading day.
at is, if the yield is positive, the label value is set to ,
otherwise . For each stock, we choose  tec hnical indicators
of  trading days before December , , to build
a stock dataset. Aer the dataset of a stock is built, we
choose the walk-forward analysis (WFA) method to train
the ML models step by step. In each step of training, we
use  traditional ML methods which are support vector
machine (SVM), random forest (RF), logistic regression (LR),
na¨
ıve Bayes model (NB), classication and regression tree
(CART), and eXtreme Gradient Boosting algorithm (XGB)
and  DNN models which are widely in the eld of text
analysis and voice translation such as Multilayer Perceptron
(MLP), Deep Belief Network (DBN), Stacked Autoencoders
(SAE), Recurrent Neural Network (RNN), Long Short-Term
Memory (LSTM), and Gated Recurrent Unit (GRU) to
train and forecast the trends of stock price based on the
technical indicators. Finally, we use the directional evaluation
indicators such as accuracy rate (AR), precision rate (PR),
recall rate (RR),F-Score (F), Area Under Curve (AUC), and
the performance evaluation indicators such as winning rate
(WR), annualized return rate (ARR), annualized Sharpe ratio
(ASR), and maximum drawdown (MDD)) to evaluate the
trading performance of these various algorithms or strategies.
From the experiments, we can nd that the traditional ML
algorithms have a better performance than DNN algorithms
in all directional evaluation indicators except for PR in
SPICS; in CSICS, DNN algorithms have a better performance
in AR, PR, and F expert for RR and AUC. () Trading
performance without transaction cost is as follows: the WR
of traditional ML algorithms have a better performance than
those of DNN algorithms in both SPICS and CSICS. e
ARR and ASR of all ML algorithms are signicantly greater
than those of the benchmark index (S&P  index and
CSI  index) and BAH strategy; the MDD of all ML
algorithms are signicantly greater than that of BAH strategy
and are signicantly less than that of the benchmark index.
In all ML algorithms, there are always some traditional ML
algorithms whose trading performance (ARR, ASR, MDD)
can be comparable to the best DNN algorithms. erefore,
DNN algorithms are not always the best choice, and the
performance of some traditional ML algorithms has no
signicant dierence from that of DNN algorithms; even
those traditional ML algorithms can perform well in ARR
and ASR. () Trading performance with transaction cost
is as follows: the trading performance (WR, ARR, ASR,
and MDD) of all machine learning algorithms is decreasing
with the increase of transaction cost as in actual trading
situation. Under the same transaction cost structure, the
performance reductions of DNN algorithms, especially MLP,
DBN, and SAE, are smaller than those of traditional ML
algorithms, which shows that DNN algorithms have stronger
tolerance and risk control ability to the changes of transaction
cost. Moreover, the impact of transparent transaction cost
on SPICS is greater than slippage, while the opposite is
true on CSICS. rough multiple comparative analysis of
the dierent transaction cost structures, the performance of
trading algorithms is signicantly smaller than that without
transaction cost, which shows that trading performance is
sensitive to transaction cost. e contribution of this paper
is that we use nonparametric statistical test methods to
compare dierences in trading performance for dierent
ML algorithms in both cases of transaction cost and no
transaction cost. erefore, it is helpful for us to select the
Mathematical Problems in Engineering
1. Data Acquisition
Data Source
Soware
2. Data Preparation
EX Right/Dividend
Feature Generation
Data Normalization
3. Learning
Algorithm
Machine Learning
Algorithms
Walk-Forward
Training/Prediction
Algorithm Design of
Trading Signals
4. Performance
Calculation
Directional
Evaluation Indicators
Performance
Evaluation Indicators
Back-testing
Algorithms
5. e Experimental
Results
Statistical Testing
Method
Trading Evaluation
without Transaction
Cost
Trading Evaluation
with Transaction Cost
F : e framework for predicting stock price trends based on ML algorithms.
most suitable algorithm from these ML algorithms for stock
trading both in the US stock market and the Chinese A-share
market.
e remainder of this paper is organized as follows:
Section  describes the architecture of this work. Section
gives the parameter settings of these ML models and the
algorithm for generating trading signals based on the ML
models mentioned in this paper. Section  gives the direc-
tional evaluation indicators, performance evaluation indi-
cators, and backtesting algorithms. Section  uses nonpa-
rameter statistical test methods to analyze and evaluate the
performance of these dierent algorithms in the two markets.
Section  gives the analysis of impact of transaction cost
on performance of ML algorithms for trading. Section 
gives some discussions of dierences in trading performance
among dierent algorithms from the perspective of data,
algorithms, transaction cost, and suggestions for algorithmic
trading. Section  provides a comprehensive conclusion and
future research directions.
2. Architecture of the Work
e general framework of predicting the future price trends
of stocks, trading process, and backtesting based on ML
algorithms is shown in Figure . is article is organized
from data acquisition, data preparation, intelligent learning
algorithm, and trading performance evaluation. In this study,
data acquisition is the rst step. Where should we get data
and what soware should we use to get data quickly and
accurately are something that we need to consider. In this
paper, we use R language to do all computational procedures.
Meanwhile, we obtain SPICS and CSICS from Yahoo nance
and Netease Finance, respectively. Secondly, the task of
data preparation includes ex-dividend/rights for the acquired
data, generating a large number of well-recognized technical
indicators as features, and using max-min normalization to
deal with the features, so that the preprocessed data can
be used as the input of ML algorithms []. irdly, the
trading signals of stocks are generated by the ML algorithms.
In this part, we train the DNN models and the traditional
ML algorithms by a WFA method; then the trained ML
models will predict the direction of the stocks in a future
time which is considered as the trading signal. Fourthly, we
give some widely used directional evaluation indicators and
performance evaluation indicators and adopt a backtesting
algorithm for calculating the indicators. Finally, we use the
trading signal to implement the backtesting algorithm of
stock daily trading strategy and then apply statistical test
method to evaluate whether there are statistical signicant
dierences among the performance of these trading algo-
rithms in both cases of transaction cost and no transaction
cost.
3. ML Algorithms
3.1. ML Algorithms and eir Parameter Settings. Given a
training dataset D, the task of ML algorithm is to classify
classlabelscorrectly.Inthispaper,wewillusesixtraditional
ML models (LR, SVM, CART, RF, BN, and XGB) and six
DNN models (MLP, DBN, SAE, RNN, LSTM, and GRU) as
classiers to predict the ups and downs of the stock prices
[]. e main model parameters and training parameters of
these ML learning algorithms are shown in Tables  and .
In Tables  and , features and class labels are set according
to the input format of various ML algorithms in R language.
Matrix (m, n) represents a matrix with mrows and ncolumns;
Array (p,m,n) represents a tensor and each layer of the
tensor is Matrix (m,n) and the height of the tensor is p.c
(h1,h2,h3,...) represents a vector, where the length of the
vector is the number of hidden layers and the -th element
of cis the number of neurons of the -th hidden layer. In
the experiment, =  represents that we use the data of
the past  trading days as training samples in each round
of WFA; =  represents that the data of each day has 
features. In Table , the parameters of DNN models such as
activation function, learning rate, batch size, and epoch are
all default values in the algorithms of R programs.
3.2. WFA Method. WFA [] isa rolling training method. We
use the latest data instead of all past data to train the model
Mathematical Problems in Engineering
T : Main parameter settings of traditional ML algorithms.
Input Features Label Main parameters
LR Matrix(,) Matrix(,) A specication for the model link function is logit.
SVM Matrix(,) Matrix(,) e kernel function used is Radial Basis kernel; Cost of constraints violation is .
CART Matrix(,) Matrix(,) e maximum depth of any node of the nal tree is ; e splitting index can be Gini coecient.
RF Matrix(,) Matrix(,) e Number of trees is ; Number of variables randomly sampled as candidates at each split is .
BN Matrix(,) Matrix(,) the prior probabilities of class membership is the class proportions for the training set.
XGB Matrix(,) Matrix(,) e maximum depth of a tree is ; the max number of iterations is ; the learning rate is ..
T : Main parameter settings of DNN algorithms.
Input Features Label Learning rate Dimensions of hidden layers Activation function Batch size Epoch
MLP Matrix(,) Matrix(,) . c(,,,) sigmoid 
DBN Matrix(,) Matrix(,) . c(,,,) sigmoid 
SAE Matrix(,) Matrix(,) . c(,,) sigmoid 
RNN Array(,,) Array(,,) . c(,) sigmoid
LSTM Array(,,) Array(,,) . c(,) sigmoid
GRU Array(,,) Array(,,) . c(,) sigmoid
and then apply the trained model to implement the prediction
for the out-of-sample data (testing dataset) of the future time
period. Aer that, a new training set, which is the previous
training set walk one step forward, is carried out the training
of the next round. WFA can improve the robustness and the
condence of the trading strategy in real-time trading.
In this paper, we use ML algorithms and the WFA method
to do stock price trend predictions as trading signals. In each
step,weusethedatafromthepastdays(oneyear)asthe
training set and the data for the next  days (one week) as
the test set. Each stock contains data of , trading days,
so it takes (-)/ =  training sessions to produce a
total of , predictions which are the trading signals of daily
trading strategy. e WFA method is as shown in Figure .
3.3. e Algorithm Design of Trading Signal. In this part, we
use ML algorithms as classiers to predict the ups and downs
of the stock in SPICS and CSICS and then use the prediction
resultsastradingsignalsofdailytrading.WeusetheWFA
method to train each ML algorithm. We give the generating
algorithm of trading signals according to Figure , which is
shown in Algorithm .
4. Evaluation Indicators and
Backtesting Algorithm
4.1. Directional Evaluation Indicators. In this paper, we use
ML algorithms to predict the direction of stock price, so
the main task of the ML algorithms is to classify returns.
erefore, it is necessary for us to use directional evaluation
indicators to evaluate the classication ability of these algo-
rithms.
e actual label values of the dataset are sequences of
sets {DOWN,UP}. erefore, there are four categories of
predicted label values and actual label values, which are
expressed as TU, FU, FD, and TD. TU denotes the number of
UP that the actual label values are UP and the predicted label
T : Confusion matrix of two classication results of ML
algorithm.
Predicted label values
UP DOWN
Actual label values UP TU FD
DOWN FU TD
values are also UP; FU denotes the number of UP that the
actual label values are DOWN but the predicted label values
are UP; TD denotes the number of DOWN that the actual
label values are DOWN and the predicted label values are
DOWN; FD denotes the number of DOWN that the actual
label values are UP but the predicted label values are DOWN,
as shown in Table . Table  is a two-dimensional table called
confusion matrix. It classies predicted label values according
to whether predicted label values match real label values. e
rst dimension of the table represents all possible predicted
label values and the second dimension represents all real label
values. When predicted label values equal real label values,
they are correct classications. e correct prediction label
values lie on the diagonal line of the confusion matrix. In
this paper, what we are concerned about is that when the
direction of stock price is predicted to be UP tomorrow, we
buy the stock at today’s closing price and sell it at tomorrow’s
closing price; when we predict the direction of stock price to
beDOWNtomorrow,wedonothing.SoUPisa“positive
label of our concern.
In most of classication tasks, AR is generally used
to evaluate performance of classiers. AR is the ratio of
the number of correct predictions to the total number of
predictions.atisasfollows.
 = ( + )
(+++
)()
Mathematical Problems in Engineering
ML
Algorithm
44-dim
2000-dim
44-dim
44-dim
44-dim
44-dim
44-dim
44-dim
250-dim
5-dim250-dim
5-dim
250-dim
5-dim
1-dim
1-dim
1-dim
1-dim
5-dim5-dim5-dim
1750-dim
...
...
Concatenate
ML
Algorithm
ML
Algorithm
Raw Input Data
F : e schematic diagram of WFA (training and testing).
Input:StockSymbols
Output:TradingSignals
() N=Length of Stock Symbols
() L=Length of Trading Days
() P=Length of Features
() k= Length of Training Dataset for WFA
() n= Length of Sliding Window for WFA
() for (i in : N) {
() Stock=Stock Symbols[i]
() M=(L-k)/n
() Trading Signal=NULL
() for (j in :M) {
() Dataset= Stock[(k+n(j-)):(k+n+n(j-)), :(P+)]
() Train=Dataset[:k,:(+P)]
() Test= Dataset[(k+):(k+n),:P]
() Model=ML Algorithm(Train)
() Probability=Model(Test)
() if (Probability>=.) {
() Trading Signal=
() }else {
() Trading Signal=
() }
() }
() Trading Signal=c (Trading Signal, Trading Signal)
() }
() return (Trading Signal)
A : Generating trading signal in R language.
Mathematical Problems in Engineering
In this paper, “UP” is the prot source of our trading
strategies. e classication ability of ML algorithm is to eval-
uate whether the algorithms can recognize “UP”. erefore,
it is necessary to use PR and RR to evaluate classication
results. ese two evaluation indicators are initially applied
in the eld of information retrieval to evaluate the relevance
of retrieval results.
PR is a ratio of the number of correctly predicted UP to
all predicted UP. at is as follows.
 = 
( + )()
High PR means that ML algorithms can focus on “UP”
rather than “DOWN”.
RR is the ratio of the number of correctly predicted “UP”
to the number of actually labeled “UP”. at is as follows.
 = 
( + )()
High RR can capture a large number of “UP” and be
eectively identied. In fact, it is very dicult to present an
algorithm with high PR and RR at the same time. erefore,
it is necessary to measure the classication ability of the
ML algorithm by using some evaluation indicators which
combine PR with RR. F-Score is the harmonic average of
PR and AR. F is a more comprehensive evaluation indicator.
at is as follows.
1=2∗∗ 
( + )()
Here,itisassumedthattheweightsofPRandRRareequal
when calculating F, but this assumption is not always correct.
It is feasible to calculate F with dierent weights for PR and
RR, but determining weights is a very dicult challenge.
AUC is the area under ROC (Receiver Operating Charac-
teristic) curve. ROC curve is oen used to check the tradeo
between nding TU and avoiding FU. Its horizontal axis
is FU rate and its vertical axis is TU rate. Each point on
the curve represents the proportion of TU under dierent
FU thresholds []. AUC reects the classication ability of
classier. e larger the value, the better the classication
ability. It is worth noting that two dierent ROC curves may
lead to the same AUC value, so qualitative analysis should be
carried out in combination with the ROC curve when using
AUC value. In this paper, we use R language package “ROCR”
to calculate AUC.
4.2. Performance Evaluation Indicator. Performance evalua-
tion indicator is used for evaluating the protability and risk
control ability of trading algorithms. In this paper, we use
trading signals generated by ML algorithms to conduct the
backtestingandapplytheWR,ARR,ASR,andMDDtodo
the trading performance evaluation []. WR is a measure
of the accuracy of trading signals; ARR is a theoretical rate
of return of a trading strategy; ASR is a risk-adjusted return
which represents return from taking a unit risk [] and the
risk-free return or benchmark is set to  in this paper; MDD
is the largest decline in the price or value of the investment
period, which is an important risk assessment indicator.
4.3. Backtesting Algorithm. Using historical data to imple-
ment trading strategy is called backtesting. In research and
the development phase of trading model, the researchers
usually use a new set of historical data to do backtesting. Fur-
thermore, the backtesting period should be long enough,
because a large number of historical data can ensure that the
trading model can minimize the sampling bias of data. We
can get statistical performance of trading models theoretically
by backtesting. In this paper, we get  trading signals for
each stock. If tomorrow’s trading signal is , we will buy the
stock at today’s closing price and then sell it at tomorrow’s
closing price; otherwise, we will not do stock trading. Finally,
we get AR, PR, RR, F, AUC, WR, ARR, ASR, and MDD by
implementing backtesting algorithm based on these trading
signals.
5. Comparative Analysis of
Different Trading Algorithms
5.1. Nonparametric Statistical Test Method. In this part, we
use the backtesting algorithm(Algorithm ) to calculate the
evaluation indicators of dierent trading algorithms. In order
to test whether there are signicant dierences between
the evaluation indicators of dierent ML algorithms, the
benchmark indexes, and the BAH strategies, it is necessary
to use analysis of variance and multiple comparisons to give
the answers. erefore, we propose the following nine basic
hypotheses for signicance test in which Hja (=,,,,
, , , , ) are the null hypothesis, and the corresponding
alternative assumptions are Hjb (=,,,,,,,,).e
level of signicance is ..
For any evaluation indicator  ∈ {,,, 1,,
,,,}and any trading strategy ∈{,
,,,, ,,, ,,,
,, }, the null hypothesis a is Hja,
alternative hypotheses b is Hjb (=,,,,,,,,
represent AR, PR, RR, F, AUC, WR, ARR, ASR, MDD,
respectively.).
Hja: the evaluation indicator jof all strategies are the
same
Hjb: the evaluation indicator jof all strategies are not
the same
It is worth noting that any evaluation indicator of all
trading algorithm or strategy does not conform to the basic
hypothesis of variance analysis. at is, it violates the assump-
tion that the variances of any two groups of samples are the
same and each group of samples obeys normal distribution.
erefore, it is not appropriate to use t-test in the analysis
of variance, and we should take the nonparametric statistical
test method instead. In this paper, we use the Kruskal-Wallis
rank sum test [] to carry out the analysis of variance. If the
alternative hypothesis is established, we will need to further
applytheNemenyitest[]todothemultiplecomparisons
between trading strategies.
5.2. Comparative Analysis of Performance of Dierent Trading
Strategies in SPICS. Table  shows the average value of
Mathematical Problems in Engineering
Input: TS TS is trading signals of a stock.
Output: AR, PR, RR, F, AUC, WR, ARR, ASR, MDD
() N=length of Stock Code List  SPICS, and  CSICS.
() Bt=Benchmark Index [“Closing Price”]  B is the closing price of benchmark index.
() WR=NULL; ARR=NULL; ASR=NULL; MDD=NULL
() for (i in : N) {
() Stock Data=Stock Code List[i]
() Pt=Stock Data [“Closing Price”]
() Labelt=Stock Data [“Label”]
() BDRRt=(Bt-Bt-1)/ Bt-1 BDRR is the daily return rate of benchmark index.
() DRRt=(P
t-Pt-1)/Pt-1DRR is daily return rate. at is daily return rate of BAH strategy.
() TDRRt=lag (TSt)DRRtTDRR is the daily return through trading.
() Table=Confusion Matrix(TS, Label)
() AR[i]=sum(adj(Table))/sum(Table)
() PR[i]=Table[2,2]/sum(Table[,2])
() RR[i]=Table[2, 2]/sum(Table[2,])
() F=PR[i]RR[i]/(PR[i]+RR[i])
() Pred=prediction (TS, Label)
() AUC[i]=performance (Pred, measure=“auc”)@y.values[[1]]
() WR[i]=sum (TDRR>)/sum(TDRR =)
() ARR[i]=Return.annualized (TDRR) TDRR, BDRR, or DRR can be used.
() ASR[i]=SharpeRatio.annualized (TDRR) TDRR, BDRR, or DRR can be used.
() MDD[i]=maxDrawDown (TDRR) TDRR, BDRR, or DRR can be used.
() AR=c (AR, AR[i])
() PR=c (PR, PR[i])
() RR=c (RR, RR[i])
() F=c (F, F[i])
() AUC=c (AUC, AUC[i])
() WR=c (WR, WR[i])
() ARR=c (ARR, ARR[i])
() ASR=c (ASR, ASR[i])
() MDD=c (MDD, MDD[i])
() }
() Performance=cbind(AR,PR,RR,F,AUC,WR,ARR,ASR,MDD)
() return (Performance)
A : Backtesting algorithm of daily trading strategy in R language.
T : Trading performance of dierent trading strategies in the SPICS. Best performance of all trading strategies is in boldface.
Index BAH MLP DBN SAE RNN LSTM GRU CART NB RF LR SVM XGB
AR . . . . . . . . . . . 0.6600
PR 0.7861 . . . . . . . . . . .
RR . . . . . . . . . . . 0.6767
F . . . . . . . . . . . 0.6751
AUC . . . . . . . . . . . 0.6590
WR . . . . . . . . . 0.5930 . . . .
ARR . . 0.3333 . . . . . . . . . . .
ASR . . . . . . . . . . 1.6768 . . .
MDD 0.1939 . . . . . . . . . . . . .
various trading algorithms in AR, PR, RR, F, AUC, WR,
ARR, ASR, and MDD. We can see that the AR, RR, F, and
AUC of XGB are the greatest in all trading algorithms. e
WR of NB is the greatest in all trading strategies. e ARR
of MLP is the greatest in all trading strategies including the
benchmark index (S&P  index) and BAH strategy. e
ASR of RF is the greatest in all trading strategies. e MDD of
the benchmark index is the smallest in all trading strategies.
It is worth noting that the ARR and ASR of all ML algorithms
are greater than those of BAH strategy and the benchmark
index.
() rough the hypothesis test analysis of Ha and Hb,
we can obtain p value<.e-.
erefore, there are statistically signicant dierences
between the AR of all trading algorithms. erefore, we need
to make multiple comparative analysis further, as shown in
Mathematical Problems in Engineering
T : Multiple comparison analysis between the AR of any two trading algorithms. e p value of the two trading strategies with signicant
dierence is in boldface.
MLP DBN SAE RNN LSTM GRU CART NB RF LR SVM
DBN .
SAE . .
RNN 0.0000 0.0000 0.0000
LSTM 0.0000 0.0000 0.0000 .
GRU 0.0000 0.0000 0.0000 . .
CART 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
NB 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
RF 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0232 0.0000
LR 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 .
SVM 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 . 0.0000 0.0000 0.0000
XGB 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0002 . 0.0000
T : Multiple comparison analysis between the PR of any two trading algorithms. e p value of the two trading strategies with signicant
dierence is in boldface.
MLP DBN SAE RNN LSTM GRU CART NB RF LR SVM
DBN .
SAE . .
RNN 0.0000 0.0000 0.0000
LSTM 0.0000 0.0000 0.0000 0.0034
GRU 0.0000 0.0000 0.0000 0.0000 .
CART 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
NB 0.0000 0.0000 0.0000 . . 0.0000 0.0000
RF 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 . 0.0000
LR 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 . 0.0000 .
SVM 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0008 0.0000 . 0.0000
XGB 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0491 0.0000 .
Table . e number in the table is a p value of any two algo-
rithms of Nemenyi test. When p value<., we think that
the two trading algorithms have a signicant dierence,
otherwise we cannot deny the null assumption that the mean
values of AR of the two algorithms are equal. From Tables
and , we can see that the AR of all DNN models are signif-
icantly lower than those of all traditional ML models. e AR
of MLP, DBN, and SAE are signicantly greater than those of
RNN, LSTM, and GRU. ere are no signicant dierences
among the AR of MLP, DBN, and SAE. ere are no sig-
nificant dierences among the AR of RNN, LSTM, and GRU.
() rough the hypothesis test analysis of Ha and Hb,
we can obtain p value<.e-. So, there are statistically sig-
nicant dierences between the PR of all trading algorithms.
erefore, we need to make multiple comparative analysis
further, as shown in Table . e number in the table is a p
valueofanytwoalgorithmsofNemenyitest.FromTables
and , we can see that the PR of MLP, DBN, and SAE are
signicantly greater than that of other trading algorithms.
e PR of LSTM is not signicantly dierent from that of
GRU and NB. e PR of GRU is signicantly lower than that
of all traditional ML algorithms. e PR of NB is signicantly
lower than that of other traditional ML algorithms.
() rough the hypothesis test analysis of Ha and Hb,
we can obtain p value<.e-. So, there are statistically
signicant dierences between the RR of all trading algo-
rithms erefore, we need to make multiple comparative
analysis further, as shown in Table . e number in the
table is a p value of any two algorithms of Nemenyi test.
From Tables  and , we can see that there is no signicant
dierence among the RR of all DNN models, but the RR
of any DNN model is signicantly lower than that of all
traditional ML models. e RR of NB is signicantly lower
than that of other traditional ML algorithms. e RR of
CART is signicantly lower than that of other traditional ML
algorithms except for NB.
() rough the hypothesis test analysis of Ha and Hb,
we can obtain p value<.e-. So, there are statistically sig-
nicant dierences between the F of all trading algorithms.
erefore, we need to make multiple comparative analysis
further, as shown in Table . e number in the table is a p
valueofanytwoalgorithmsofNemenyitest.FromTables
 and , we can see that there is no signicant dierence
among the F of MLP, DBN, and SAE. e F of MLP, DBN,
and SAE are signicantly greater than that of RNN, LSTM,
GRU, and NB, but are signicantly smaller than that of RF, LR,
SVM, and XGB. e F of GRU and LSTM have no signicant
dierence, but they are signicantly smaller than that of all
traditional ML algorithms. e F of XGB is signicantly
greater than that of all other trading algorithms.
Mathematical Problems in Engineering
T : Multiple comparison analysis between the RR of any two trading algorithms. e p value of the two trading strategies with signicant
dierence is in boldface.
MLP DBN SAE RNN LSTM GRU CART NB RF LR SVM
DBN .
SAE . .
RNN . . .
LSTM . . . .
GRU . . . . .
CART 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
NB 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
RF 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0485 0.0000
LR 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 .
SVM 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0197 0.0000 0.0000 0.0000
XGB 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0010 . 0.0000
T : Multiple comparison analysis between the F of any two trading algorithms. e p value of the two trading strategies with signicant
dierence is in boldface.
MLP DBN SAE RNN LSTM GRU CART NB RF LR SVM
DBN .
SAE . .
RNN 0.0000 0.0000 0.0000
LSTM 0.0000 0.0000 0.0000 .
GRU 0.0000 0.0000 0.0000 0.0000 .
CART . 0.0061 0.0117 0.0000 0.0000 0.0000
NB 0.0000 0.0000 0.0000 . 0.0000 0.0000 0.0000
RF 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0078 0.0000
LR 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0173 0.0000 .
SVM 0.0007 0.0000 0.0000 0.0000 0.0000 0.0000 . 0.0000 . .
XGB 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
T : Multiple comparison analysis between the AUC of any two trading algorithms. e p value of the two trading strategies with
signicant dierence is in boldface.
MLP DBN SAE RNN LSTM GRU CART NB RF LR SVM
DBN .
SAE . .
RNN . . .
LSTM . . . .
GRU . . . . .
CART 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
NB 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
RF 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0270 0.0000
LR 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 .
SVM 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 . 0.0000 0.0000 0.0000
XGB 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0002 . 0.0000
() rough the hypothesis test analysis of Ha and Hb,
we can obtain p value<.e-. So, there are statistically
signicant dierences between the AUC of all trading algo-
rithms. erefore, we need to make multiple comparative
analysis further, as shown in Table . e number in the
table is a p value of any two algorithms of Nemenyi test.
From Tables  and , we can see that there is no signicant
dierence among the AUC of all DNN models. e AUC of
all DNN models are signicantly smaller than that of any
traditional ML model.
() rough the hypothesis test analysis of Ha and Hb,
we can obtain p value<.e-. So, there are statistically sig-
nicant dierences between the WR of all trading algorithms.
erefore, we need to make multiple comparative analysis
further,asshowninTable.enumberinthetableisp
value of any two algorithms of Nemenyi test. From Tables 
 Mathematical Problems in Engineering
T : Multiple comparison analysis between the WR of any two trading algorithms. e p value of the two trading strategies with signicant dierenceisinboldface.
Index BAH MLP DBN SAE RNN LSTM GRU CART NB RF LR SVM
BAH 0.0000
MLP 0.0000 0.0000
DBN 0.0000 0.0000 .
SAE 0.0000 0.0000 . .
RNN 0.0000 0.0000 0.0000 0.0000 0.0000
LSTM 0.0000 0.0000 0.0000 0.0000 0.0000 .
GRU 0.0011 0.0000 0.0001 0.0000 0.0000 . .
CART 0.0000 . 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
NB 0.0000 0.0000 0.0000 0.0000 0.0000 0.0031 0.0000 0.0038 0.0000
RF 0.0000 0.0000 0.0000 0.0000 0.0000 0.0118 0.0001 0.0140 0.0000 .
LR 0.0000 0.0000 0.0000 0.0000 0.0000 . . . 0.0000 0.0432 .
SVM 0.0000 0.0000 0.0000 0.0000 0.0000 . . . 0.0000 0.0001 0.0006 .
XGB 0.0000 0.0000 0.0000 0.0000 0.0000 . 0.0084 . 0.0000 . . . 0.0376
Mathematical Problems in Engineering 
T : Multiplecomparison analysis between the ARR of any two trading strategies.e p value of the two trading strategies with signicant
dierence is in boldface.
Index BAH MLP DBN SAE RNN LSTM GRU CART NB RF LR SVM
BAH 0.0000
MLP 0.0000 0.0000
DBN 0.0000 0.0000 .
SAE 0.0000 0.0000 . .
RNN 0.0000 0.0000 0.0001 0.0006 0.0001
LSTM 0.0000 0.0000 0.0000 0.0002 0.0000 .
GRU 0.0000 0.0000 0.0001 0.0008 0.0001 . .
CART 0.0000 0.0000 . . . 0.0001 0.0000 0.0001
NB 0.0000 0.0000 0.0021 0.0094 0.0022 . . . 0.0018
RF 0.0000 0.0000 . . . . . . . .
LR 0.0000 0.0000 0.0002 0.0012 0.0002 . . . 0.0002 . .
SVM 0.0000 0.0000 . . . . . . . . . .
XGB 0.0000 0.0000 . . . . . . . . . . .
T : Multiple comparison analysis betweenthe ASR of any two trading strategies. e p value of the two trading strategieswith signicant
dierence is in boldface.
Index BAH MLP DBN SAE RNN LSTM GRU CART NB RF LR SVM
BAH .
MLP 0.0000 0.0000
DBN 0.0000 0.0000 .
SAE 0.0000 0.0000 . .
RNN 0.0000 0.0000 . . .
LSTM 0.0000 0.0000 . . . .
GRU 0.0000 0.0000 . . . . .
CART 0.0000 0.0000 0.0002 0.0005 0.0002 0.0000 0.0000 0.0000
NB 0.0000 0.0000 0.0467 0.0233 . . . . 0.0000
RF 0.0000 0.0000 0.0000 0.0000 0.0000 0.0291 0.0042 . 0.0000 .
LR 0.0000 0.0000 . . . . . . 0.0000 . .
SVM 0.0000 0.0000 . . . . . . 0.0000 . . .
XGB 0.0000 0.0000 0.0099 0.0044 0.0122 . . . 0.0000 . . . .
and , we can see that the WR of MLP, DBN, and SAE have
no signicant dierence, but they are signicantly higher
than that of BAH and benchmark index, and signicantly
lower than that of other trading algorithms. e WR of RNN,
LSTM, and GRU have no signicant dierence, but they are
signicantly higher than that of CART and signicantly lower
than that of NB and RF. e WR of LR is not signicantly
dierent from that of RF, SVM, and XGB.
() rough the analysis of the hypothesis test of Ha
and Hb, we obtain p value<.e-. erefore, there are
signicant dierences between the ARR of all trading strate-
gies including the benchmark index and BAH. We need
to do further multiple comparative analysis, as shown in
Table  . F r o m Ta b l e s  and  , w e c a n s ee t h at t h e A RR of
the benchmark index and BAH are signicantly lower than
that of all ML algorithms. e ARR of MLP, DBN, and SAE
are signicantly greater than that of RNN, LSTM, GRU, NB,
and LR, but not signicantly dierent from that of CART,
RF, SVM, and XGB; there is no signicant dierence between
the ARR of MLP, DBN, and SAE. e ARR of RNN, LSTM,
and GRU are signicantly less than that of CART, but they
are not signicantly dierent from that of other traditional
ML algorithms. In all traditional ML algorithms, the ARR of
CART is signicantly greater than that of NB and LR, but,
otherwise, there is no signicant dierence between ARR of
any other two algorithms.
() rough the hypothesis test analysis of Ha and Hb,
we obtain p value<.e-. erefore, there are signicant
dierences between ASR of all trading strategies including
the benchmark index and BAH. e results of our multiple
comparative analysis are shown in Table . From Tables
and , we can see that the ASR of the benchmark index and
BAH are signicantly smaller than that of all ML algorithms.
e ASR of MLP and DBN are signicantly greater than that
of CART and are signicantly smaller than that of NB, RF,
and XGB, but there is no signicant dierence between MLP,
DBN, and other algorithms. e ASR of SAE is signicantly
greater than that of CART and signicantly less than that of
RF and XGB, but there is no signicant dierence between
SAE and other algorithms. e ASR of RNN and LSTM
 Mathematical Problems in Engineering
T : Multiple comparison analysis between the MDD of any two trading strategies. e p value of the two trading strategies with
signicant dierence is in boldface.
Index BAH MLP DBN SAE RNN LSTM GRU CART NB RF LR SVM
BAH 0.0000
MLP 0.0000 0.0052
DBN 0.0000 0.0031 .
SAE 0.0000 0.0012 . .
RNN 0.0000 0.0000 . . .
LSTM 0.0000 0.0000 . . . .
GRU 0.0000 0.0000 0.0245 0.0381 . . .
CART 0.0000 0.0000 . . . . . .
NB 0.0000 0.0000 . . . . . . .
RF 0.0000 0.0000 0.0002 0.0004 0.0012 . . . . .
LR 0.0000 0.0000 . . . . . . . . .
SVM 0.0000 0.0000 . . . . . . . . . .
XGB 0.0000 0.0000 0.0103 0.0167 0.0360 . . . . . . . .
T : Trading performance of dierent trading strategies in CSICS. Best performance of all trading strategies is in boldface.
Index BAH MLP DBN SAE RNN LSTM GRU CART NB RF LR SVM XGB
AR 0.5175 . . . . . . . . . . .
PR 0.7548 . . . . . . . . . . .
RR . . . . . . . . . 0.5318 . .
F 0.6150 . . . . . . . . . . .
AUC . . . . . . . . . 0.5086 . .
WR . . . . . . . . . . . 0.5809 . .
ARR . . . . . . . . . 0.6125 . . . .
ASR . . . . . . . . . . . 1.5582 . .
MDD 0.4808 . . . . . . . . . . . . .
are signicantly greater than that of CART and signicantly
less than that of RF, but there is no signicant dierence
between RNN, LSTM, and other algorithms. e ASR of GRU
is signicantly greater than that of CART, but there is no
signicant dierence between GRU and other traditional ML
algorithms. In all traditional ML algorithms, the ASR of all
algorithms are signicantly greater than that of CART, but
otherwise, there is no signicant dierence between ASR of
any other two algorithms.
() rough the hypothesis test analysis of Ha and Hb,
we obtain p value<.e-. erefore, there are signicant
dierences between MDD of trading strategies including
the benchmark index and the BAH. e results of multiple
comparative analysis are shown in Table . From Tables
and,wecanseethatMDDofanyMLalgorithmis
signicantly greater than that of the benchmark index but
signicantly smaller than that of BAH strategy. e MDD
of MLP and DBN are signicantly smaller than those of
GRU, RF, and XGB, but there is no signicant dierence
between MLP, DBN, and other algorithms. e MDD of
SAE is signicantly smaller than that of XGB, but there is
no signicant dierence between SAE and other algorithms.
Otherwise, there is no signicant dierence between MDD of
any other two algorithms.
In a word, the traditional ML algorithms such as NB,
RF, and XGB have good performance in most directional
evaluation indicators such as AR, PR, and F. e DNN
algorithms such as MLP have good performance in PR and
ARR. In traditional ML algorithms, the ARR of CART, RF,
SVM, and XGB are not signicantly dierent from that of
MLP, DBN, and SAE; the ARR of CART is signicantly
greater than that of LSTM, GRU, and RNN, but otherwise
the ARR of all traditional ML algorithms are not signicantly
worse than that of LSTM, GRU, and RNN. e ASR of all
traditional ML algorithms except CART are not signicantly
worse than that of the six DNN models; even the ASR of NB,
RF, and XGB are signicantly greater than that of some DNN
algorithms. e MDD of RF and XGB are signicantly less
that of MLP, DBN, and SAE; the MDD of all traditional ML
algorithms are not signicantly dierent from that of LSTM,
GRU, and RNN. e ARR and ASR of all ML algorithms are
signicantly greater than that of BAH and the benchmark
index; the MDD of any ML algorithm is signicantly greater
than that of the benchmark index, but signicantly less than
that of BAH strategy.
5.3. Comparative Analysis of Performance of Dierent Trading
Strategies in CSICS. eanalysismethodsofthispartare
similar to Section .. From Table , we can see that the AR,
PR, and F of MLP are the greatest in all trading algorithms.
e RR, AUC, WR, and ASR of LR are the greatest in
all trading algorithms, respectively. e ARR of NB is the
Mathematical Problems in Engineering 
T : Multiplecomparison analysis between the AR of any two trading algorithms. e p value of the twotrading strategies with signicant
dierence is in boldface.
MLP DBN SAE RNN LSTM GRU CART NB RF LR SVM
DBN .
SAE . .
RNN 0.0000 0.0000 0.0000
LSTM 0.0000 0.0000 0.0000 .
GRU 0.0000 0.0000 0.0000 . .
CART 0.0000 0.0000 0.0000 . 0.0024 0.0131
NB 0.0000 0.0001 0.0002 0.0022 0.0000 0.0000 .
RF 0.0000 0.0002 0.0005 0.0007 0.0000 0.0000 . .
LR 0.0000 0.0000 0.0000 0.0076 0.0000 0.0000 . . .
SVM 0.0217 . . 0.0000 0.0000 0.0000 0.0003 . . .
XGB 0.0000 0.0001 0.0001 0.0025 0.0000 0.0000 . . . . .
T : Multiplecomparison analysis between the PR ofany two trading algorithms. e p value of the two trading strategies with signicant
dierence is in boldface.
MLP DBN SAE RNN LSTM GRU CART NB RF LR SVM
DBN .
SAE . .
RNN 0.0000 0.0000 0.0000
LSTM 0.0000 0.0000 0.0000 0.0000
GRU 0.0000 0.0000 0.0000 0.0000 .
CART 0.0000 0.0000 0.0000 0.0000 . .
NB 0.0000 0.0000 0.0000 0.0000 . . .
RF 0.0000 0.0000 0.0000 0.0000 0.0319 0.0205 . .
LR 0.0000 0.0000 0.0000 0.0000 . . . . .
SVM 0.0000 0.0000 0.0000 . 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
XGB 0.0000 0.0000 0.0000 0.0000 . . . . . . 0.0000
highest in all trading strategies. e MDD of CSI  index
(benchmark index) is the smallest in all trading strategies.
e WR, ARR, and ASR of all ML algorithms are greater than
those of the benchmark index and BAH strategy.
() rough the hypothesis test analysis of Ha and Hb,
wecanobtainpvalue<.e-. erefore, there are signicant
dierences between the AR of all trading algorithms. ere-
fore, we need to do further multiple comparative analysis and
the results are shown in Table . e number in the table is a
p value of any two algorithms of Nemenyi test. From Tables 
and , we can see that the AR of MLP, DBN, and SAE have no
signicant dierence, but they are signicantly greater than
that of all other trading algorithms except for SVM. e AR
of GRU is signicantly smaller than that of all traditional ML
algorithms. ere is no signicant dierence between the AR
of any two traditional ML algorithms except for CART and
SVM.
() rough the hypothesis test analysis of Ha and Hb,
wecanobtainpvalue<.e-. erefore, there are signicant
dierences between the PR of all trading algorithms. ere-
fore, we need to do further multiple comparative analysis and
the results are shown in Table . e number in the table
is a p value of any two algorithms of Nemenyi test. From
Tables  and , we can see that the PR of MLP, DBN, and
SAE are signicantly greater than that of all other trading
algorithms, and the PR of MLP, DBN, and SAE have no
signicant dierence. e PR of SVM is signicantly greater
than that of all other traditional ML algorithms which have
no signicant dierence between any two algorithms except
for SVM. e PR of RNN is signicantly greater than that
of all traditional ML algorithms except for SVM. e PR of
GRU and LSTM are not signicantly dierent from that of all
traditional ML algorithms except for SVM and LR.
() rough the hypothesis test analysis of Ha and Hb,
we can obtain p value<.e-. erefore, there are signicant
dierences between the RR of all trading algorithms. ere-
fore, we need to do further multiple comparative analysis and
the results are shown in Table . e number in the table is
apvalueofanytwoalgorithmsofNemenyitest.FromTables
 and , we can see that the RR of all DNN models are
not signicantly dierent. ere is no signicant dierence
among the RR of all traditional ML algorithms. e RR of
RNN, GRU, and LSTM are signicantly smaller than that of
any traditional ML algorithm except for CART.
() rough the hypothesis test analysis of Ha and Hb,
we can obtain p value<.e-. erefore, there are signicant
dierences between the F of all trading algorithms. ere-
fore, we need to do further multiple comparative analysis and
 Mathematical Problems in Engineering
T : Multiplecomparison analysis between the RR of any two trading algorithms. e p value of the two trading strategies with signicant
dierence is in boldface.
MLP DBN SAE RNN LSTM GRU CART NB RF LR SVM
DBN .
SAE . .
RNN . . .
LSTM . . . .
GRU . . . . .
CART . . . . . .
NB . . . 0.0075 0.0004 0.0007 .
RF . . 0.0260 0.0028 0.0001 0.0002 . .
LR 0.0330 0.0328 0.0152 0.0015 0.0001 0.0001 . . .
SVM . . . 0.0434 0.0033 0.0059 . . . .
XGB 0.0193 0.0192 0.0085 0.0007 0.0000 0.0000 . . . . .
T : Multiple comparison analysis between the F of any two trading algorithms. e p value of the two trading strategies with signicant
dierence is in boldface.
MLP DBN SAE RNN LSTM GRU CART NB RF LR SVM
DBN .
SAE . .
RNN 0.0000 0.0000 0.0000
LSTM 0.0000 0.0000 0.0000 0.0000
GRU 0.0000 0.0000 0.0000 0.0000 .
CART 0.0000 0.0000 0.0000 0.0000 . .
NB 0.0000 0.0000 0.0000 0.0136 0.0132 0.0099 .
RF 0.0000 0.0000 0.0000 . 0.0016 0.0011 . .
LR 0.0000 0.0000 0.0000 0.0000 . . . . .
SVM 0.0000 0.0000 0.0000 0.0178 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
XGB 0.0000 0.0000 0.0000 0.0001 . . . . . . 0.0000
T : Multiple comparison analysis between the AUC of any two trading algorithms. e p value of the two trading strategies with
signicant dierence is in boldface.
MLP DBN SAE RNN LSTM GRU CART NB RF LR SVM
DBN .
SAE . .
RNN . . .
LSTM . . . .
GRU . . . . .
CART . . . . 0.0014 0.0096
NB 0.0002 0.0001 0.0000 0.0000 0.0000 0.0000 .
RF 0.0001 0.0001 0.0000 0.0000 0.0000 0.0000 . .
LR 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 . . .
SVM 0.0027 0.0014 0.0001 0.0000 0.0000 0.0000 . . . .
XGB 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 . . . . .
the results are shown in Table . e number in the table is a
p value of any two algorithms of Nemenyi test. From Tables 
and , we can see that the F of MLP, DBN, and SAE have no
signicant dierence, but they are signicantly greater than
that of all other trading algorithms. ere is no signicant
dierence among traditional ML algorithms except SVM, and
the F of SVM is signicantly greater than that of all other
traditional ML algorithms.
() rough the hypothesis test analysis of Ha and Hb,
we can obtain p value<.e-. erefore, there are signicant
dierences between the AUC of all trading algorithms. ere-
fore, we need to do further multiple comparative analysis and
the results are shown in Table . e number in the table is
apvalueofanytwoalgorithmsofNemenyitest.FromTables
 and , we can see that the AUC of all DNN models have
no signicant dierence. ere is no signicant dierence
Mathematical Problems in Engineering 
T : Multiple comparison analysis between the WR of any two trading algorithms. e p value of the two trading strategies with
signicant dierence is in boldface.
Index BAH MLP DBN SAE RNN LSTM GRU CART NB RF LR SVM
BAH .
MLP 0.0000 0.0000
DBN 0.0000 0.0000 .
SAE 0.0000 0.0000 . .
RNN 0.0000 0.0000 0.0002 0.0006 0.0000
LSTM 0.0000 0.0000 0.0000 0.0000 0.0000 .
GRU 0.0000 0.0000 0.0000 0.0000 0.0000 . .
CART . 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
NB 0.0031 0.0000 0.0001 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
RF 0.0000 0.0000 0.0000 0.0000 0.0000 0.0205 . . 0.0000 0.0000
LR 0.0000 0.0000 0.0000 0.0000 0.0000 0.0010 . . 0.0000 0.0000 .
SVM 0.0000 0.0000 0.0000 0.0000 0.0000 . . . 0.0000 0.0000 . .
XGB 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
T : Multiple comparison analysis between the ARR of any two trading strategies. e p value of the two trading strategies withsig nicant
dierence is in boldface.
Index BA H MLP DBN SAE R NN LSTM GRU CART NB RF LR SVM
BAH 0.0007
MLP 0.0000 0.0000
DBN 0.0000 0.0000 .
SAE 0.0000 0.0000 . .
RNN 0.0000 0.0000 . . .
LSTM 0.0000 0.0000 . . . .
GRU 0.0000 0.0000 . . . . .
CART 0.0000 0.0000 . . . . . .
NB 0.0000 0.0000 . . . . . . .
RF 0.0000 0.0000 0.0020 0.0048 0.0076 . . . . 0.0006
LR 0.0000 0.0000 . . . . . . . . .
SVM 0.0000 0.0000 . . . . . . . 0.0165 . .
XGB 0.0000 0.0000 . 0.0333 0.0484 . . . . 0.0057 . . .
between the AUC of all traditional ML algorithms. e
AUC of all traditional ML algorithms except for CART are
signicantly greater than that of any DNN model. ere is
no signicant dierence among the AUC of MLP, SAE, DBN,
RNN, and CART.
() rough the hypothesis test analysis of Ha and Hb,
wecanobtainpvalue<.e-. erefore, there are signicant
dierences between the WR of all trading algorithms. ere-
fore, we need to do further multiple comparative analysis and
theresultsareshowninTable.enumberinthetableis
apvalueofanytwoalgorithmsofNemenyitest.FromTables
 and , we can see that the WR of BAH and benchmark
index have no signicant dierence, but they are signicantly
smaller than that of any ML algorithm. e WR of MLP, DBN,
and SAE are signicantly smaller than that of the other trad-
ing algorithms, but there is no signicant dierence between
the WR of MLP, DBN, and SAE. e WR of LSTM and
GRU have no signicant dierence, but they are signicantly
smaller than that of XGB and signicantly greater than that of
CART and NB. In traditional ML models, the WR of NB and
CART are signicantly smaller than that of other algorithms.
e WR of XGB is signicantly greater than that of all other
ML algorithms.
() rough the analysis of the hypothesis test of Ha and
Hb, we obtain p value<.e-.
erefore, there are signicant dierences between the
ARR of all trading strategies including the benchmark index
and BAH strategy. erefore, we need to do further multiple
comparative analysis and the results are shown in Table .
From Tables  and , we can see that ARR of the benchmark
index and BAH are signicantly smaller than that of all
trading algorithms. e ARR of MLP is signicantly higher
than that of RF, but there is no signicant dierence between
MLP and other algorithms. e ARR of SAE and DBN are
signicantly higher than that of RF and XGB, but they are
not signicantly dierent from ARR of other algorithms. e
ARR of NB is signicantly higher than that of RF, SVM,
andXGB.But,otherwise,thereisnosignicantdierence
 Mathematical Problems in Engineering
T : Multiple comparison analysis between the ASR of any two trading strategies. e pv alue of the two trading strategies with signicant
dierence is in boldface.
Index BAH MLP DBN SAE RNN LSTM GRU CART NB RF LR SVM
BAH .
MLP 0.0000 0.0000
DBN 0.0000 0.0000 .
SAE 0.0000 0.0000 . .
RNN 0.0000 0.0000 . . .
LSTM 0.0000 0.0000 . . . .
GRU 0.0000 0.0000 . . . . .
CART 0.0000 0.0000 0.0158 0.0195 0.0327 0.0000 0.0000 0.0000
NB 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 .
RF 0.0000 0.0000 . . . . . . 0.0018 0.0000
LR 0.0000 0.0000 . . . . . . 0.0000 0.0000 .
SVM 0.0000 0.0000 . . . . . . 0.0042 0.0000 . .
XGB 0.0000 0.0000 . . . . . .0.0001 0.0000 . . .
T : Multiple comparison analysis between the MDD of any two trading strategies. e p value of the two trading strategies with
signicant dierence is in boldface.
Index BAH MLP DBN SAE RNN LSTM GRU CART NB RF LR SVM
BAH 0.0000
MLP 0.0000 0.0006
DBN 0.0000 0.0004 .
SAE 0.0000 0.0023 . .
RNN 0.0000 0.0000 0.0320 0.0421 0.0111
LSTM 0.0000 0.0000 0.0002 0.0003 0.0000 .
GRU 0.0000 0.0000 0.0001 0.0001 0.0000 . .
CART 0.0000 0.0000 . . . . . .
NB 0.0000 . 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
RF 0.0000 0.0000 . . . . . . . 0.0000
LR 0.0000 0.0000 0.0001 0.0002 0.0000 . . . . 0.0000 .
SVM 0.0000 0.0000 . . . . . . . 0.0000 . .
XGB 0.0000 0.0000 0.0308 0.0405 0.0106 . . . . 0.0000 . . .
between any other two algorithms. erefore, the ARR of
most traditional ML models are not signicantly worse than
that of the best DNN model.
() rough the hypothesis test analysis of Ha and Hb,
we obtain p value<.e-. erefore, ere are signicant
dierences between ASR of all trading strategies including the
benchmark index and BAH strategy. e results of multiple
comparative analysis are shown in Table . From Tables 
and , we can see that the ASR of the benchmark index
and BAH are signicantly smaller than that of all trading
algorithms. e ASR of all ML algorithms are signicantly
higher than that of CART and NB, but there is no signicant
dierence between the ASR of CART and NB. Beyond that,
there is no signicant dierence between any other two
algorithms. erefore, the ASR of all traditional ML models
except NB and CART are not signicantly worse than that of
any DNN model.
() rough the hypothesis test analysis of Ha and Hb,
we obtain p value<.e-. erefore, there are signicant
dierences between the MDD of these trading strategies
including the benchmark index and the BAH strategy.
e results of multiple comparative analysis are shown in
Table  . F r om Tables   a n d  , w e c a n see that t h e M D D
of the benchmark index is signicantly smaller than that of
other trading strategies including BAH strategy. e MDD of
BAH is signicantly greater than that of all trading algorithms
except NB. e MDD of MLP, DBN, and SAE are signicantly
lower than that of NB, but signicantly higher than that
ofRNN,LSTM,GRU,LR,andXGB.eMDDofNBis
signicantly greater than that of all other trading algorithms.
Beyond that, there is no signicant dierence between any
other two algorithms. erefore, all ML algorithms expect
NB, especially LSTM, RNN, GRU, LR, and XGB, can play a
role in controlling trading risk.
Inaword,someDNNmodelssuchasMLP,DBN,and
SAE have good performance in AR, PR, and F; traditional
ML algorithms such as LR and XGB have good performance
in AUC and WR. e ARR of some traditional ML algorithms
such as CART, NB, LR, and SVM are not signicantly
dierent from that of the six DNN models. e ASR of the
Mathematical Problems in Engineering 
six DNN algorithms are not signicantly dierent from all
traditional ML models except NB and CART. e MDD of
LR and XGB are signicantly smaller than those of MLP,
DBN, and SAE, and are not signicantly dierent from
that of LSTM, GRU, and RNN. e ARR and ASR of all
ML algorithms are signicantly greater than those of BAH
and benchmark index; the MDD of all ML algorithms are
signicantly smaller than that of the benchmark index but
signicantly greater than that of BAH strategy.
From the above analysis and evaluation, we can see that
the directional evaluation indicators of some DNN models
are very competitive in CSICS, while the indicators of some
traditional ML algorithms have excellent performance in
SPICS. Whether in SPICS or CSICS, the ARR and ASR of
all ML algorithms are signicantly greater than that of the
benchmark index and BAH strategy, respectively. In all ML
algorithms, there are always some traditional ML algorithms
which are not signicantly worse than the best DNN model
for any performance evaluation indicator (ARR, ASR, and
MDD). erefore, if we do not consider transaction cost and
other factors aecting trading, performance of DNN models
are alternative but not the best choice when they are applied
to stock trading.
Inthesameperiod,theARRofanyMLalgorithmin
CSICS is signicantly greater than that of the same algorithm
in SPICS (p value <. in the Nemenyi test). Meanwhile, the
MDD of any ML algorithm in CSICS is signicantly greater
than that of the same algorithm in SPICS (p value <.
in the Nemenyi test). e results show that the quantitative
trading algorithms can more easily obtain excess returns in
the Chinese A-share market, but the volatility risk of trading
in Chinese A-share market is signicantly higher than that of
the US stock market in the past  years.
6. The Impact of Transaction Cost on
Performance of ML Algorithms
Trading cost can aect the protability of a stock trading
strategy. Transaction cost that can be ignored in long-term
strategies is signicantly magnied in daily trading. However,
many algorithmic trading studies assume that transaction
cost does not exist ([, ], etc.). In practice, frictions such
as transaction cost can distort the market from the perfect
model in textbooks. e cost known prior to trading activity
is referred to as transparent such as commissions, exchange
fees, and taxes. e costs that has to be estimated are known
as implicit, including comprise bid-ask spread, latency or
slippage, and related market impact. is section focuses on
the transparent and implicit cost and how do they aect
trading performance in daily trading.
6.1. Experimental Settings and Backtesting Algorithm. In this
part, the transparent transaction cost is calculated by a certain
percentage of transaction turnover for convenience; the
implicit transaction cost is very complicated in calculation,
and it is necessary to make a reasonable estimate for the
random changes of market environment and stock prices.
erefore,weonlydiscusstheimpactofslippageontrading
performance.
e transaction cost structures of American stocks are
similar to that of Chinese A-shares. We assume that transpar-
ent transaction cost is calculated by a percentage of turnover
such as less than .% [, ] and .% and .% in the
literature []. It is dierent for the estimation of slippage.
In some quantitative trading simulation soware such as
JoinQuant [] and Abuquant [], the slippage is set to ..
e transparent transaction cost and implicit transaction cost
are charged in both directions when buying and selling. It
is worth noting that the transparent transaction cost varies
with the dierent brokers, while the implicit transaction cost
is related to market liquidity, market information, network
status, trading soware, etc.
We set slippages s = {s=, s=., s=., s=.,
s=.4}; the transparent transaction cost c = {c=, c=.,
c=., c=., c=., c=.5}.Fordierent{s,c}
combinations, we study the impact of dierent transaction
cost structures on trading performance. We assume that
buying and selling positions are one unit, so the turnover is
the corresponding stock price. When buying stocks, we not
only need to pay a certain percentage cost of the purchase
price, but also need to pay an uncertain slippage cost. at
is, we need to pay a higher price than the real-time price
𝑡−1 when we are buying. But, when selling stocks, we not
only need to pay a certain percentage cost of the selling
price, but also to pay an uncertain slippage cost. Generally
speaking, we need to sell at a price lower than the real-time
price 𝑡. It is worth noting that our trading strategy is self-
nancing. If ML algorithms predict the continuous occur-
rence of buying signals or selling signals, i.e., |𝑡
𝑡−1|=0, we will continue to hold or do nothing,
so the transaction cost at this time is . when |𝑡
𝑡−1|=1, it is indicated that the position may
be changed from holding to selling or from empty position
to buying. At this time, we would pay transaction cost
due to the trading operation. Finally, we get a real yield
is
𝑡𝑡−
𝑡−1
𝑡−1 .
𝑡=
𝑡
∗1−∗
𝑡−
𝑡−1
−∗
𝑡−
𝑡−1
𝑡−1 =
𝑡−1
∗1+∗
𝑡−1 −
𝑡−2
+∗
𝑡−1 −
𝑡−2
𝑡=𝑡−
𝑡−1
𝑡−1
()
where 𝑡denotes the -th closing price,
𝑡denotes the -th trading signal, 𝑡denotes
the -th executing price, and 𝑡denotes the -th return rate.
We propose a backtesting algorithm with transaction cost
based on the above analysis, as is shown in Algorithm .
 Mathematical Problems in Engineering
Input: TS TS is trading signals of a stock.
ssisslippage.
c  c is transparent transaction cost.
Output: WR, ARR, ASR, MDD
() N=length of Stock Code List  SPICS, and  CSICS.
() WR=NULL; ARR=NULL; ASR=NULL; MDD=NULL
() for (i in : N) {
() Stock Data=Stock Code List[i]
() ClosePricet=Stock Data [“Closing Price”]
() Pt=ClosePricet(-cabs(TSt-TSt-1)) - sabs(TSt-TSt-1)
() Pt-1=ClosePricet(+cabs(TSt-TSt-1)) + sabs(TSt-T St-1)
() Rett=(P
t-P
t-1)/ Pt Ret is the return rate series.
() TDRR=lag (TS)Ret TDRR is the daily return through trading.
() WR[i]=sum (TDRR>)/sum(TDRR =)
() ARR[i]=Return.annualized (TDRR)
() ASR[i]=SharpeRatio.annualized (TDRR)
() MDD[i]=maxDrawDown (TDRR)
() WR=c (WR, WR[i]);
() ARR=c (ARR, ARR[i]);
() ASR=c (ASR, ASR[i]);
() MDD=c (MDD, MDD[i])
() }
() return (WR, ARR, ASR, MDD)
A : Backtesting algorithm with transaction cost in R language.
6.2. Analysis of Impact of Transaction Cost on the Trading
Performance of SPICS. Transaction cost is one of the most
important factors aecting trading performance. In US stock
trading, transparent transaction cost can be charged accord-
ing to a xed fee per order or month, or a oating fee based
on the volume and turnover of each transaction. Sometimes,
customers can also negotiate with broker to determine
transaction cost. e transaction cost charged by dierent
brokers varies greatly. Meanwhile, implicit transaction cost
is not known beforehand and the estimations of them are
very complex. erefore, we assume that the percentage
of turnover is the transparent transaction cost for ease of
calculation. In the aspect of implicit transaction cost, we only
consider the impact of slippage on trading performance.
(1)AnalysisofImpactofTransactionCostonWR.Ascanbe
seen from Table , WR is decreasing with the increase of
transaction cost for any trading algorithm, which is intuitive.
When the transaction cost is set to (s, c) = (., .), the
WR of each algorithm is the lowest. Compared with setting
(s, c) = (, ), the WR of MLP, DBN, SAE, RNN, LSTM,
GRU, CART, NB, RF, LR, and SVM to XGB are reduced by
.%, .%, .%, .%, .%, .%, .%, .%,
.%, .%, .%, and .%, respectively. erefore,
MLP, DBN, and SAE are more tolerant to transaction cost.
Generally speaking, the DNN models have stronger capacity
to accommodate transaction cost than the traditional ML
models. From the single trading algorithm such as MLP, if
we do not consider slippage, i.e., s=, the average WR of
MLP is . under transaction cost structures {(s, c),
(s, c), (s, c), (s, c), (s, c) };ifwedonotconsider
transparent transaction cost, i.e., c=, the average WR of MLP
is . under transaction cost structures {(s, c), (s, c),
(s, c), (s, c) }; so transparent transaction cost has greater
impact than slippage. rough multiple comparative analysis,
the WR under the transaction cost structure (s, c) is not
signicantly dierent from the WR without transaction cost
forMLP,DBN,andSAE.eWRunderallothertransaction
cost structures are signicantly smaller than the WR without
transaction cost. For all trading algorithms except for MLP,
DBN, and SAE, the WR under the transaction cost structure
{(s, c), (s, c) }are not signicantly dierent from the WR
without transaction cost; the WR under all other transaction
cost structures are signicantly smaller than the WR without
transaction cost.
(2) Analysis of Impact of Transaction Cost on ARR.Ascan
be seen from Table , ARR is decreasing with the increase
of transaction cost for any trading algorithm. Undoubtedly,
when the transaction cost is set to (s, c) = (., .), the
ARR of each algorithm is the lowest. Compared with the
settings without transaction cost, the ARR of MLP, DBN,
and SAE reduce by .%, .%, and .%, respectively,
while the ARR of other trading algorithms decrease by more
than % compared with those without transaction cost.
erefore, excessive transaction cost can lead to serious losses
in accounts. For a general setting of s and c, i.e., (s, c) = (.,
.), ARR of MLP, DBN, and SAE decrease by .%,
.%, and .%, respectively, while the ARR of other
algorithms decrease by more than % and that of CART
and XGB decrease by more than %. erefore, MLP, DBN,
and SAE are more tolerant to high transaction cost. From
single trading algorithm such as RNN, if we do not consider
slippage, i.e., s=, the average ARR of RNN is . under
Mathematical Problems in Engineering 
T : e WR of SPICS for daily trading with dierent transaction cost. e result that there is no signicant dierence between performance without transaction cost and that with
transactioncostisinboldface.
MLP DBN SAE RNN LSTM GRU CART NB RF LR SVM XGB
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) 0.5649 0.5653 0.5656 0.5778 0.5751 0.5785 0.5190 0.5861 0.5824 0.5782 0.5759 0.5788
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . 0.5729 0.5697 0.5741 0.5134 0.5811 0.5758 0.5726 0.5704 0.5713
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
 Mathematical Problems in Engineering
T : e ARR of SPICS for daily trading with dierent transaction cost. e result that there is no signicant dierence between performance withouttransactioncostandthatwith
transactioncostisinboldface.
MLP DBN SAE RNN LSTM GRU CART NB RF LR SVM XGB
(s, c) . . . . . . . . . . . .
(s, c) 0.3128 0.3087 0.3118 . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . -. . . . . -.
(s, c) . . . . -. . -. . -. -. -. -.
(s, c) 0.3249 0.3212 0.3242 0.2778 0.2729 0.2794 0.2953 0.2818 0.2898 0.2747 0.2855 0.2762
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . -. . . . . .
(s, c) . . . . . . -. . -. . . -.
(s, c) . . . . -. . -. . -. -. -. -.
(s, c) 0.3167 0.3129 0.3159 0.2613 0.2538 0.2654 0.2589 0.2661 0.2663 0.2551 0.2643 0.2484
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . -. . . . . -.
(s, c) . . . . . . -. . -. . -. -.
(s, c) . . . . -. . -. . -. -. -. -.
(s, c) 0.3085 0.3046 0.3076 . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . -. . . . . -.
(s, c) . . . . -. . -. . -. -. -. -.
(s, c) . . . -. -. . -. . -. -. -. -.
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . -. . . . . .
(s, c) . . . . . . -. . -. . . -.
(s, c) . . . . -. . -. . -. -. -. -.
(s, c) . . . -. -. . -. -. -. -. -. -.
Mathematical Problems in Engineering 
the transaction cost structures {(s, c), (s, c), (s, c), (s,
c), (s, c) }; if we do not consider transparent transaction
cost, i.e., c=, the average ARR of RNN is . under the
transaction cost structure {(s, c), (s, c), (s, c), (s,
c) }; so transparent transaction cost has greater impact than
slippage. rough multiple comparative analysis, the ARR
under the transaction cost structures {(s, c), (s, c), (s,
c), (s, c) }are not signicantly dierent from the ARR
without transaction cost for MLP, DBN, and SAE; the ARR
under all other transaction cost structures are signicantly
smaller than the ARR without transaction cost. For all trading
algorithms except for MLP, DBN, and SAE, the ARR under
the transaction cost structures {(s, c), (s, c) }are not
signicantly dierent from the ARR without transaction
cost; the ARR under all other transaction cost structures are
signicantly smaller than the ARR without transaction cost.
(3)AnalysisofImpactofTransactionCostonASR.Ascan
be seen from Table , ASR is decreasing with the increase
of transaction cost for any trading algorithm. Undoubtedly,
when the transaction cost is set to (s, c) = (., .), the
ASR of each algorithm is the lowest. Compared with setting
without transaction cost, the ASR of MLP, DBN, and SAE
reduce by .%, .%, and .%, respectively, while the
ASR of other trading algorithms reduce by more than %
compared with the case of no transaction cost. erefore,
excessive transaction cost will signicantly reduce ASR. For
a general setting of s and c, i.e., (s, c) = (., .), the
ASRofMLP,DBN,andSAEdecreaseby.%,.%
and .% respectively. while the ASR of other algorithms
decrease by more than %; the ASR of CART and XGB
decrease by more than %. erefore, MLP, DBN, and SAE
are more tolerant to transaction cost. From single trading
algorithm such as NB, if we do not consider slippage, i.e.,
s=, the average ASR of NB is . under the transaction
cost structure {(s0, c1),(s,c),(s,c),(s,c),(s0, c5)};
if we do not consider transparent transaction cost, i.e., c=,
the average ASR of NB is . under the transaction cost
structures {(s1, c0),(s,c),(s,c),(s,c)};sotransparent
transaction cost has greater impact than slippage. rough
multiple comparative analysis, the ASR under the transaction
cost structures {(s1, c0),(s,c),(s,c),(s0,c1)} are not
signicantly dierent from the ASR without transaction cost
forMLP,DBN,andSAE;theASRunderallothertransaction
cost structures are signicantly smaller than the ASR without
transaction cost. For all trading algorithms except for MLP,
DBN, and SAE, the ASR under the transaction cost structures
{(s1,c0),(s2, c0)} are not signicantly dierent from the ASR
without transaction cost; the ASR under all other transaction
cost structures are signicantly smaller than the ASR without
transaction cost.
(4)AnalysisofImpactofTransactionCostonMDD.Ascan
be seen from Table , MDD increases with the increase
of transaction cost for any trading algorithm. Undoubtedly,
when the transaction cost is set to (s, c) = (., .), the
MDD of each algorithm increases to the highest level. In this
case, compared with the settings without transaction cost, the
MDD of MLP, DBN, and SAE increase by .%, .%, and
.%, respectively. e MDD of other trading algorithms
increase by more than % compared with those without
considering transaction cost. erefore, excessive transaction
cost can cause serious potential losses to the account. For a
general setting of s and c, i.e., (s, c) = (., .), the MDD
of MLP, DBN, and SAE increase by .%, .%, and .%,
respectively, while the MDD of other algorithms increase by
more than %, and the MDD of CART, RF, and XGB increase
by more than %. erefore, MLP, DBN, and SAE are more
tolerant to transaction cost. As a whole, the DNN models have
stronger capacity to accommodate transaction cost than the
traditional ML models. From single trading algorithm such
as GRU, if we do not consider slippage, i.e., s=, the average
MDD of GRU is . under the transaction cost structures
{(s0,c1),(s,c),(s,c),(s,c),(s0,c5)};ifwedonot
consider transparent transaction cost, i.e., c=, the average
MDD of GRU is . under the transaction cost structures
{(s1,c0),(s,c),(s,c),(s4, c0)};sotransparenttransaction
cost has greater impact than slippage. rough multiple
comparative analysis, the MDD under any the transaction
cost structure is not signicantly dierent from the MDD
without transaction cost for MLP, DBN, and SAE. For all
trading algorithms except for MLP, DBN, and SAE such as
LR, the MDD under the transaction cost structures {(s0,c1),
(s, c), (s, c), (s3,c0)} are not signicantly dierent from
the MDD without transaction cost; the MDD under all other
transaction cost structures are signicantly greater than the
MDD without transaction cost.
rough the analysis of the Table  performance eval-
uation indicators, we nd that trading performance aer
considering transaction cost will be worse than that without
considering transaction cost as is in actual trading situation.
It is noteworthy that the performance changes of DNN
algorithms, especially MLP, DBN, and SAE, are very small
aer considering transaction cost. is shows that the three
algorithms have good tolerance to changes of transaction
cost. Especially for the MDD of the three algorithms, there
is no signicant dierence with that with no transaction
cost. So, we can consider applying them in actual trading.
Meanwhile, we conclude that the transparent transaction
cost has greater impact on the trading performances than
the slippage for SPICS. is is because the prices of SPICS
are too high when the transparent transaction cost is set
to a certain percentage of turnover. In actual transactions,
special attention needs to be paid to the fact that the trans-
action performance under most transaction cost structures
is signicantly lower than the trading performance without
considering transaction cost. It is worth noting that the
performance of traditional ML algorithm is not worse than
that of DNN algorithms without considering transa ction cost,
while the performance of DNN algorithms is better than that
of traditional ML algorithms aer considering transaction
cost.
6.3. Analysis of Impact of Transaction Cost on the Trading
Performance of CSICS. Similar to Section ., we will discuss
the impact of transaction cost on trading performance of
CSICS in the followings. In the Chinese A-share market,
the transparent transaction cost is usually set to a certain
 Mathematical Problems in Engineering
T : e ASR of SPICS for daily trading with dierent transaction cost. e result that there is no signicant dierence between performance withouttransactioncostandthatwith
transactioncostisinboldface.
MLP DBN SAE RNN LSTM GRU CART NB RF LR SVM XGB
(s, c) . . . . . . . . . . . .
(s, c) 1.4562 1.4478 1.4577 . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . -. . . . . .
(s, c) . . . . . . -. . . . . -.
(s, c) . . . . -. . -. . -. -. -. -.
(s, c) 1.5121 1.5057 1.5149 1.4927 1.4606 1.5119 1.2449 1.5424 1.5582 1.4825 1.4974 1.4886
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . -. . . . . -.
(s, c) . . . . . . -. . -. . . -.
(s, c) . . . . -. . -. . -. -. -. -.
(s, c) 1.477 1.4699 1.4792 1.4081 1.3632 1.4403 1.0946 1.4601 1.4390 1.3822 1.3922 1.3462
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . -. . . . . -.
(s, c) . . . . . . -. . -. . -. -.
(s, c) . . . -. -. . -. . -. -. -. -.
(s, c) 1.4415 1.4337 1.4432 . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . -. . . . . .
(s, c) . . . . . . -. . . . . -.
(s, c) . . . . -. . -. . -. -. -. -.
(s, c) . . . -. -. . -. . -. -. -. -.
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . -. . . . . .
(s, c) . . . . . . -. . -. . . -.
(s, c) . . . . -. . -. . -. -. -. -.
(s, c) . . . -. -. . -. -. -. -. -. -.
Mathematical Problems in Engineering 
T : e MDD of SPICS for daily trading with dierent transaction cost. e result that there is no signicant dierence between
performance without transaction cost and that with transaction cost is in boldface.
MLP DBN SAE RNN LSTM GRU CART NB RF LR SVM XGB
(s, c) . . . . . . . . . . . .
(s, c) 0.3629 0.3638 0.3594 0.3779 0.3986 0.3636 0.4072 0.3712 0.3843 0.3963 0.3972 0.4203
(s, c) 0.3677 0.3695 0.3647 . . . . . . . . .
(s, c) 0.3727 0.3756 0.3703 . . . . . . . . .
(s, c) 0.3781 0.3821 0.3764 . . . . . . . . .
(s, c) 0.3839 0.3890 0.3828 . . . . . . . . .
(s, c) 0.3596 0.3600 0.3560 0.3500 0.36130 0.3446 0.3574 0.3502 0.3414 0.3585 0.3569 0.3540
(s, c) 0.3642 0.3655 0.3609 0.3907 . 0.3717 . 0.3814 . . . .
(s, c) 0.3691 0.3712 0.3662 . . . . . . . . .
(s, c) 0.3742 0.3774 0.3720 . . . . . . . . .
(s, c) 0.3796 0.3839 0.3781 . . . . . . . . .
(s, c) 0.3856 0.3909 0.3847 . . . . . . . . .
(s, c) 0.3609 0.3615 0.3573 0.3607 0.3756 0.3517 0.3770 0.3586 0.3586 0.3739 0.3727 0.3787
(s, c) 0.3656 0.3671 0.3623 . . . . 0.3929 . . . .
(s, c) 0.3705 0.3729 0.3678 . . . . . . . . .
(s, c) 0.3756 0.3792 0.3736 . . . . . . . . .
(s, c) 0.3812 0.3859 0.3799 . . . . . . . . .
(s, c) 0.3873 0.3930 0.3866 . . . . . . . . .
(s, c) 0.3622 0.3631 0.3588 0.3729 0.3912 0.3594 0.4004 0.3685 0.3795 0.3909 0.3909 0.4081
(s, c) 0.3669 0.3687 0.3639 . . . . . . . . .
(s, c) 0.3719 0.3746 0.3694 . . . . . . . . .
(s, c) 0.3772 0.3811 0.3754 . . . . . . . . .
(s, c) 0.3829 0.3879 0.3818 . . . . . . . . .
(s, c) 0.3894 0.3954 0.3888 . . . . . . . . .
(s, c) 0.3635 0.3647 0.3602 0.3861 0.4082 0.3678 . 0.3798 . . . .
(s, c) 0.3683 0.3704 0.3654 . . . . . . . . .
(s, c) 0.3734 0.3765 0.3712 . . . . . . . . .
(s, c) 0.3790 0.3833 0.3775 . . . . . . . . .
(s, c) 0.3851 0.3904 0.3841 . . . . . . . . .
(s, c) 0.3917 0.3981 0.3913 . . . . . . . . .
percentage of turnover, and it is the same as the assumption
in the experimental settings. As in the US stock market, the
smallest unit of price change is . (one tick). It is reasonable
to set slippage to be .-.. Of course, it should be noted
that the prices uctuation may be more intense when closing
than that in the middle of a trading day.
(1)AnalysisofImpactofTransactionCostonWR.Ascanbe
seen from Table , the WR is decreasing with the increase
of transaction cost for any trading algorithm. When the
transaction cost is set to (s, c) = (., .), the WR of each
algorithm is the smallest. Compared with the settings without
transaction cost, the WR of MLP, DBN, SAE, RNN, LSTM,
GRU,CART,NB,RF,LR,SVM,andXGBarereducedby
.%, .%, .%, .%, .%, .%, .%, .%,
.%, .%, .%, and .%, respectively. For a general
setting of s and c, i.e., (s, c) = (., .), the WR of
MLP, DBN, and SAE decrease by .%, .%, and .%,
respectively, while the WR of other algorithms decrease by
more than %; the WR of CART, RF, and XGB decrease by
more than %. erefore, MLP, DBN, and SAE are more
tolerant to transaction cost. From single trading algorithm
such as LSTM, if we do not consider slippage, i.e., s=, the
average WR of DBN is . under the transaction cost
structures {(s, c), (s, c), (s, c), (s, c), (s, c) };ifwe
do not consider transparent transaction cost, i.e., c=, the
average WR of LSTM is . under the transaction cost
structures {(s, c), (s, c), (s, c), (s, c)};sotransparent
transaction cost has smaller impact than slippage. rough
multiple comparative analysis, the WR under the transaction
cost structures {(s, c), (s, c), (s, c) }are not signicantly
dierent from the WR without transaction cost for MLP,
DBN, SAE, and NB; the WR under all other transaction
cost structures are signicantly smaller than the WR without
transaction cost. For all trading algorithms except for MLP,
DBN, SAE, and NB, the WR under the transaction cost
structure (s, c) is not signicantly dierent from the WR
without transaction cost; the WR under all other transaction
cost structures are signicantly smaller than the WR without
transaction cost.
 Mathematical Problems in Engineering
T : e WR of CSICS for daily trading with dierent transaction cost. e result that there is no signicant dierence between
performance without transaction cost and that with transaction cost is in boldface.
MLP DBN SAE RNN LSTM GRU CART NB RF LR SVM XGB
(s, c) . . . . . . . . . . . .
(s, c) 0.5523 0.5527 0.5525 0.5525 0.5608 0.5620 0.5009 0.5227 0.5612 0.5665 0.5571 0.5595
(s, c) 0.5488 0.5492 0.5489 . . . . 0.5149 . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) 0.5494 0.5499 0.5497 . . . . 0.5170 . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(s, c) . . . . . . . . . . . .
(2)AnalysisofImpactofTransactionCostonARR.Ascan
be seen from Table , ARR is decreasing with the increase
of transaction cost for any trading algorithm. Undoubtedly,
when the transaction cost is set to (s, c) = (., .), the
ARR of each algorithm is the smallest. Compared with the
settings without transaction cost, the ARR of MLP, DBN,
and SAE reduce by .%, .%, and .%, respectively.
While the ARR of other trading algorithms decrease by
more than % compared with those algorithms without
transaction cost. erefore, excessive transaction cost can
lead to serious losses in the accounts. For a general setting
of s and c, i.e., (s, c) = (., .), ARR of MLP, DBN,
and SAE decrease by .%, .%, and .% respectively,
while the ARR other algorithms decrease by more than %
and that of CART, NB, RF, and XGB decrease by more than
%. erefore, MLP, DBN, and SAE are more tolerant to
transaction cost. From single trading algorithm such as SAE,
if we do not consider slippage, i.e., s=, the average ARR of
SAE is . under the transaction cost structure {(s, c),
(s, c), (s, c), (s, c), (s, c) };ifwedonotconsider
transparent transaction cost, i.e., c=, the average ARR of SAE
is . under the transaction cost structures {(s, c), (s,
c), (s, c), (s, c) };sotransparenttransactioncosthas
smaller impact than slippage. rough multiple comparative
analysis, the ARR under the transaction cost structures {(s,
c), (s, c), (s, c), (s, c), (s, c) }are not signicantly
dierent from the ARR without transaction cost for MLP,
DBN, and SAE; the ARR under all other transaction cost
structures are signicantly smaller than the ARR without
transaction cost. For RNN, LSTM, GRU, CART, RF, LR, and