Portfolio Optimization in Both Long and Short Selling Trading using Trend Ratios and Quantum-inspired Evolutionary Algorithms

Stock selection is the first problem that investors encounter when investing in the stock market and is paramount. The Sharpe ratio is a common assessment strategy. However, the Sharpe ratio considers an uptrend portfolio high risk because it assesses portfolio risk using standard deviations. Hence, we propose a novel investment strategy, namely, the trend ratio, to assess portfolio risk more accurately by the portfolio trend line. Thus, the uptrend portfolio is not considered high risk and is more consistent with the psychology of investors. In addition to normal trading (long selling), short selling is another common trading method. Short selling is borrowing stocks from stock vendors to sell and then repaying the stock at a lower price to make a profit. This paper proposes investing simultaneously in normal trading and short selling by a trend ratio, which can further increase investment profits and spread risks. This paper also adds certificates of deposit as a portfolio choice to ensure that investors can still make profits. This paper utilizes the global quantum-inspired tabu search algorithm with a quantum NOT-gate (GNQTS) to effectively find the best combination of stocks. To avoid the overfitting problem, this paper employs a sliding window. Specifically, this paper combines the trend ratio, GNQTS, short selling with certificates of deposit, and sliding windows to perform the stock selection. The experimental results are promising, with our proposed method having better performance than the Sharpe ratio. Furthermore, the experimental results show that both long selling and short selling investments can increase the performance.


I. INTRODUCTION
In a capitalist society, people want to accumulate wealth to manage unexpected future situations. Due to inflation, people must invest their assets to prevent them from shrinking. The stock market is one of the most common investment choices because of its lower asset investment threshold against real estate, and it has more transparent and public information compared to futures. Although the stock market has a lower investment threshold, how to earn a profit in the stock market remains a complex problem.
The first investing problem in the stock market is choosing which stock can earn more profit, and it is called stock selection. However, investing is always accompanied by risk, and how to reduce the risk and increase the return are the most important considerations in stock selection. When investing in the stock market, there is a saying: "Do not put all your eggs in one basket." The modern portfolio theory (MPT), proposed by Harry Markowitz in 1952 [1], mentioned that a risk-averse investor should construct a portfolio (i.e., multiple stocks) with the lowest possible risk, rather than investing in one stock. Therefore, we analyze how to compose a portfolio with high return and low risk. To evaluate portfolio performance, many indicators have been proposed. One of the most commonly used indicators is the Sharpe ratio [2], [3], which is calculated by dividing the portfolio return by risk, and a larger return with lower risk returns a higher value. However, the Sharpe ratio adheres to the mean-variance strategy that MPT proposed; therefore, the definition of risk is the standard deviation, which indicates the volatility to the average line that will be considered as risk. The evaluation method considers continuous downtrend portfolios a high risk. However, it also considers continuous uptrend portfolios a high risk, but this consideration violates the anticipation of an investor. Therefore, we propose the trend ratio to address this problem. The trend ratio evaluates the portfolio by the trend line. Thus, in a continuous uptrend, the portfolio risk is evaluated by the difference in real data points to the trend line, and it can be identified as low risk. Therefore, the evaluated portfolio risk will be reasonable to the investor, and it meets the expectations of investors. The trend ratio is calculated by the daily expected return divided daily risk, indicating the daily expected return per unit of daily risk. The daily expected return is the slope of the trend line, and the daily risk is the residual between the data points and the trend line. Therefore, a higher daily expected return with lower daily risk results in a larger trend ratio value, and it indicates a portfolio with better performance. The design of the trend ratio can assess a portfolio with a stable uptrend and make the investor profitable.
In the stock market, there are many kinds of stock trading methods. When the stock market is prosperous, long selling (normal trading) is the best method for earning a profit. However, to diversify investment choices and increase market liquidity, short selling is another legal and common investment method for making money. Long selling means that investors sell shares that they own and thus hope to sell at a higher price with increasing stock. In contrast, short selling means that investors sell shares that they do not own and hope to buy them back at a lower price. To avoid risk, in addition to long selling by buying at a low point and selling at a high point, short selling by selling at the high point and buying at the low point is a method for earning a profit. The trend ratio can not only identify a stable uptrend portfolio but also recognize a stable downtrend portfolio for short selling. This paper aims to evaluate the portfolio by the trend ratio and separately finds stable uptrend and downtrend portfolios. When short selling investments are made, there is a margin to the vendor when borrowing securities. Moreover, the regulation in some stock markets allows the margin for short selling to be cash or securities. To maximize investment performance, this paper first considers owning an uptrend portfolio and then using these securities as collateral to trade for the equivalent suitable downtrend portfolio for short selling. The mechanism requires only single funds to simultaneously perform long and short selling, and it also increases the opportunity to make money. In addition to the short selling portfolio, which can be traded when the market goes down, certificates of deposit are also a different investment choice, with the certificate of deposit called a deposit in this context. The deposit is a kind of risk-free investment. When the stock market is not promising, investors do not invest all of their funds in the stock market to reduce risk by preserving funds; keeping their funds on deposit can earn some interest. Furthermore, during a period of economic recession, the best investment option may be on deposit. Thus, this paper also considers the option that preserves funds on deposit.
The stock selection problem is NP-complete and difficult to solve. Thus, we require an efficient and effective algorithm to find the approximate optimal solution in a limited time. This paper uses the global-best guided quantum-inspired tabu search algorithm with a quantum NOT-gate, called GNQTS. GNQTS is an improved quantum-inspired tabu search algorithm (QTS), and QTS is a branch of the evolutionary algorithm. The core concept of QTS is simultaneously approaching the best solution and distancing from the worst solution. The QTS has been derived with better performance in many aspects of the optimization problem, such as stock selection, timing decisions, 0/1 knapsack, reversible circuit synthesis, and wormhole attack detection problems. The GN-QTS further uses the global-best guided approach to enhance the exploitation ability and then uses the quantum NOTgate to leave the local optima and enhance the exploration ability. Therefore, GNQTS has a stronger ability to search for the optimal solution than QTS, and it is suitable for stock selection problems with large solution spaces. In addition, we utilize a sliding window to retain fresher data and avoid the overfitting problem. We also utilize different lengths of periods as a combination for testing portfolio performance, which is recognized by the trend ratio, attempting to find the most suitable training and testing period length to make the investor earnable through the trend ratio assessment.
This paper utilizes the trend ratio to assess a stable uptrend and downtrend portfolio accurately. Furthermore, this paper separately identifies portfolios with long selling and short selling and then invests them using single funds to maximize the investment return and minimize the investment risk simultaneously. Also, the deposit option is considered in our target to avoid high risk investments. Due to the large solution space in constructing a portfolio, this paper optimizes the portfolio by GNQTS to find the approximate optimal portfolio in a short time.
This paper is organized as follows. Section II is about how the previous studies have solved portfolio optimization. Section III introduces the background knowledge. The core concept in this paper is demonstrated in Section IV. Section V details how this paper uses an evolutionary algorithm to optimize portfolios in both long and short selling. The experimental results and analysis are in Section VI. Section VII concludes this study.

II. RELATED WORK
When investing in the stock market, there are three significant issues to address: stock selection, trading timing and price forecasting. Finding the best timing to trade stocks, forecasting the trends or prices of stocks and selecting potential stocks are the foundations that help investors to earn more profit. The studies [4]- [15] focus on price forecasting. The studies [4]- [8] apply a neural network to perform forecasting, the studies [9]- [14] utilize the fuzzy time series, and the studies [15] use the dynamic normalization backpropagation network. In addition to price forecasting, trading timing is important to buying at a low point and selling at a high point to earn the difference. The studies [16]- [22] focus on trading timing. One study [16] uses the fuzzy theorem, another [17] utilizes the machine learning method, and the studies [18]- [22] use the evolutionary algorithm to find the best timing.
In the stock market, people usually tend to invest in the most profitable target. However, modern portfolio theory (MPT) [1] shows that high returns are always accompanied by high risk, and low risk is accompanied by low returns. MPT also shows that the portfolio can spread investment risk. Thus, portfolio optimization has been a popular issue in the stock market. There have been many different strategies proposed to assess and construct a portfolio. The most commonly used indicator is the Sharpe ratio. The Sharpe ratio [2], [3] was proposed by William F. Sharpe, who was a Nobel Prize winner in Economics in 1990. The Sharpe ratio simultaneously considers not only return but also risk, and it is calculated by the expected return rate deducting the risk-free rate divided by risk. The Sharpe ratio uses the mean-variance model that MPT proposed; thus, the definition of risk is the variance and covariance. Many studies [23]- [35] assess portfolio performance by the Sharpe ratio in the mean-variance model. Moreover, there are many studies [26], [31] that use the Sharpe ratio as the comparing criterion to evaluate portfolios identified by the different models or algorithms and then comparing the effectiveness of the models or algorithms. However, variance and covariance evaluate the difference compared to the mean. Therefore, once the portfolio trend deviates from the average line, it is evaluated as high risk. In downtrend portfolios, the design of risk seems reasonable. Nevertheless, when the portfolio is in a stable uptrend, it is assessed with the same high risk. Generally, stable uptrends should be favorable to investors. The Sharpe ratio misjudges a stable uptrend portfolio as high risk and then derives a low rank. Some studies [36], [37] attempt to revise the misjudgment from the Sharpe ratio. The study [36] uses the downside risk to assess portfolio risk, and the study [37] uses the semivariance to evaluate risk. They both only consider the underestimated situation as risk. However, the concept that the Sharpe ratio proposes is evaluating both the overestimated and underestimated situations. Therefore, the study [38] proposes the novel indicator trend ratio to assess the portfolio. The trend ratio uses the trend line to assess portfolios' daily expected return and daily risk. Preserving the benefits of the Sharpe ratio, the trend ratio is defined as the daily expected return divided by the daily risk, and the overestimated and underestimated situations are both considered portfolio risks. Because the risk in the trend ratio is defined as the residual to the trend line, the trend ratio can assess a stable uptrend portfolio as low risk. Then, the portfolio performance can be evaluated more accurately. Furthermore, there is another drawback to the Sharpe ratio. Because it uses the risk calculation in the MPT model, the variance and covariance calculation cannot fully represent the interaction among more than two stocks in a portfolio. It can only calculate each pair of stocks in the portfolio to roughly represent the interaction. Moreover, the risk computation re-quires N 2 calculations, with each computation similar to the standard deviation. To address this problem, funds standardization [23] was proposed. Funds standardization converts all stock price decreases and increases into fund fluctuations, and then the interaction among all stocks in a portfolio can be fully represented in fund variation. Moreover, the risk computation of the standard deviation is also reduced to 1 calculation.
In addition to the mean-variance model, many models have been proposed to evaluate portfolio performance. The study [39] designs a Hidden Markov Model to construct an asset using return probability density function by Gaussian mixtures. The studies [40]- [43] use the value at risk (VaR) model, which is the maximum money lost under a given probability, to assess the portfolio risk. The studies [44], [45] use the improved VaR, which is called the conditional value at risk (CVaR) model, to assess portfolio risk. They focus on how much money the investment will lose under a given probability.
The assumption of the return in MPT excludes short selling. However, short selling is also a common and legal trading method in the stock market. Short selling is a trading method in which security is borrowed from a stock vendor and sold later with the hope that the security's price will fall, allowing investors to repay the borrowed security at a lower price and make a profit. In addition, the collateral used to borrow security for short selling is not restricted to cash under Taiwan regulations. In other words, investors may use the same value of securities as collateral to borrow securities for short selling. The studies [46]- [53] focus on the short selling influence in the stock market. The study [46] indicates that a ban on short selling is detrimental to market liquidity. Moreover, the study [47] provides proof that short selling exists in assets and is allowed with equilibrium and satiation. The study [49] refers to margin trading and short selling playing an important role, and the implementation of these two methods can help stock liquidity and render the market more stable. The study [51] further proves that short selling can reduce investment risk. Therefore, this paper considers both the long-and short selling trading methods to reduce portfolio risk.
In recent works, money management is an important issue. Some studies [54]- [56] about the Kelly criterion proposed to optimize capital growth performance by diversifying the portfolio and controlling the loss. Considering the non-invest part into the portfolio solution space may be a general way to optimize the portfolio to diversify the investment. Sometimes when the stock market is not suitable for investment, investors will be more likely to preserve their funds in the form of a certificate of deposit rather than investing to reduce investment risk. The study [57] proves that including a certificate of deposit as an investment choice is a wise strategy. Preserving funds using a certificate of deposit when the time is not suitable for investment can effectively reduce investment risk. Because preserving funds can allow buying securities in batches, it can average the cost and lower the VOLUME x, 2021 investment risk.
To find long and short selling portfolios, the solution space is too large to be exhausted by the brute-force method. Therefore, computational intelligence (CI) is a commonly used technique for finding an optimal solution. The evolutionary algorithm (EA) is a powerful CI technique, and it is also a metaheuristic algorithm that can be applied in different kinds of problems [58], [59]. The studies [23], [24], [29], [52], [53], [57], [60]- [68] utilize an EA to optimize the stock selection problem. The studies [53], [60]- [62] use particle swarm optimization (PSO) to identify the best performance portfolio. The study [63] improves the differential evolutionary algorithm (DE) as discrete-continuous encoding to optimize the model that it proposed, and it uses the fundamental and technical indicator to score the portfolio and then select the top m ranking stock to formulate an equal-weighted portfolio. The study [29] optimizes the portfolio by evolutionary strategy hall-of-fame (ES HOF), and it constrains the portfolio cardinality, which means that it constrains the number of stocks in the portfolio. The study [64] considers complex constraints with basic, bounding, cardinality and class constraints to perform the portfolio construction, and the kmeans cluster method is used to eliminate the cardinality constrained to reach diversification. Portfolio optimization is a combinatorial problem, and the genetic algorithm (GA) is a form of binary encoding that is suitable for solving the portfolio optimization problem in many studies [23], [24], [52], [65], [66]. The study [23] uses GA and the Sharpe ratio to solve the portfolio optimization problem. The study [65] applies multistage to select the stocks in a portfolio via investor information k-means clustering and then utilizes GA to optimize the portfolio weights through return or the Sharpe ratio. The study [66] uses GA to optimize the threshold parameters of the GAORB strategy with the protective closing strategy and then decides the intraday trading with the long or short position. The studies [53], [57], [67] also use a binary encoding method and an emerging branch quantuminspired algorithm, the quantum-inspired tabu search algorithm (QTS), to solve portfolio optimization efficiently. QTS can simultaneously approach the best solution and be far from the worst solution.
This paper uses the novel assessment strategy trend ratio and the effective evolutionary algorithm to optimize portfolio performance in uptrend and downtrend conditions. The trend ratio is calculated based on funds standardization; therefore, the risk calculation must only perform one standard deviation-like computation. To optimize the portfolio performance, the trend ratio simultaneously maximizes the expected return and minimizes the risk. Additionally, this paper simultaneously invests in not only a long selling portfolio but also a short selling portfolio by single investment funds. Among all the metaheuristic evolutionary algorithms, this paper proposes the effective and efficient improved GNQTS to find the approximate optimal solution. By using the GNQTS to optimize the portfolio performance, this paper derives a portfolio combination that has the optimal trade-off between return and risk.

A. MODERN PORTFOLIO THEORY
Modern portfolio theory (MPT) [1] was proposed by Markowitz in 1952. MPT assumes that investors have a riskaverse nature. When two stocks with the same return are presented, investors choose the one with less risk, and when two stocks with the same risk are presented, they choose the one with a higher return. To make an efficient investment, investors invest in two or more stocks at the same time to form a portfolio that reduces risk more than a risky stock and enhances the return more than a low return stock. Assume that there are N stocks in a portfolio, and the funds are distributed among these N stocks. The weights of the stocks are w 1 , w 2 , w 3 , . . . , w N , and the weights sum to 1, as shown in Equation 1. The portfolio expected return on investment (ROI) is calculated by the weights and the expected return of stocks, as shown by Equation 2, where E(r p ) is the portfolio expected return, and r (i) is the expected return of the i th stock. In MPT, the risk is defined as variance, and the interaction between two stocks is the covariance. Equation 3 defines the risk calculation, where σ p is the portfolio risk, while σ ij is the covariance of stock i and stock j.

B. FUNDS STANDARDIZATION
The mean-variance model in MPT calculates the portfolio evaluate risk by the standard deviation. However, when there are multiple stocks in a portfolio, the traditional method will assess the volatility of the separate stocks by their variance and the covariance between pairs of stocks in a portfolio. Assume that there are three stocks, A, B and C, in a portfolio, and the risk evaluation is shown in Equation 4. Generally, MPT assumes that the risk of a portfolio is the summation of the risk of every stock, as shown in Equation 3. However, this formula only works when the final goal is to counteract the risk to be a flat average line. When the stocks have contrary trends along to a line with a slope, they can still counteract the risk as an uptrend stock complementing the deficiency of downtrend stock with its positive return and vice versa. The risk definition in MPT will misjudge a situation with high risk. As Fig. 1 shows, the symmetry of uptrend and downtrend stock can form a stable uptrend portfolio because of the counteraction of the increasing and decreasing situations. In addition, the covariance can assess only the interaction between two stocks due to the mathematical definition. The interaction among more than three stocks can be calculated only by rough estimation and cannot be fully expressed. Furthermore, the covariance with each pair of stocks in the portfolio creates a high computational cost, N 2 calculations. To address these problems, funds standardization [23] has been proposed to represent full interaction among the portfolios. Funds standardization converts the fluctuation of stock prices into funds fluctuations and then assesses portfolio performance more precisely. The funds fluctuation shows the result after counteracting the interaction with all the stocks in a portfolio. The funds standardization in the portfolio has only one sequence, and it can calculate only 1 standard deviation to represent every stock interaction. The risk calculation is from N 2 quantity into 1. Furthermore, the fund fluctuation can also express the mood swings of investors and properly consider the comprehensive interactions of stocks in a portfolio. With its great ability to evaluate portfolios, funds standardization helps investors find a low-volatility portfolio.

C. SHARPE RATIO
When investing in the stock market, investors depend on an assessment indicator to determine whether a stock is worth investing in. The Sharpe ratio [2], [3] is an extensively used indicator for evaluating return and risk, and it was proposed by William F. Sharpe, who won the Nobel Memorial Prize in Economics Science. The Sharpe ratio is a representative index while assessing stocks, as its concept is expected return per unit of risk and it is designed to recognize stocks with low risk and high return, meaning that the higher the Sharpe ratio is, the better the portfolio is. Equation 5 shows how the Sharpe ratio is calculated, where E(r p ) is the portfolio's expected return, R f is the risk-free rate of interest and σ p is the portfolio risk.
The Sharpe ratio defines risk by the standard deviation, which is the difference from the average line. The risk is the deviation between the daily funds standardization and the average line, and the dotted line represents the risk in the Sharpe ratio. Using the standard deviation as risk considers a downtrend portfolio as high risk. However, the uptrend portfolio is also considered high risk, as shown in Fig. 2. The uptrend portfolio is what the investor wants; thus, the design of the Sharpe ratio violates the expectations of investors. Therefore, in this paper, we propose a novel assessment indicator, the trend ratio, to not only meet the expectations of investors but also assess portfolio performance more accurately as a fairer indicator.

IV. BASIC CONCEPT
The Sharpe ratio will misjudge the uptrend portfolio as high risk. Therefore, the trend ratio is proposed to assess portfolio risk more accurately and more consistently with the expectations of investors. The design of the trend ratio follows the spirit of the Sharpe ratio. The core difference is that the trend ratio assesses the portfolio performance by the trend line. When the portfolio trend deviates from the trend line, it is seen as volatility in the trend ratio, which is risky. The trend ratio considers the return and risk simultaneously, and it also uses division to calculate. Furthermore, to fairly compare different lengths of the period, the trend ratio uses the daily expected return divided by daily risk, as shown in Equation 6, indicating the daily expected return per unit of daily risk.
The trend ratio uses the trend line as a comparison criterion. The deviation between the real data point and the point at the trend line is the risk, while the daily expected return is the slope of the trend line, as shown in Fig. 3. In the trend ratio assessment, a stable uptrend portfolio is not misjudged as having high volatility.  The trend line is calculated by simple regression, indicating the overall portfolio trend. However, when using simple regression, the beginning of the trend line is different from the initial fund, which leads to an unfair comparison between portfolios. Therefore, the portfolio trend is estimated using the initial investment funds as the y-intercept of the trend line, and it is a fairer comparison of the different investment funds. Thus, Equation 7 shows the calculation of the trend line, where y i is the expected funds standardization on the i th day, m is the slope of the regression after initial funds are considered, x i represents the i th day, and c is the initial investment funds. The slope where the y-intercept is considered as the initial investment fund is calculated as Equation 8. Furthermore, in the trend ratio, the daily expected return and the daily risk assessment are according to the trend line. Therefore, the portfolio's daily expected return is also the slope of the trend line as Equation 8 shows. The portfolio's daily risk is the daily fluctuation between the funds standardization of the portfolio and the trend line, given by Equation 9.
The innovative assessment of the trend ratio still preserves the core concept that investors are risk averse, which MPT assumes. With a given level of return, investors prefer a lowrisk portfolio; investors prefer a high-return portfolio under a given level of risk. As shown in Fig. 4, under the same risk (the same volatility), the red portfolio has a higher daily expected return than the blue portfolio because of the steeper slope of the trend line; therefore, the trend ratio assessment of the red portfolio will be higher in the long selling investment. Under the same condition, the short selling investment derives the same effect in finding the downtrend portfolio. In Fig. 4, the blue portfolio and yellow portfolio have the same volatility. However, the yellow portfolio has a higher, steeper slope than the blue portfolio; therefore, the trend ratio assessment of the yellow portfolio is better than that of the blue portfolio in the short selling investment.
In another situation, under the same expected return (the same slope of the trend line) in Fig. 5, the red portfolio has lower risk because its volatility to the trend line is smaller; thus, the red portfolio derives a higher trend ratio FIGURE 4: Portfolios with the same volatility and different risks in long and short selling investments. The red uptrend portfolio is assessed with a high return in long selling, and the yellow downtrend portfolio is assessed with a high return in short selling. Regardless of long or short selling, the blue flat portfolio is a low return portfolio. FIGURE 5: Portfolios with the same return and different risk in long and short selling investment. In long selling investment, the red portfolio, LSLR (long selling portfolio with low risk), is assessed with a low volatility and performs better than the blue portfolio, LSHR (long selling portfolio with high risk). In the downtrend portfolio, the green portfolio, SSHR (short selling portfolio with high risk), is riskier than the yellow portfolio, SSLR (short selling portfolio with low risk), and the yellow portfolio can derive better performance in short selling. than the blue portfolio. By using the trend ratio, investors can correctly choose the higher return and lower risk portfolio. Identically, in short selling investments, the yellow portfolio and green portfolio have the same expected return, and the trend ratio can identify a better downtrend portfolio. When investors make short selling investments, they still want the portfolio to decrease stably and not have large volatility. Thus, the trend ratio assessment of the yellow portfolio is better than that of the green portfolio because it has less volatility to the trend line.
Short selling still requires a stable downtrend portfolio, in contrast to long selling, which requires a stable uptrend portfolio. Therefore, this paper can accurately find both a better uptrend and a better downtrend portfolio by the trend ratio. Then, the stable uptrend portfolio in the long selling portfolio can be collateral as the margin to the vendor, and the stable downtrend portfolio in the short selling portfolio can be borrowed to earn the profit of the difference. By this mechanism, investors can separately invest in the portfolios using one fund and reduce the investment risk.

V. PROPOSED METHOD
To solve the stock selection problem and choose potential stocks, this paper includes long and short selling with the trend ratio, certificates of deposit, GNQTS, and sliding windows to help investors make wise investment decisions. The trend ratio can correctly consider portfolio risk and return because the trend ratio does not misjudge a portfolio's trend. Using the trend ratio, investors can find high-return and lowrisk portfolios. This paper also includes the certificate of deposit, deposit for short in this context, as a choice for investors when the market is not suitable for investment. Since this paper does not restrict the number of stocks in a portfolio and the search space is too large to be exhausted, this paper proposes GNQTS to find the best portfolio effectively. To correctly analyze historical stock information and avoid overfitting and underfitting problems, we use a sliding window to find the proper investment period.

A. SHORT SELLING WITH THE TREND RATIO
When investors invest in the stock market, an assessment strategy is needed to evaluate stocks. This paper proposes a novel assessment strategy, namely, the trend ratio, in assessing the uptrend and downtrend portfolios. Instead of misjudging a flat trend as a good trend like the Sharpe ratio, the trend ratio can correctly assess the trend of a stock or portfolio. Before the trend ratio is calculated, the funds standardization of the portfolio is calculated using the daily stock price. The mechanism, funds standardization, reflects all of the relationships of stocks in the portfolio and reduces the calculation complexity when calculating portfolio risk. With funds standardization, a trend line is then calculated using linear regression. The daily expected return on the portfolio is the slope of the trend line, and the daily risk is the deviation between the funds standardization and the trend line. The trend ratio is the daily expected return per daily risk. When two portfolios have the same risk, the trend ratio of the portfolio with a higher return is better; when two portfolios have the same return, the trend ratio of the portfolio with lower risk is better. Therefore, the trend ratio will not misjudge the portfolio trend when the portfolio is either uptrend or downtrend.
The stock market does not remain stable; stock prices oscillate regularly. It is suitable to be involved in normal trading (long selling) when the stock market is in an uptrend. When the market is in a downtrend, short selling is suitable, which is investing in a downtrend portfolio. When investors predict that a stock will go down, they will borrow the stock from a stock vendor at a relatively high point and sell the stock. When the stock goes down and hits a relatively low point, investors will buy the stock back and return it to the lender and earn the difference. Short selling does not mean that investors choose portfolios with poor performance that have a high risk or low return. They still want to choose stable downtrend portfolios with a high trend ratio but with low risk and a high price difference.
When investors need to borrow stocks from a stock vendor in the Taiwan stock market, they need a margin as collateral.
In addition to using money as a margin, investors can use equal value collateral, including the equal value of stocks, to borrow stocks from stock vendors. The stock market oscillates and is unpredictable. This mechanism enables investors to use a sum of money to invest in both normal trading and short selling at the same time instead of choosing either normal trading or short selling only. By investing simultaneously in normal trading and short selling, investors can earn with both trading methods to enhance the return and reduce the risk of investment.

B. DEPOSIT
This paper proposes an additional choice in the investment targets, the deposit, to spread the portfolio risk and earn further interest by preserving part of investment funds. When the stock market is unstable and is not appropriate for investment, our system could not find a portfolio to recommend for investment. At this point, investors have stagnant funds. In our previous research, we found that there are also some circumstances that require investors to protect part of their funds to gain better investment results, which means that not all investment circumstances involve all investors' funds, and they will have some unused funds. Therefore, investors should save their unused funds in a bank certificate of deposit to earn interest. In addition, a deposit helps when the market is inappropriate for investment and can be chosen as a part of a stable uptrend or stable downtrend portfolio to lower the portfolio risk. The preserved funds can buy securities in batches and then average the cost to lower investment risk. This practice enhances the portfolio performance and derives a higher trend ratio, which results in a higher return per unit risk. This paper performs long and short selling simultaneously with single funds. Thus, when there is no uptrend portfolio, which means that the stocks are all decreasing, the best investment choice for long selling is a deposit. Preserving funds can still be used as a margin for investing in a stable downtrend portfolio in short selling to earn profits.

C. GLOBAL-BEST GUIDED QUANTUM-INSPIRED TABU SEARCH ALGORITHM WITH NOT-GATE (GNQTS)
There are thousands of stocks in the stock market, and choosing an investment portfolio is complicated. Further, in this paper, we do not limit the number of stocks in a portfolio, and the search space is too large to be exhausted. Hence, this paper uses the quantum-inspired tabu search (QTS) to help investors find the best portfolio. QTS is an efficient algorithm that simultaneously moves individuals toward the best solution and away from the worst solution. QTS is inspired by the quantum mechanism and is a probabilitybased algorithm. The core of QTS is the beta-matrix, which influences the convergence and quality of solutions. The probability in the beta-matrix is updated depending on the best solution and the worst solution, making QTS powerful and efficient. However, QTS has some defects. First, the VOLUME x, 2021 best solution in each generation, which is used to update the probability of choosing a stock, decreases the power of intensification. Second, when QTS jumps out of local optima, it requires many generations to reach the latest optima. To solve these problems, this paper proposes utilizing the current best-known solution and the quantum NOT-gate to update the beta-matrix and improve QTS. The best solution in every generation might be different, and the beta-matrix probability will be updated to different solutions with every different best solution in every generation. With the best solution replaced by the current best-known solution as update dependent, the beta-matrix probability can be intensively updated accordingly. When the algorithm is stuck in local optima, it requires many generations to jump out of the local optima, and the process consumes many resources. This paper proposes the quantum NOT-gate to enable QTS to jump out of local optima quickly when the algorithm is stuck. In other words, the current bestknown solution enhances the intensification ability of QTS, and the quantum NOT-gate increases the ability of QTS to jump out of the local optima. The QTS that is improved by the current best-known solution and quantum NOT-gate is called the global quantum-inspired tabu search with a NOT-gate, or GNQTS. GNQTS shows better and more stable performance in searching for potential solutions than QTS. The applied flow of GNQTS is that it is initialized at first and then does the following recursive step: measurement, calculating fitness, and update, until the terminated criterion is met. The pseudocode of the proposed method is provided in Algorithm 1.

1) Representation
The length of the solution is the number of stocks in the GNQTS encoding. Each solution represents a portfolio, and each bit is a stock. The paper utilizes a binary array (0 s and 1 s) to show whether a stock is selected in a portfolio. As shown in Fig. 6, there are 6 stocks can be selected. The states of the first, fourth and sixth stocks are 1, which means that in this solution, stocks with codes 1101, 4904 and deposit are selected. Stocks 2330, 3045, and 9904 are at 0 states, which means not selected into this portfolio. Hence, the investment funds are equally divided between stock 1101, 4904 and deposit. This paper does not restrict the number of stocks in a portfolio or the limitation of the stock combination; therefore, all the situations in the solution space can be considered comprehensively.

2) Initialization
GNQTS is a quantum-inspired algorithm. It carries the characteristics of a quantum bit. A quantum bit has some unusual phenomena, such as a superposition, in which a quantum bit exists in the 0 and 1 states at the same time, as Equation 10 shows. α 2 and β 2 are the probabilities of a quantum bit being 1 and 0, respectively. Therefore, GNQTS is also a probability-based algorithm. Because the summation of the probability of being 1 and 0 should be one, the design of GNQTS only records the probability of being 1, which is β 2 and is called the beta-matrix in GNQTS. The length of a betamatrix is the number of stocks that can be selected since it is an array of the probability of selecting stocks. When there are k stocks that can be chosen, each stock's probability of being selected in the beta-matrix is b 1 , b 1 , . . . , b k . Since there is no information about the best combinations of stocks at the start of the algorithm, the initial probability of every stock being selected is 0.5, half to be selected and half not being selected, just as Fig. 7 shows.

3) Measurement
To form a solution, each stock must be either selected or not selected. Therefore, in measurement, a random number is generated and is compared to the probability in the betamatrix to determine whether the bit is 0 or 1, which is not selected or selected, respectively. A random number is generated for every bit and is compared to the probability of every stock in the beta-matrix. The solution is then formed according to Equation 11, where S i is the state of the i th stock. An example of measurement is shown in Fig. 7. If the probability of the beta-matrix is greater than or equal to the random number, the stock is included in the portfolio; and if the probability of the beta-matrix is smaller than the random number, the stock is not included in the portfolio.

4) Update
The fitness in this paper is the trend ratio, whether in the long selling portfolio or the short selling portfolio. In QTS, the beta-matrix of every bit in the solution is altered according to the best solution and the worst solution in each generation. However, since the best solution in each generation changes rapidly, rendering the algorithm difficult to converge. Thus, the current best-known solution is used to replace the best solution in each generation and then enhance the intensification ability to cause the algorithm to find a better solution in fewer generations. With increasing generations, the probability of the current best-known solution increases, and choosing the worst solution decreases. Equation 12 shows how the betamatrix is updated. The probability of each bit in the betamatrix is updated by an angle, θ, as shown in Fig. 8. After several iterations, some beta-matrix values converge and are close to 1 or 0, indicating that the stock apparently must be included or not in a portfolio.
bi + θ, f or bsi = wsi and bsi = 1 bi − θ, f or bsi = wsi and bsi = 0 bi, f or bsi = wsi (12) When the algorithm jumps out of local optima, QTS requires many generations to update to the new optima. To dynamically update the beta-matrix, we utilize the quantum NOT-gate (QN gate). When the probability of any bit in the solution does not correspond to the current best-known solution and the worst solution in generations, the probability will change. The quantum NOT-gate can exchange the probability of being 1 and 0, indicating that, the probability of being 0 changes to β 2 , and the probability of being one changes to α 2 in Equation 13. When the quantum NOT-gate is applied in GNQTS, the mathematical instruction is in Equation 14, as shown in Fig. 9. By using the current best-known solution and the quantum NOT-gate to update the beta-matrix, the GNQTS can effectively search for potential solutions.

D. SLIDING WINDOW
There is considerable historical information about stock prices in the stock market, and some stocks undergo economic cycles. Analyzing this information helps investors to determine a good investment strategy. However, overfitting and underfitting are common problems when analyzing historical data. This paper utilizes the sliding window to retain fresh data by sliding the training period and choosing an appropriate length to find an optimal investment strategy. Different lengths of sliding windows lead to different performances. In this paper, we propose 13 types of sliding windows to split the time series into the common segment: month (M), quarter (Q), half year (H), and a year (Y). The sliding window is divided into three categories: symmetry (Y2Y, H2H, Q2Q, M2M), asymmetry (Y2H, Y2Q, Y2M, H2Q, H2M, Q2M), and year-on-year (H*, Q*, M*). The purpose of introducing year-on-year sliding windows is that some industries undergo economic cycles. It is more appropriate to use the stock information from the same period from a year before for analysis. Considering Q* as an example, the training result is obtained from the first quarter of 2019 and is tested in the first quarter of 2020. The difference between the year-on-year sliding window and symmetry sliding window is shown in Fig. 10.

VI. EXPERIMENTAL RESULT
This paper uses the trend ratio and GNQTS to find the best portfolio for both long selling and short selling in the training periods, and invests in the testing periods. The trend ratio calculates the portfolio return and risk according to the portfolio trend. To search for the best portfolio in a large solution space VOLUME x, 2021 and with limited time, this paper uses GNQTS to find the best long selling and short selling portfolio effectively. This paper also uses different training and testing periods to determine the appropriate quantity of historical data required in the training period and the length of the testing period to ensure that the portfolio remains in an uptrend. The investment target of this paper is chosen from Taiwan's 50 largest market capitalization stocks, which are the constituents of Taiwan's 50 ETF. By using the trend ratio, GNQTS can find the best portfolio for long selling and short selling. This section analyzes the experimental results and compares the results shown by the trend ratio and the Sharpe ratio [2], [23].

A. INVESTMENT TARGET
Taiwan's stock prices often fluctuate with international trends. Thus, Taiwan's stock market is a representative market and worthy of research. This paper chooses the constituent stocks of the Taiwan 50 ETF as the investment target in the experiment. The Taiwan 50 ETF is an exchange-traded fund, and the constituent stocks are verified every quarter by the Taiwan Stock Exchange (TWSE) and FTSE. Taiwan 50 ETF is composed of Taiwan's top fifty firms by market capitalization, and they represent more than 70% of the market value in the Taiwan stock market. Therefore, these fifty firms are very important to Taiwan stock analysis, and they are suitable as our experimental target. Furthermore, in addition to the constituent's stock being chosen in a portfolio, on deposit can also be chosen as a stock to keep funds when the market is too risky for investment.

B. EXPERIMENTAL ENVIRONMENT
The source of stock prices in our experiment is the Taiwan Economic Journal (TEJ), and the investment period is from 2010 to 2017. The funds in a portfolio are equally distributed. This paper not only finds a stable uptrend portfolio for long selling but also simultaneously finds a stable downtrend portfolio for short selling. In Taiwan, regulations allow the use of money or securities as collateral to make a short selling investment. Therefore, we can use the investment funds first to buy the long selling portfolio and then use the securities of the long selling portfolio as collateral to borrow the short selling portfolio to perform long and short selling at the same time. This paper uses GNQTS to search for the best portfolio for long and short selling. The parameters setting in GNQTS is shown as Table 1. The trend ratio can assess the downtrend portfolio for short selling and the uptrend portfolio for long selling. The comparison performance of the short selling portfolio changes to positive expected return value to reflect the real return that investors earn.

C. COMPARISON WITH THE SHARPE RATIO
The risk definition in the Sharpe ratio is the standard deviation, which means the difference to the average line. Thus, a stable uptrend and downtrend portfolio will be recognized as high risk. However, the trend ratio evaluates the portfolio by the portfolio trend line. Therefore, a stable uptrend and downtrend portfolio can be recognized as low risk, and it is more consistent with the investor's expected psychology. This paper compares the performance between the Sharpe ratio [2], [23] and trend ratio by risk and portfolio trends in both long and short selling in the experimental analysis. This paper compares the portfolio and the single stock selected by the Sharpe ratio and the trend ratio in short selling. The experimental result compares the best portfolio and the single best stock performance in the trend ratio and the Sharpe ratio. By converting short selling performance into a positive return, the downtrend portfolio in short selling with a greater difference derives a high return because it sells securities at a high point and buys them back at a low point. This paper also compares the best risk and the trend ratio performance of a single stock and the best portfolio searched by GNQTS in short selling. Fig. 11 shows the risk and return per unit of risk comparison between the best portfolio and the best single stock in the trend ratio and the Sharpe ratio separately. We find that the risks of the 13 types of sliding windows in the portfolio are lower than that of the single stock in both the trend ratio and the Sharpe ratio. Moreover, the risk in the trend ratio is lower than the Sharpe ratio, and even the risk of the single stock in the trend ratio is similar to the portfolio in the Sharpe ratio. This result demonstrates scientific proof of the saying "Do not put all your eggs in one basket", whether they are chicken eggs or duck eggs. Not only does the long selling investment need to spread risk using a portfolio, but the short selling investment also requires a portfolio to spread risk. Regardless of the trend ratio or the Sharpe ratio, the risk in the portfolio is lower than the single stock. In addition, the shorter training period derives a lower risk than the longer training period.
In comparison, Fig. 11 also shows that the trend ratio can derive a higher return per unit of risk than the Sharpe ratio in both the best portfolio and the best single stock. The portfolio selected by the trend ratio is better than the single stock; i.e., the portfolio derives a higher daily expected return per unit of daily risk. Furthermore, M2M derives a higher trend ratio than the other sliding windows, and the sliding window with the economic cycle, M*, Q*, and H*, also achieves a good performance.
We also conducted the statistical testing t-test to prove the spreading risk effectiveness. The mathematical instruction of the t-test is calculated by Equations 15 and 16 to get the t-value and degree of freedom and then obtain the corresponding critical value and the probability distribution. The p-value is obtained by calculated the cumulative probability that below the t-value. The µ is the mean value of the target, S is the standard deviation, and the n is the data number.
The portfolio selected by trend ratio (Portfolio T) can assess a more stable portfolio than selected by the Sharpe ratio (Portfolio S). Tables 2 and 3 conducted the t-test to test the risk performance between the trend ratio and the Sharpe ratio. The null hypothesis H 0 of the testing is that the mean of the portfolio risk of the trend ratio (TR) is larger than or equal to the portfolio risk of the Sharpe ratio (SR), which supposes µ P ortf olio T ≥µ P ortf olio S . The alternative hypothesis H A is that the mean of the portfolio risk of the trend ratio (TR) is less than the portfolio risk of the Sharpe ratio, which supposes µ P ortf olio T < µ P ortf olio S . The risk is the lower, the better. Table 2 shows the t-test result of the average risk in 13 sliding windows, and Table 3 shows the t-test result of the risk in all periods. The p-values of the statistical testing are 5.66E-4 and 9.35E-36, and they are both far less than 0.05. The risk performance in the trend ratio is significantly lower than the Sharpe ratio. Furthermore, the statistical test result of trend ratio performance between portfolio S and portfolio T is shown in Table 4. Table 4 shows that the p-value of the average trend ratio in all the periods is 8.11E-19, where the null hypothesis H 0 is µ P ortf olio T ≤µ P ortf olio S . Not only the risk but also the balance between risk and return, the trend ratio both have significant improvement than the Sharpe ratio. We can conclude that our proposed method significantly improves the existing method in the average and statistical testing results. Fig. 12 shows the portfolios selected by the trend ratio and Sharpe ratio in the long selling (LS) and short selling (SS)  Simultaneously, the stable downtrend portfolio is identified for SS investment. The trend line is still steeper and better, and the volatility to the trend line is lower and better. In Fig. 12, the result shows that the trend ratio has a better ability to select a stable downtrend portfolio than the Sharpe ratio. Portfolio S in SS is rather stationary, and the trend line is flatter than portfolio T in SS. Regardless of whether long or short selling, the Sharpe ratio can only find the flat portfolios near the average line. However, the trend ratio not only can search for a stable uptrend portfolio in the long selling investment but also can search for a stable downtrend portfolio in the short selling investment.

D. THE PERFORMANCE OF SHORT SELLING AND LONG SELLING
The experimental target is the stock of the constituents of the Taiwan 50 ETF, representing the companies with the top fifty market values in Taiwan. Therefore, the increasing trend is larger than the decreasing trend. In the same period, some stocks increase, and other stocks decrease. Investors usually tend to choose either short selling or long selling. However, FIGURE 12: Portfolios T and S are selected by the trend ratio and the Sharpe ratio separately in the long and short selling investments. They are both the optimal portfolios in 2010 of Y2Y. Regardless of long or short selling, the trend of portfolio T is clearly better than that of portfolio S. our proposed method can invest both the long selling portfolio and the short selling portfolio with the same funds at the same time, not the half funds. First, GNQTS searches for the best uptrend and downtrend portfolios separately and then uses the uptrend portfolio as collateral for the downtrend portfolio. In this way, we can use funds to invest in both long selling and short selling portfolios at the same time. Fig. 13 shows the daily expected return performance of both the long selling and the short selling portfolios. Because this paper uses single funds to invest in two kinds of investments simultaneously, the daily expected return can be added together as the total daily expected return. Fig. 14 shows the trend ratio of both the long and short selling investments. As mentioned above, the going uptrend is larger than the going downtrend. Thus, the trend ratio of the long selling portfolio is higher than that of the short selling portfolio. Nevertheless, our proposed method can derive profits in both the uptrend and downtrend, and investing in both of them can at least break even.

1) The effectiveness of a deposit option
This paper also compares the portfolios with and without a deposit solution space in the trend ratio to observe the effectiveness of the deposit. The deposit option is proposed in this paper to spread investment risk. Therefore, Fig. 15 shows the risk and trend ratio comparison of the best portfolios selected by trend ratio with and without a deposit in the short selling investment. In 13 types of sliding windows, the risk of the trend ratio with a deposit is lower than the trend ratio without a deposit option. The deposit is a kind of capital management to balance the portfolio risk and return by preserving some funds not to invest. Therefore, the deposit can bring the advantage to substantially lower the portfolio risk when comparing to without deposit method. The null hypothesis H 0 of the testing is that the mean of the portfolio risk with deposit is larger than or equal to the portfolio risk without deposit, which supposes µ with deposit ≥ µ without deposit . The alternative hypothesis H A is that the mean of the portfolio risk with deposit is less than the portfolio risk without deposit, which supposes µ with deposit < µ without deposit . The risk is the lower, the better. Tables 5 and 6 demonstrate the t-test results of the average risk in 13 sliding windows and the risk in all periods, respectively. The p-values of the statistical testing are 2.29E-3 and 4.18E-14, and they are both less than 0.05. The t-test results show the portfolio with a deposit obtains a significant improvement in risk performance than the portfolio without a deposit choice. Furthermore, the trend ratio is also elevated in 660 periods out of 664, which means 99.40% of periods are improved with the deposit choice. Clearly, the deposit can effectively spread the portfolio risk even on the short selling investment. The best portfolio with deposits can substantially lower the risk; thus, the daily expected return per unit of daily risk is also increasing in all 13 types of sliding windows.    2) The components of the portfolio The solution space of the portfolio optimization is large; therefore, some studies may attempt to exclude some kinds of characteristic stock to reduce the solution space. The most commonly used assumption is to consider the top-ranked stock to formulate a portfolio; the negative return stocks are also excluded. Negative return stock in the short selling portfolio means that it is not a downtrend stock, and it cannot earn a profit through the short selling investment. In this manuscript, the rank is ordered by the trend ratio, and thus the highest trend ratio obtains a higher rank. Fig. 16 shows the stable downtrend portfolio, which contains the first rank stock, and the volatility of the portfolio is extremely low in the first half year (H1) 2011 of H2H. The number in parentheses is the rank of the single stock, and the first rank stock in H1 2011 of H2H is 2409. The portfolio trend in Fig.  16 is similar to the first rank stock and the lower volatility by interacting with other stocks in the portfolio. All of the stocks in this portfolio form a stable downtrend. However, the portfolio that our proposed method establishes in October 2012 of M2M illustrates a counterexample to the former assumption. In Fig. 17, the approximate optimal portfolio in this period still derives a stable downtrend with low volatility to the trend line, but the stocks of constituents of the portfolio do not include the first rank stock. There is another counterexample to the previous assumption. Fig. 18 shows a stable downtrend portfolio composed of six stocks, and there is a stock with a negative return in the short selling investment; it is 2347, which is the green line in Fig. 18.
The portfolios are chosen automatically by GNQTS, and if the first rank stock is included, or the negative return stocks are excluded, it does not elevate the trend ratio in these examples. Therefore, the solution space cannot be reduced by any assumption; otherwise, the optimal portfolio will be excluded.
3) The same components' stock in the long selling and short selling investments Furthermore, our method can identify the long selling portfolio and the short selling portfolio separately. In the experimental analysis, this paper finds that some stocks may be in both the short selling and long selling portfolios during the same period. Our proposed method does not set any constraints when searching the portfolio combination. The effective metaheuristic algorithm, GNQTS, can help us find a stable uptrend or downtrend portfolio when assessing with the trend ratio. Regardless of whether a stock with a positive or negative return is acceptable, all of the stocks in the portfolio that GNQTS searched are needed to construct a stable, profitable portfolio. There are some different situations when having the same stock in both short and long selling portfolios. In Fig. 19 and 20, there is an overlapping stock, 2412 (Chunghwa Telecom). Chunghwa Telecom is one of the largest communication companies in Taiwan, and its trend is more stable than that of other stocks. Therefore, both long and short selling portfolios contain 2412 to reduce portfolio risk, forming a portfolio with a stable trend with less volatility. Because the stock number of the long and short selling portfolio is different, 2412 is allocated a different amount of money. The increases and decreases in 2412 are the same in the long and short selling portfolios. The following examples of the same components in both the long and short selling portfolios are the same situation; they actually have the same increases and decreases. VOLUME x, 2021   21 is the long selling portfolio that contains 8 stocks in the portfolio, and 2498 is an uptrend stock to increase portfolio return. In Fig. 22, the navy blue line, 2498 with a negative return, is also present in the short selling portfolio, and 2498 is selected to lower risk in this situation. Because the trend ratio considers return and risk simultaneously, both kinds of stocks for elevating return and for reducing risk are needed in the portfolio to formulate a stable uptrend or downtrend in the long or short selling portfolio. Because our method does not provide any constraints, the collocation of the stocks is automatically chosen by the evolutionary algorithm. The algorithm will select the best combination to obtain the highest trend ratio and formulate a stable uptrend and downtrend portfolio. Thus, all the combinations are possible, and the optimal solution can be identified. Regardless of whether the stock has a positive or negative return, once collocation with other stocks can derive a stable portfolio, the stock will be chosen. Furthermore, the deposit aims to break even when the stock market is decreasing; however, this paper finds that the deposit can retain funds and reduce risk. It can further elevate the daily expected return per unit daily risk.

VII. CONCLUSION
This paper proposes the trend ratio to assess uptrend and downtrend portfolios more accurately through the trend line. The trend ratio follows the spirit of the Sharpe ratio to calculate the return and risk with division. However, the risk in the trend ratio is the deviation from the trend line, and it renders the stable uptrend portfolio with low volatility more consistent with the expectations of investors. Hence, the trend ratio is a remarkable indicator that outperforms the traditional portfolio optimization model. In addition to long selling, this paper adopts short selling as another investment method. Undertaking long and short selling simultaneously can increase profit and spread risk. In addition, this paper combines the deposit as an investment choice. The result shows that including the deposit can spread risk. Since this paper does not limit the number of stocks in a portfolio, the solution space is too massive to be exhausted. This paper uses GNQTS to find the best combination of stocks in a complicated solution space. The paper uses 13 types of sliding windows to keep training data fresh and avoid underfitting and overfitting problems. For some industries that undergo economic cycles, this paper includes year-on-year sliding windows. The experimental result finds that the best length for investment is M2M in the trend ratio assessment. Furthermore, the experimental results show that the trend ratio can truly derive better performance than the Sharpe ratio. The portfolio selected by the trend ratio can form a stable uptrend. The results also prove that investing in a portfolio can simultaneously spread risk and increase profit in short selling, providing scientific proof for not putting all of one's eggs in one basket. Furthermore, the experimental results also show that the solution space cannot be reduced arbitrarily. The first ranked stock is not necessary, and negative return stock is also necessary in some circumstances in both long and short selling portfolios. The trend ratio considers both the return and risk; therefore, the best portfolio assessed by the trend ratio is on the efficient frontier. As a result, the proposed method can select a stable uptrend and downtrend portfolio, and compared to the Sharpe ratio, it shows promising results in the experiments. In our future work, considering the money management in our proposed method is an important issue to diversify the investment more generally than the equally weighted funds.