Forex Stop Loss Percentage Deep Reinforcement Learning High Frequency Trading
0
ajax_fade,page_not_loaded,,qode_grid_1300,footer_responsive_adv,qode-content-sidebar-responsive,qode-theme-ver-1.4,wpb-js-composer js-comp-ver-5.1,vc_responsive

Forex stop loss percentage deep reinforcement learning high frequency trading

Forex Algorithmic Trading: A Practical Tale for Engineers

Finally, it is possible to create a more-optimized pairs-trading strategy by continuously changing the discrete set of window sizes and boundaries. To start, you setup your timeframes and run your program under a simulation; the tool will simulate each tick knowing that for each unit it should open at certain price, close at a certain price and, reach specified highs and lows. If the spread touches the trading boundary but fails to return to the average, the strategy may end up with a profit or a loss. There are two key research questions posed. From these models, they achieved a trading strategy with a minimum level of profits protected from risk of loss. In such a situation, investors are at high risk are there commissions on dividends stocks trading stocks just by price action they cannot close the portfolio. The hedge ratio is determined based on the window size. In this study, the pairs-trading strategy is therefore considered as a kind of game; closing a portfolio yields a positive reward and a portfolio that reaches its stop-loss threshold yields a negative reward. We can estimate from the following equation by taking a partial derivative: The value obtained from equation 5 is used for the number of stock orders. Average top-5 performance results of the proposed method and the traditional pairs-trading strategy in the out-of-sample dataset using OLS. My First Client Around this time, coincidentally, I heard that someone was trying to find a software developer to automate a template for cryptocurrency exchange how to mine for ethereum coinbase trading. Algorithm 1. The idea of reinforcement learning is to find an optimal policy which maximizes the expected sum of discounted future rewards [ 31 ]. The Traditional Pairs-Trading Strategy Pairs trading is a representative market-neutral trading strategy which simultaneously longs an undervalued stock and shorts an overvalued stock. This particular science is known as Parameter Optimization. We investigate not only the dynamic boundary based on a spread in each trading window—which can achieve higher profit than the fixed boundary used in traditional pairs trading strategy—but also if it is possible to train deep reinforcement learning methods to follow this mechanism. Understanding the basics. In addition, [ 17 ] suggested the Ornstein-Uhlenbeck process to make a market microstructure noise used as a trading signal in pairs trading strategy. Assume that, and are an independent variable, a dependent variable, and an error term. It is also based on the belief that historical price movements will not change significantly in the future. In addition, we can see that profitability gradually increases as the estimation windows and trading windows of methods using TLS and OLS decreased. Tables 6 and 7 show the average performance values of the formation windows and trading windows in the training dataset. We check cant verify coinbase app device bittrex enhanced verification again experiment results based on profit, maximum drawdown, and the Forex stop loss percentage deep reinforcement learning high frequency trading ratio. In the early days, pairs-trading methods were popular because of the opportunity to obtain arbitrage profit [ 1 — 4 ].

Learn to swing trade bitcoin questrade broker review estimates parameters to minimize the sum of the measured forex stop loss percentage deep reinforcement learning high frequency trading and the vertical distance between regression lines [ 30 ]. The agent is trained to select the optimum level of discretized trading and stop-loss boundaries given a spread to maximize the expected sum of discounted future profits. First, they reduced relative replay size to fit financial trading. In regression analysis, OLS is widely used to estimate parameters by minimizing the sum of the squared errors [ 29 ]. This was back binary options guy instaforex pamm rating my college days when I was learning about concurrent programming sell bitcoin for how to put money into bitcoin account Java threads, semaphores, and all that junk. In this study, we set a trading cost of 5 bp; equation 21 is almost the same as equation 19but it does not include absolute value, and is trading cost. Building your own FX simulation system is an excellent option to learn more about Forex market trading, and the possibilities are endless. Goetzmann, and K. We investigate not only the dynamic boundary based on a spread in each trading window—which can achieve higher profit than the fixed boundary used in traditional pairs trading strategy—but also if it is possible to train deep reinforcement learning methods to follow this mechanism. We also find that the ratio of portfolio exits to open portfolio positions slightly increased. Cui, Y. The stop-loss limit is the maximum amount of pips price variations that you can afford to lose before giving up on a trade. Forex traders make or lose money based on their timing: If they're able to sell high enough compared to when they bought, they can turn a profit. You may think as I did that you should use the Parameter A. MT4 comes with an acceptable tool for backtesting a Forex trading strategy nowadays, there are more professional tools that offer greater functionality.

Throughout the trading window, we executed a strategy similar to a traditional pairs-trading strategy using the action selected. Download other formats More. They used the daily closing price data from January 2, , to June 30, , of seven pairs of stocks on the Australian Stock Exchange. First, we propose a novel method to optimize pairs trading strategy using deep reinforcement learning, especially deep Q-networks with trading and stop-loss boundaries. In this case, this regression must be checked to determine whether it is a spurious regression or cointegrated. However, we set a reward function if spread is suddenly high, and our network is trained to prevent this situation by taking less stop-loss boundary since it is trained to maximize the expected sum of future rewards. It should be noted that the present work is a part of the Master thesis [ 24 ]. In other words, you test your system using the past as a proxy for the present. Wang, S. Figure 7. In particular, we set the pairs-trading system to be a kind of game and obtain the optimal boundaries, trading thresholds, and stop-loss thresholds according to the calculated spread. Precup, and D. Second, we can use other statistical methods such as the Kalman filter and error-correction models to use diversified spreads. It may be divided into headed subsections if several methods are described. We can estimate from the following equation by taking a partial derivative: The value obtained from equation 5 is used for the number of stock orders. View at: Google Scholar Y. References E. View at: Google Scholar G.

Financial Networks 2019

They used the Ornstein-Uhlenbeck process to calculate spread as a trading signal and tested their model with simulated data; the results showed that their strategy performs well. In this study, the pairs-trading strategy is therefore considered as a kind of game; closing a portfolio yields a positive reward and a portfolio that reaches its stop-loss threshold yields a negative reward. They applied Q-learning to a trading system to trade automatically. Wang, S. Nowadays, there is a vast pool of tools to build, test, and improve Trading System Automations: Trading Blox for testing, NinjaTrader for trading, OCaml for programming, to name a few. From the experimental results, we show that our method can be applied in the pairs trading system. This was back in my college days when I was learning about concurrent programming in Java threads, semaphores, and all that junk. They set a delta price using data from the past days, had three discrete action spaces buy, hold, and sell , and used long-term profit as a reward. Lin, and C. Sign Me Up Subscription implies consent to our privacy policy. Since the vertical distance does not change when the X and Y coordinates are changed, the value of is calculated consistently. For convenience, we represent the error variance ratio in equation 10 : The orthogonal regression estimator is calculated by minimizing the sum of the measured distance and the vertical distance between regression lines in equation 11 : The value obtained from equation 12 is used in the same way as that obtained from equation 5 and the epsilon value is also used as a trading signal through the Z-score in the state composed of the formation-window size. The classical method adds stop-loss boundaries to the closed-loop method. In the case of the DQN, two hidden layers are set up and the number of neurons is optimized by taking half of input size through trial and error. View at: Google Scholar Y. The best choice, in fact, is to rely on unpredictability.

The epsilon value is also used as a trading signal through Z-scoring, in the state composed of the formation-window size. If a low boundary is set, the loss will be small. Reference [ 22 ] proposed a deep Q-trading system using reinforcement learning methods. We therefore conducted five trials with different random seeds. The difference between these methods lies in the spreads: different results can be obtained depending on the spreads used. This optimal action-value function can be formulated as the Bellman equation. The authors declare that there are no conflicts of interest regarding the publication managed forex service put option strategies for smarter trading pdf this paper. In this case, this regression must be checked to determine whether it is a spurious regression or cointegrated. During active markets, there may be numerous ticks per second. Lin, and C. Chen, J. First, because the stock price follows a random walk [ 32 ], we need to ensure that it follows brokerage account for young professional the vanguard group stock ticker process through the augmented Dickey-Fuller test. Second, regression analysis such as ordinary least squares OLStotal least squares TLSand error correction models ECM is used to calculate the spread of these stocks.

My First Client

Rad, R. However, all this assumes that mean reversion occurs. Profit is commonly used as a performance measure for trading strategies. We will attempt to implement an optimal pairs-trading strategy by taking optimal trading and stop-loss boundaries that correspond to the given spread, since performance depends on how trading and stop-loss boundaries are set in pairs trading [ 14 ]. In this study, we use the cointegration approach to choose pairs which have long-term equilibrium. Gao, and L. Nowadays, there is a vast pool of tools to build, test, and improve Trading System Automations: Trading Blox for testing, NinjaTrader for trading, OCaml for programming, to name a few. I did some rough testing to try and infer the significance of the external parameters on the Return Ratio and came up with something like this:. The performance is similar between two approaches. For example, if the trading signal reaches the threshold, we short one share of the overvalued stock represented as and long shares of the undervalued stock represented as. In this situation, the spread between two stocks is extremely large. Reinforcement learning basically solves the problem defined by the Markov decision process MDP. We can see that the PTDQN returns are higher than the strategy with the highest return among the traditional pairs trading strategies that take the constant action. During slow markets, there can be minutes without a tick. Sign Me Up Subscription implies consent to our privacy policy. Table 1. This result can also serve as a basis for judging whether the proposed model is being trained properly. Trading windows are constituted using half of the formation-window size. Before we start our proposed method, we set a replay memory and batch size and select pairs using the cointegration test.

This was back in my college days when I was learning about concurrent programming in Java threads, semaphores, and all highest dividend for stocks the best penny stock apps junk. If a low boundary is set, the loss will be small. Introduction Pairs trading is a method for obtaining arbitrage profit when there is a statistical difference between two stocks with similar characteristics that are cointegrated or highly correlated. The mechanism of pairs trading is as follows. View at: Google Scholar E. Furthermore, after the portfolio is opened, if the trading signal is not reversed to mean during the trading window, the portfolio is closed by force; this is called the exit position of the portfolio. The reason is that although the ratio of closed position portfolio is the lowest in what we set formation and trading windows, the ratio of stop-loss position portfolio is also the lowest compared with other formation and trading windows. We check our experiment results based on profit, maximum drawdown, and the Sharpe ratio. In OLS, when one side is the reference, the relative change of the other side is estimated. The Materials and Methods section should contain sufficient details so ichimoku charts by ken muranaka pdf ninjatrader ordering routing system unavailable all procedures can be repeated. More related articles. They compared their proposed model with a constant parameter model, which was similar to a traditional pairs-trading strategy. The experimental results show that our method can be applied in the pairs trading system and also to various other fields, including finance and economics, when there is a need to optimize a rule-based strategy to be more efficient. It may be divided into headed subsections if several methods are described. Second, regression analysis such as ordinary least squares OLStotal least squares TLSand error correction models ECM is used to calculate the spread of these stocks. In this study, we optimize the pairs-trading strategy with a type of game using the DQN. In other words, you test your system using best price action traders gold abbreviation stock market past as a proxy for the present. This boundary is a criterion for deciding whether to execute a pairs-trading strategy. The movement of the Current Price is auto trend line indicator ninjatrader automated trading strategies forum a tick. However, it can be a stationary relationship if the nonstationary variables are cointegrated.

Subscription implies consent to our privacy policy. The client wanted algorithmic trading software built with MQL4a functional programming language used by the Meta Trader 4 platform for performing stock-related actions. As you might expect, it addresses some of MQL4's issues and comes with more built-in functions, which makes life easier. The reason for this trade pro academy course forex charts gbp aud based on the difference between the hedge ratios of the two methods. The start function is the heart of every MQL4 program since it is executed every time the market moves ergo, this function will execute once per tick. Hakimian, K. In this study, the pairs-trading strategy is therefore considered as a kind of game; closing a portfolio yields a positive reward and a portfolio that reaches its stop-loss threshold yields a negative reward. They wanted to trade every time two of these custom indicators can i purchase bitcoin in my 401k account sell bitcoin from ledger wallet, and only at a certain angle. Pairs trading is a representative market-neutral trading strategy which simultaneously longs an undervalued stock and shorts an overvalued stock. To investigate these questions, we collected pairs selected using the cointegration test. View at: Google Scholar V.

We will solve these difficulties in future studies. Many come built-in to Meta Trader 4. They used the Ornstein-Uhlenbeck process to calculate spread as a trading signal and tested their model with simulated data; the results showed that their strategy performs well. The main contributions of this study are as follows. Technical Background 2. Kavukcuoglu, D. They used normalized US stock price data from to to test the profitability of pairs trading. This 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. This is a subject that fascinates me. It can be applied in various fields, including finance and economics, when there is a need to optimize the efficiency of a rule-based strategy. Faff, and K. Therefore, we tried to optimize pairs trading strategy with various trading and stop-loss boundaries using deep reinforcement learning and our method outperforms rule-based strategies. The proposed method can be applied to other pairs of stocks found in other global markets.

Complexity

The lengths of the window sizes such as the formation window and trading window are selected from the performance results with the training dataset. Technical Background 2. The data used to support the findings of this study have been deposited in the figshare repository DOI: First, a pair of stocks with similar trends is identified. Elliott, J. This 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. The spread obtained here is used as a state when applying reinforcement learning i. Since all variables are regarded as endogenous variables, there is no need to select dependent variables and multiple cointegration relationships are identified. Zhang, Y. We also find that the ratio of portfolio exits to open portfolio positions slightly increased. The mechanism of pairs trading is as follows. The experimental data comprised tick-by-tick data of 12 forex currency pairs from January to December Thinking you know how the market is going to perform based on past data is a mistake. Second, we propose an optimized dynamic boundary based on a spread in each trading window.

Table 4. This network is trained by minimizing a sequence of loss functionswhich changes with each sequence of. First, we used different spreads calculated using OLS and TLS to see how the results differ depending on the spread used for input. In equation 23is the expected sum of portfolio returns and is the risk-free rate; we set this value to 0 and is the standard deviation of portfolio returns. Goetzmann, and K. Di Pietro, and M. We experimented with how the results varied according to the spread stockcharts technical analysis trade with technicals analysis udemy review the method used. View at: Google Scholar V. They used normalized US stock price data from to to test the profitability of pairs trading. Third, they used long sequences as reinforcement data to conduct recurrent neural network training. From PTA0 to PTA5, the trading boundary and the stop-loss boundary grew larger; the numbers of open and closed portfolios and portfolios that reached their stop-loss thresholds are reduced. In OLS, when one side is the reference, the relative change of the other side is estimated.

The performance is similar between two approaches. There are two key research questions posed. Therefore, our proposed method can minimize the risk when the economic risks appeared compared with traditional pairs trading strategy with fixed boundary. It consists of a tuplewhere is a finite set of states, is a finite set of actions, is a state transition probability matrix, is a reward function, and is a discount factor. The classical method adds stop-loss boundaries to the closed-loop method. Nachtsheim, J. In turn, you must acknowledge this unpredictability in your Forex predictions. Leung and X. We therefore set the DQN to learn by positively rewarding it if it takes a closed position and negatively rewarding it if it reaches the why does coinbase charge so much to send bitcoin bcash support or exit thresholds. Additionally, we included the corresponding profit or loss value to reflect that weight after the trading ended. Pairs trading uses two types of stock which have the same trends. In addition, we can see that the trading signals made with the TLS method are better than those made with the OLS method in all six of the discrete window sizes. Do and R. Reference [ 14 ] suggested taking a minimum-profit condition, which could be efficient to reduce losses in a pairs-trading. We set a total of six discrete window sizes to obtain the optimal window size for the experiment. The DQN is therefore trained to prevent portfolios from reaching their stop-loss thresholds the more important objective over exiting. In the early days, pairs-trading methods were popular because of the opportunity to obtain arbitrage profit [ 1 — 4 ]. For example, if the trading signal reaches the threshold, we short one share of the overvalued stock represented as and long shares of the undervalued stock represented as. The Sharpe ratio is an indicator of the degree of excess profits from what is a forex islamic account gtc forex in risky assets used in evaluating portfolios [ 33 ]. Therefore, the performance of pair trading depends on how the boundary is set.

We will solve these difficulties in future studies. During active markets, there may be numerous ticks per second. The results showed that the action-augmentation technique yielded more profit than an epsilon-greedy policy. Since all variables are regarded as endogenous variables, there is no need to select dependent variables and multiple cointegration relationships are identified. Bachman, J. It can therefore be possible to create a better-optimized pairs-trading strategy by including all these other performance indicators as part of the objective function. View at: Google Scholar C. Li, X. From the experimental results, we show that our method can be applied in the pairs trading system. In particular, they focused on using the spread as a trading signal. Second, depending on the formation window and trading window, the spread and hedge ratio will be varied. Filter by. Elliott, J. In Figure 11 , we can see that our proposed method, PTDQN, outperforms the traditional pairs trading strategies that have constant actions in test dataset. If a low boundary is set, many strategies will be executed, but profits will be lower; if a high boundary is set, investors will get high returns when the strategy is executed.

Table 4. In environment , agent-observed state at time , action is selected. During economic issues uncertainties, it can be a risk to manage the pairs trading strategies including our proposed method. First, because the stock price follows a random walk [ 32 ], we need to ensure that it follows the process through the augmented Dickey-Fuller test. However, it can be broken due to various factors such as economic issues and company risk. This means that, even with the same spread, we can see how profit will change as the boundaries are changed. Lindberg, and J. The results showed that, as the open condition value decreases, the number of trades and profits increases. Figure 3 shows the mechanism of our proposed pairs-trading strategy. In this sense, taking the lowest stop-loss boundary is the best choice since it can be overcome with the least loss. It is calculated as the sum of returns taking into consideration trading cost. Figure 3. In Figure 11 , we can see that our proposed method, PTDQN, outperforms the traditional pairs trading strategies that have constant actions in test dataset. We investigate not only the dynamic boundary based on a spread in each trading window—which can achieve higher profit than the fixed boundary used in traditional pairs trading strategy—but also if it is possible to train deep reinforcement learning methods to follow this mechanism. Lu, and N. The mechanism of pairs trading is as follows. Kim, Optimizing the pairs trading strategy using Deep reinforcement learning [M.

View at: Google Scholar A. The crucial aspect of this method is the selection of optimal boundary in the spread that makes the highest profit in constant action, which is like a constant boundary. The lengths of the window sizes such as the formation window and trading window are selected from the performance results with the training dataset. If you want to learn more about the basics of trading e. Hong and R. It is possible that the rewards given for an open portfolio day trading school medellin fxcm create strategy compared to those given for a closed portfolio position are relatively small. Hakimian, K. In this case, this regression must be checked to determine whether it is a spurious regression or cointegrated. The main contributions of this study are as follows. These rewards how to invest 100 dollars in robinhood covering profits in stocks from selecting the optimal value of each action, called the optimal Q-value. Figures 5 — 8 show the changes in trading and stop-loss boundaries and the highest profit for constant action when applying the DQN method during the training period using OLS and TLS. It may be divided into headed subsections if several methods are described. Li, and Q.

Wang, D. It may be divided into headed subsections if several methods are described. View all results. Average top-5 performance results of the proposed method and the traditional pairs-trading strategy in the out-of-sample dataset using OLS. Published 12 Nov Table 4. For example, if the trading signal reaches the threshold, we short one share of the overvalued stock represented as and long shares of the undervalued stock represented as. Goetzmann, and K. During slow markets, there can be minutes without a tick. Additionally, we included the coinbase trade btc for eth bitflyer europe profit or loss value to reflect that weight after the trading ended. For example, if a portfolio is opened and closed by a boundary corresponding to action 0 within the same spread and if a portfolio is opened and closed how to exercise put option robinhood best consistent stocks a boundary corresponding to action 1, the corresponding profit is different.

We therefore conducted five trials with different random seeds. This strategy started from the idea that arbitrage opportunities exist when the price gap between two assets expands to or past a certain level. The Materials and Methods section should contain sufficient details so that all procedures can be repeated. However, as many investors including hedge funds sought these arbitrage opportunities by executing the pairs-trading strategy, its profitability began to deteriorate [ 5 , 6 ]. This network is trained by minimizing a sequence of loss functions , which changes with each sequence of. Kim, Optimizing the pairs trading strategy using Deep reinforcement learning [M. Average top-5 performance results of the proposed method and the traditional pairs-trading strategy in the out-of-sample dataset using OLS. View at: Google Scholar W. When this spread reaches the trading boundaries, the portfolio is opened and only closed when the spread returns to the average. Filter by. This can be explained when we check the ratio of the number of stop-loss portfolios. First, a pair of stocks with similar trends is identified. In this study, the pairs-trading strategy is therefore considered as a kind of game; closing a portfolio yields a positive reward and a portfolio that reaches its stop-loss threshold yields a negative reward. Academic Editor: Benjamin M. I did some rough testing to try and infer the significance of the external parameters on the Return Ratio and came up with something like this:. From these datasets, a pair of stocks will be selected during the training dataset period using the cointegration test. Reference [ 18 ] applied a cointegration method to Chinese commodity futures from to to check whether pairs trading was suitable in that market. And so the return of Parameter A is also uncertain. The reason for this construction is that if the portfolio is opened and closed in the trading window in the calculated spread, it will be unconditionally profitable if the portfolio is closed.

In addition, we use MLE to estimate the cointegration relation with the vector autoregression model and to determine the cointegration coefficient based on the likelihood-ratio test. In this study, we used the cointegration approach to select pairs of stocks. The hedge ratio is determined based on the window size. Mnih, K. Reinforcement learning basically solves the problem how to set stop loss in forex tester price by the Markov decision process MDP. Reference [ 14 ] suggested taking a minimum-profit condition, which could be efficient to garnmin intraday data candlestick trading course losses in a pairs-trading. Reference [ 10 ] used an N-armed bandit problem to optimize the pairs-trading strategy. In addition, [ 17 ] suggested the Ornstein-Uhlenbeck process to make a market microstructure noise used as a trading signal in pairs trading strategy. Subscription implies consent to our privacy policy. Thinking you know how the market is going to perform based on past data is a mistake. However, there is a risk when the spread does not reverse to the mean. In this situation, the spread between two stocks is extremely large. From these results, we take the optimum window size when we verify our proposed method in the test dataset. After executing the strategy, we obtain a reward based on the results of the portfolio. I did some rough testing to try and infer the significance of the external parameters on the Return Ratio and came up with something like this:. Gatev, W. We set a total of six discrete window sizes to obtain the optimal window size for the experiment. The study focused on only spreads made by two stocks, which have long-term equilibrium patterns.

In this study, we used the cointegration approach to select pairs of stocks. Figure 5 consists of the spread, trading, and stop-loss boundaries. Subsequently, if the spread reverses to the mean, investors will close the portfolios which are opposite position to the open portfolio. In addition, we can see that the trading signals made with the TLS method are better than those made with the OLS method in all six of the discrete window sizes. Average top-5 performance results of the proposed method and the traditional pairs-trading strategy in the out-of-sample dataset using OLS. As you might expect, it addresses some of MQL4's issues and comes with more built-in functions, which makes life easier. You also set stop-loss and take-profit limits. In particular, they focused on using the spread as a trading signal. The period of the training dataset is from January 2, , to December 31, , comprising data points; the test dataset covers the period from January 2, , to July 31, , comprising data points. There are two key research questions posed. Neely, and P. To conduct this experiment, we set up a formation window and a trading window. When this spread reaches the trading boundaries, the portfolio is opened and only closed when the spread returns to the average. Furthermore, the long-term equilibrium of a pair of stocks is an important characteristic for the execution of pairs trading. This does not necessarily mean we should use Parameter B, because even the lower returns of Parameter A performs better than Parameter B; this is just to show you that Optimizing Parameters can result in tests that overstate likely future results, and such thinking is not obvious. This particular science is known as Parameter Optimization. Maximum drawdown represents the maximum cumulative loss from the highest to the lowest values of the portfolio during a given investment period where is the value of the portfolio and is the terminal time value. Tourin and R. It may be divided into headed subsections if several methods are described.

If a low boundary is set, many strategies will be executed, but profits will be lower; if a high boundary is set, investors will get high returns when the strategy is executed. View at: Google Scholar V. The research in [ 15 ] compared the distance and cointegration approaches for each high-frequency and daily dataset to check whether it is profitable for Norwegian seafood companies. Kim, Optimizing the pairs trading strategy using Deep reinforcement learning [M. In addition, we provide a positive reward when the portfolio closes and a negative reward when the portfolio reaches the stop-loss threshold or exits. The weight of is updated as the sequence progresses:. In future works, we can develop our proposed model as follows. In particular, they focused on using the spread as a trading signal. To conduct this experiment, we set up a formation window and a trading window. However, losses are incurred when prices reach the stop-loss boundaries after the portfolio is opened and do not return to the average. Figure 3. Average top-5 performance results of the proposed method and the traditional pairs-trading strategy in the out-of-sample dataset using OLS.