Trading Cryptocurrencies Using Second Order Stochastic Dominance

: This research is the ﬁrst attempt to customize a trading system that is based on second order stochastic dominance (SSD) to ﬁve known cryptocurrencies’ daily data: Bitcoin, Ethereum, XRP, Binance Coin, and Cardano. Results show that our system can predict price trends of cryptocurrencies, trade them proﬁtably, and in most cases outperform the buy and hold (B&H) simple strategy. Our system’s best performance was achieved trading XRP, Binance Coin, Ethereum, and Bitcoin. Although our system has also generated a positive net proﬁt (NP) for Cardano, it failed to outperform the B&H strategy. For all currencies, the system better predicted long trends than short trends. January 2015 for Bitcoin and the beginning of May 2018 for Cardano until the end of September 2021. Results show that our system can predict price trends of cryptocurrencies and in most cases outperform the B&H simple strategy. Our system’s best performance was achieved trading XRP, Binance Coin, Ethereum, and Bitcoin. Although our system also generated a positive NP for Cardano, it failed to outperform the simple B&H strategy. For all currencies the system better predicts long trends than short trends. The best short trends predicted were achieved trading XRP and the worst trading Cardano. Future research can try to predict cryptocurrency prices using stochastic behaviors and try to predict intraday price movements using those behaviors.


Introduction
The use of algorithmic trading systems is widespread among investment houses and professional traders who uses algorithmic trading as their major investment tool. In recent years, investors have realized that those systems are necessary for processing efficiently a huge amount of financial data and replace many hours of human analysis. Researchers and practitioners have tried to identify cryptocurrencies' price behaviors and by doing so improve their ability to forecasts future prices. Different processes were used to identify and forecasts cryptocurrencies' price behaviors, including linear and nonlinear and other technical tools. This research makes the first attempt to predict price trends of major cryptocurrencies using second order stochastic dominance (SSD) conditions. The concept of stochastic dominance arises in decision analysis in situations where one probability distribution over possible outcomes can be ranked as superior to another. Our aim is to detect stochastic dominance superiority changes and exploit them for profitable trading. We tested our system for five major cryptocurrencies: Bitcoin, Ethereum, XRP (Ripple), Binance Coin, and Cardano. Cryptocurrency such as Bitcoin is traded on special exchanges including Etoro and CoinBase. The biggest exchange in the world by far is called Binance. That exchange has developed its own cryptocurrency called Binance Coin to make it easier to pay for the exchange services, and this currency held in 2021 the third largest market value of all cryptocurrencies. Cardano was launched in 2017 as a third generation blockchain that aimed to directly compete with other decentralized platforms as a more scalable, secure, and efficient alternative. By August 2021, Cardano had the third highest market value after Bitcoin and Ethereum. We found that the system can predict price trends of cryptocurrencies, trade them profitably, and in most cases outperform the buy and hold (B&H) simple strategy.

Literature Review
Researchers have documented that the cryptocurrency market is largely affected by herding behavior (Vidal Tomas et al. [1]; Gama Silva et al. [2]); therefore, techniques such as machine learning and technical analysis improve price forecasting when they integrate additional variables related to sentiment (see for example Ortu et al. [3]). Because of this market behavior, some trading algorithms combines market data with social media data (Liu [4], Sohangir et al. [5]). The social media information is extracted mainly 2 of 10 from Google and Twitter along with popular investor idea exchange platforms such as Seeking Alpha (https://seekingalpha.com/Seekingalpha.com, accessed on 1 November 2021) and Investopedia (https://www.investopedia.com/, accessed on 1 November 2021). Kim et al. [6] tried to predict fluctuations in the prices of cryptocurrencies by analyzing comments in online communities. They found that positive comments significantly affected the price fluctuations of Bitcoin, whereas the prices of two other cryptocurrencies, Ripple (XRP) and Ethereum, were strongly influenced by negative comments. Garcia and Schweizer [7] also demonstrated the existence of a relationship between returns and Twitter valence and polarization. Matta et al. [8] reported significant cross correlation values between the volume of online searches and Bitcoin's trading volume.
In contrast to stock markets, cryptocurrencies are less regulated and therefore carry extra risks (Baek and Elbeck [9]). In such a dynamic trading environment, algorithmic trading systems can provide fast and useful information (Chow et al. [10]; Liu et al. [11]; Cohen [12]; Cohen [13]). Balcilar et al. [14] found that when extreme events are excluded, volume is an important predictor of Bitcoin's price. Brandvold et al. [15] investigated the role of various of cryptocurrency exchanges in the price discovery process and concluded that information sharing is dynamic and evolves significantly over time. Feng et al. [16] found evidence of informed trading in the Bitcoin market prior to major events. Moreover, they noticed that informed traders prefer to build their positions two days before large positive events and one day before large negative events. This result serves as proof of market inefficiency that differentiates uninformed traders from informed traders.

Data and Methodologies
Our data consisted of daily price and returns of the five most popular cryptocurrencies that are valued together at more than $1.5 trillion (at the end of August 2021). The time scope for this research varied from the beginning of January 2015 for Bitcoin and the beginning of May 2018 for Cardano until the end of September 2021. We programed a trading system that uses second order stochastic dominance (SSD) to predict short term price trends of the examined crypto currencies. SSD implies that if two separate distributions A and B exist, A has a second order stochastic dominance over B if A holds less risk in terms of particle variations and has at least as high mean value. Concerning the cumulative distribution functions F A and F B , a is second order stochastic dominant over B if the area under F A from minus infinity to x is less than or equal to the area under F B for all x (Equation (1)).
where t = particle at time t, of the stochastic distribution. The necessary conditions for second order stochastic dominance are given in Equation (2): The SSD requirements fit trading, since investors rely heavily on the financial asset distribution function when they make investment decisions, and in that process, they usually put more weight on the downside of the investment opportunity since they are guided by fear of loss and risk aversion. In a recent study, McCarthy and Hillenbrand [17] found that extrapolative beliefs and risk aversion are important drivers of stock prices, together explaining 86% of movements in the S&P500 index.
To allow a stronger impact of a new price information over an old one, we used Exponential Moving Average (EMA x ) instead of E A (x), as noted in Equation (3).
3 of 10 where EMA x = current exponential moving average, R(x) = today's return, EMA x−1 = yesterday's exponential moving average return, N = number of days of the EMA, and k = 2 N+1 . We then integrated Equations (2) and (3) to produce long and short trading signals. A long signal is generated if the following conditions are met (Equation (4)): A short signal is generated if the following conditions are met (Equation (5)): Figure 1 shows a bar chart of Bitcoin against the U.S. dollar, demonstrating that in an uptrend, the average daily return is growing along with a higher minimum daily return. On the other hand, a downtrend is characterized with lower average and lower minimum daily returns.
found that extrapolative beliefs and risk aversion are important drivers of stock prices, together explaining 86% of movements in the S&P500 index.
To allow a stronger impact of a new price information over an old one, we used Exponential Moving Average ( ) instead of ( ), as noted in Equation (3).
where = current exponential moving average, ( ) = today's return, = yesterday's exponential moving average return, N = number of days of the EMA, and = .
We then integrated Equations (2) and (3) to produce long and short trading signals. A long signal is generated if the following conditions are met (Equation (4)): > and ≥ A short signal is generated if the following conditions are met (Equation (5)): < and ≤ (5) Figure 1 shows a bar chart of Bitcoin against the U.S. dollar, demonstrating that in an uptrend, the average daily return is growing along with a higher minimum daily return. On the other hand, a downtrend is characterized with lower average and lower minimum daily returns. Each bar in Figure 1 contains information of the open, close, high, and low of the daily prices. A long red bar symbolizes a large daily price drop, and a long red bar symbolizes a major price rise. The system is designed to buy or sell one cryptocurrency at a time for easy comparison to the buy and hold (B&H) strategy. A specific number of days is entered into the system for it to calculate two consecutive EMAs and distributions and to establish whether the SSD condition of the current distribution over the latter exists. If such dominance is recognized, the system generates long or short trade. Once a position is realized, the system will stay in that position until an opposite dominance occurs. This trading system is highly sensitive to the range of days for which the SSD and EMAs are calculated. When it relies on a large number of days for those calculations, the number of executed trades drop dramatically, since it becomes difficult to recognize a continuous Each bar in Figure 1 contains information of the open, close, high, and low of the daily prices. A long red bar symbolizes a large daily price drop, and a long red bar symbolizes a major price rise. The system is designed to buy or sell one cryptocurrency at a time for easy comparison to the buy and hold (B&H) strategy. A specific number of days is entered into the system for it to calculate two consecutive EMAs and distributions and to establish whether the SSD condition of the current distribution over the latter exists. If such dominance is recognized, the system generates long or short trade. Once a position is realized, the system will stay in that position until an opposite dominance occurs. This trading system is highly sensitive to the range of days for which the SSD and EMAs are calculated. When it relies on a large number of days for those calculations, the number of executed trades drop dramatically, since it becomes difficult to recognize a continuous trend for every financial asset and especially for cryptocurrencies that are characterized with frequent trend shifts. Therefore, we altered the number of days systematically starting with one day until the number of recorded trades dropped to zero. We then reported the results of the best setups that produced the highest net profit (NP) generated by the trading system and the Profit Factor (PF), which is the gross profits divided by gross losses. For example, if the profit factor is 1.3, the system generated 30% more profits than losses. In order to document the downside risk, for each strategy, we calculated Maximum Draw Down (MDD), which is the maximum observed loss of a single trade without taking into consideration the frequency of large losses. Since the cryptocurrencies market varies dramatically over time because of its complexity and relatively infancy (see, for example, Fry and Cheah [18]; Fry [19]), we followed the changes of the average NP and MDD per trade over time for each cryptocurrency. Moreover, we also separated all trades to long and short trades to find out whether our system has different forecasting power for uptrends and downtrends.

Results
We start our results section by examining Figure 2, which represents Bitcoin price movement for a two-month random sample. Figure 2 show that the Bitcoin price oscillated at a reasonable scope before hitting a sharp movement because of a major outside shock, and then its volatility quadrupled in the next coming days.
with frequent trend shifts. Therefore, we altered the number of days systematically starting with one day until the number of recorded trades dropped to zero. We then reported the results of the best setups that produced the highest net profit (NP) generated by the trading system and the Profit Factor (PF), which is the gross profits divided by gross losses. For example, if the profit factor is 1.3, the system generated 30% more profits than losses. In order to document the downside risk, for each strategy, we calculated Maximum Draw Down (MDD), which is the maximum observed loss of a single trade without taking into consideration the frequency of large losses. Since the cryptocurrencies market varies dramatically over time because of its complexity and relatively infancy (see, for example, Fry and Cheah [18]; Fry [19]), we followed the changes of the average NP and MDD per trade over time for each cryptocurrency. Moreover, we also separated all trades to long and short trades to find out whether our system has different forecasting power for uptrends and downtrends.

Results
We start our results section by examining Figure 2, which represents Bitcoin price movement for a two-month random sample. Figure 2 show that the Bitcoin price oscillated at a reasonable scope before hitting a sharp movement because of a major outside shock, and then its volatility quadrupled in the next coming days. The results of the SSD-based trading system of the five cryptocurrencies are summarized in Tables 1-5. The results reported in the tables are the best results our system achieved by altering the number of days until reaching the highest NP and PF. Each table also shows the dollar and percentage gap of the system's NP versus the B&H strategy for the entire examined period. Moreover, the tables also contain information about long and short trades for each cryptocurrency. The results of the SSD-based trading system of the five cryptocurrencies are summarized in Tables 1-5. The results reported in the tables are the best results our system achieved by altering the number of days until reaching the highest NP and PF. Each table also shows the dollar and percentage gap of the system's NP versus the B&H strategy for the entire examined period. Moreover, the tables also contain information about long and short trades for each cryptocurrency.    Table 1 demonstrates that the best setup for Bitcoin trading through our system is 13 days, producing 73,051 NP, which is 21% over the B&H strategy. The PF of this setup is 1.98, which means there are 98% more winning trades than loosing trades. The MDD calculations indicate that the trading strategy is least risky when it is based on 13 days. Table 1 also show that our SSD-based system better predicts Bitcoin's uptrends than downtrends. We also find high dependency of the system performance on its daily selected setup. Figure 3 show that the average NP and MDD per trade varies over time using the best setup for Bitcoin.  Table 1 demonstrates that the best setup for Bitcoin trading through our system is 13 days, producing 73,051 NP, which is 21% over the B&H strategy. The PF of this setup is 1.98, which means there are 98% more winning trades than loosing trades. The MDD calculations indicate that the trading strategy is least risky when it is based on 13 days. Table  1 also show that our SSD-based system better predicts Bitcoin's uptrends than downtrends. We also find high dependency of the system performance on its daily selected setup. Figure 3 show that the average NP and MDD per trade varies over time using the best setup for Bitcoin.   Table 2 summarizes the results of our system for Ethereum trades.     Table 2 summarizes the results of our system for Ethereum trades. Table 2 demonstrates that Ethereum price trends changed slower than did Bitcoin's. The best trend prediction was achieved using a 24 day setup for Ethereum compared to 13 days for Bitcoin. Using a 24 day setup, our system produced 4741 NP, which is 26.7% more than the B&H strategy and $199 MDD. The PF at this setup is 2.54, which represents Mathematics 2021, 9, 2861 7 of 10 154% more winning trades than loosing trades. Moreover, our system results are more robust for Ethereum trades than for Bitcoin trades. Again, as for Bitcoin, the system predicts better Ethereum long trends than short trends. Figure 4 demonstrates the average NP and MDD per trade varies over time using the best setup for Ethereum.  Table 2 demonstrates that Ethereum price trends changed slower than did Bitcoin's. The best trend prediction was achieved using a 24 day setup for Ethereum compared to 13 days for Bitcoin. Using a 24 day setup, our system produced 4741 NP, which is 26.7% more than the B&H strategy and $199 MDD. The PF at this setup is 2.54, which represents 154% more winning trades than loosing trades. Moreover, our system results are more robust for Ethereum trades than for Bitcoin trades. Again, as for Bitcoin, the system predicts better Ethereum long trends than short trends. Figure 4 demonstrates the average NP and MDD per trade varies over time using the best setup for Ethereum.  Figure 4 shows that the highest ANP and MDD per trade were achieved in 2021. These results reflect the large appreciation in the Ethereum price during 2021 and the ability of our system to detect uptrends. Table 3 summarizes the results of our system for XRP trades.  Table 3 shows that our system outperformed the B&H strategy by 502% ($2) with $0.21 MDD, for the 13 days setup, making the system a better fit for XRP trends prediction   Figure 4 shows that the highest ANP and MDD per trade were achieved in 2021. These results reflect the large appreciation in the Ethereum price during 2021 and the ability of our system to detect uptrends. Table 3 summarizes the results of our system for XRP trades. Table 3 shows that our system outperformed the B&H strategy by 502% ($2) with $0.21 MDD, for the 13 days setup, making the system a better fit for XRP trends prediction than for Bitcoin or Ethereum. The system is robust for 12 to 17 day setups, resulting in 1.57 average PF. As for the Bitcoin and Ethereum, the XRP system better predicts long trends than short trends. Figure 5 shows the average NP and MDD per trade varies over time using the best setup for XRP.
Mathematics 2021, 9, x FOR PEER REVIEW 7 of 10 than for Bitcoin or Ethereum. The system is robust for 12 to 17 day setups, resulting in 1.57 average PF. As for the Bitcoin and Ethereum, the XRP system better predicts long trends than short trends. Figure 5 shows the average NP and MDD per trade varies over time using the best setup for XRP.  Figure 5 shows that as the price of the XRP appreciated in the market, our system better generated profits and was subjected to higher risks (ANP of 0.063 and MDD of 0.21). Table 4 summarizes the results of our system for Binance Coin trades.  Figure 5 shows that as the price of the XRP appreciated in the market, our system better generated profits and was subjected to higher risks (ANP of 0.063 and MDD of 0.21). Table 4 summarizes the results of our system for Binance Coin trades. Table 4 shows that the SSD system fits to trade Binance Coin. The best setup was 26 days, resulting in $826 NP, which represents a 74.7% return over the B&H strategy and $20.8 MDD. Setups from 23 to 28 days produced better results than the B&H strategy by more than 50%. The system performances are excellent for long trades (PF = 10.55 for the 26 day setup) and good for short trades (PF = 2.06 for the 26 day setup). Figure 6 show that the average NP and MDD per trade varies over time using the best setup for XRP.  Figure 6 show that the main profits were accumulated by our system in 2021. From January 2021 till the end of September 2021, the Binance Coin rose from $42 to $387.5 (822%). The MDD also rose dramatically in 2021, indicating the higher risk involved in trading the Binance Coin using our system. Table 5 summarizes the results of our system for Cardano trades.  Table 5 shows that the system's best performance was achieved using a much longer period than the other examined cryptocurrencies and with worse results. The best result was achieved using a 53 day setup, which was $1.76 NP and which was beaten by the B&H strategy by 4.8% and $0.31 MDD. Although the system generated positive NP for long trades, it generated net losses for all short trades. Figure 7 demonstrates that the average NP and MDD per trade varies over time using the best setup for Cardano. Figure 7 show that in 2021, our system's performance and risk rose dramatically in comparison to 2019 and 2020. The ANP was $0.1 compared to $0.03 and $0.02 in 2019 and 2020, respectively. The MDD also rose to $0.31, signaling that the risk involved in trading  Figure 6 show that the main profits were accumulated by our system in 2021. From January 2021 till the end of September 2021, the Binance Coin rose from $42 to $387.5 (822%). The MDD also rose dramatically in 2021, indicating the higher risk involved in trading the Binance Coin using our system. Table 5 summarizes the results of our system for Cardano trades. Table 5 shows that the system's best performance was achieved using a much longer period than the other examined cryptocurrencies and with worse results. The best result was achieved using a 53 day setup, which was $1.76 NP and which was beaten by the B&H strategy by 4.8% and $0.31 MDD. Although the system generated positive NP for long trades, it generated net losses for all short trades. Figure 7 demonstrates that the average NP and MDD per trade varies over time using the best setup for Cardano. Figure 7 show that in 2021, our system's performance and risk rose dramatically in comparison to 2019 and 2020. The ANP was $0.1 compared to $0.03 and $0.02 in 2019 and 2020, respectively. The MDD also rose to $0.31, signaling that the risk involved in trading rose dramatically. Mathematics 2021, 9, x FOR PEER REVIEW 9 of 10

Conclusions and Future Research
This research is the first attempt to design and test cryptocurrency trading systems based on second order stochastic dominance. The time scope used in this research varies from the beginning of January 2015 for Bitcoin and the beginning of May 2018 for Cardano until the end of September 2021. Results show that our system can predict price trends of cryptocurrencies and in most cases outperform the B&H simple strategy. Our system's best performance was achieved trading XRP, Binance Coin, Ethereum, and Bitcoin. Although our system also generated a positive NP for Cardano, it failed to outperform the simple B&H strategy. For all currencies the system better predicts long trends than short trends. The best short trends predicted were achieved trading XRP and the worst trading Cardano. Future research can try to predict cryptocurrency prices using stochastic behaviors and try to predict intraday price movements using those behaviors.