Log in

UNSURE - A machine learning approach to cryptocurrency trading

  • Published:
Applied Intelligence Aims and scope Submit manuscript

Abstract

Although cryptocurrency trading can be highly profitable, it carries significant risks due to extreme price fluctuations and high degree of market noise. To increase profits and minimize risks, traders typically use various forecasting methods, such as technical analysis and Machine Learning (ML), but develo** effective trading strategies in noisy markets still remains a challenging task. Recently, Deep Reinforcement Learning (DRL) agents have achieved high performance on challenging tasks, including algorithmic trading, however it requires significant amount of time and high-quality data to train effectively. Additionally, DRL agents lack explainability, making them a less popular option for traders. The purpose of this paper is to address these challenges by proposing a reliable trading framework. Our framework, named UNSURE, generates high-quality features from candlestick data using technical analysis along with a novel parameterization method, and then exploits high price fluctuations by combining three ML components: A) Unsupervised component, which further improves feature quality by clustering market data; B) DRL component, which is responsible for training agents that open Buy or Short positions; C) Supervised component, which estimates price fluctuations in order to open and close positions efficiently, while reducing trading uncertainty. We demonstrate the effectiveness of this approach on nine cryptocurrency markets using several risk-adjusted performance metrics.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Subscribe and save

Springer+ Basic
EUR 32.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or Ebook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Algorithm 1
Algorithm 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11

Similar content being viewed by others

Availability of data and material

All data and materials required for this research are provided alongside with the code.

Code Availibility

Custom code.

Notes

  1. Candlestick data describe the price movements using Open, High, Low and Close price and Volume.

  2. Shorting a position involves borrowing an amount of shares and selling it, with the expectation that its price will decrease.

  3. Buy-Low-Sell-High is the most common strategy, where trader buy an asset when its price is low and sell it when the price is high

  4. https://www.binance.com/en

  5. https://www.alphavantage.com

  6. Code: https://drive.google.com/drive/folders/1aW7Miv0cf2jCPe8D0W42pCerKYp1AcNh?usp=sharing

References

  1. Bai S, Kolter JZ, Koltun V (2018) An empirical evaluation of generic convolutional and recurrent networks for sequence modeling. ar**v preprint ar**v: Preprint on webpage at https://arxiv.org/pdf/1803.01271.pdf, ar**v:1803.01271

  2. Betancourt C, Chen WH (2021) Deep reinforcement learning for portfolio management of markets with a dynamic number of assets. Expert Syst Appl 164:114002

    Article  Google Scholar 

  3. Boukas I, Ernst D, Théate T et al (2021) A deep reinforcement learning framework for continuous intraday market bidding. Machine Learn 110:2335–2387

    Article  MathSciNet  Google Scholar 

  4. Bu SJ, Cho SB (2018) Learning optimal q-function using deep boltzmann machine for reliable trading of cryptocurrency. In: Intelligent data engineering and automated learning–IDEAL 2018: 19th International Conference, Madrid, Spain, November 21–23, 2018, Proceedings, Part I 19, Springer, pp 468–480

  5. Chandar SK (2022) Convolutional neural network for stock trading using technical indicators. Automated Softw Eng 29:1–14

    Article  Google Scholar 

  6. Fang F, Ventre C, Basios M et al (2022) Cryptocurrency trading: a comprehensive survey. Financial Innovation 8(1):1–59

    Article  Google Scholar 

  7. Guarino A, Grilli L, Santoro D et al (2022) To learn or not to learn? evaluating autonomous, adaptive, automated traders in cryptocurrencies financial bubbles. Neural Comput Appl 34(23):20715–20756

    Article  Google Scholar 

  8. Heuillet A, Couthouis F, Díaz-Rodríguez N (2021) Explainability in deep reinforcement learning. Knowledge-Based Syst 214:106685

    Article  Google Scholar 

  9. Hirchoua B, Ouhbi B, Frikh B (2021) Deep reinforcement learning based trading agents: Risk curiosity driven learning for financial rules-based policy. Expert Syst Appl 170:114553

    Article  Google Scholar 

  10. Huang JZ, Huang W, Ni J (2019) Predicting bitcoin returns using high-dimensional technical indicators. J Finance Data Sci 5(3):140–155

    Article  Google Scholar 

  11. Jiang Z, Liang J (2017) Cryptocurrency portfolio management with deep reinforcement learning. In: 2017 Intelligent systems conference (IntelliSys), IEEE, pp 905–913

  12. Kochliaridis V, Kouloumpris E, Vlahavas I (2023) Combining deep reinforcement learning with technical analysis and trend monitoring on cryptocurrency markets. Neural Comput Appl pp 1–18

  13. Lazaridis A, Fachantidis A, Vlahavas I (2020) Deep reinforcement learning: A state-of-the-art walkthrough. J Artif Intell Res 69:1421–1471

    Article  MathSciNet  Google Scholar 

  14. Lin TC (2012) The new investor. UCLA L Rev 60:678

    Google Scholar 

  15. Mamoghli C, Daboussi S (2009) Performance measurement of hedge funds portfolios in a downside risk framework. J Wealth Manag 12(2):101

    Article  Google Scholar 

  16. Müller M (2007) Dynamic time war**. Information retrieval for music and motion pp 69–84

  17. Naik N, Mohan BR (2019) Optimal feature selection of technical indicator and stock prediction using machine learning technique. In: Emerging technologies in computer engineering: microservices in big data analytics: second international conference, ICETCE 2019, Jaipur, India, February 1–2, 2019, Revised Selected Papers 2, Springer, pp 261–268

  18. Nazareth N, Reddy YYR (2023) Financial applications of machine learning: a literature review. Expert Syst Appl pp 119640

  19. Pendharkar PC, Cusatis P (2018) Trading financial indices with reinforcement learning agents. Expert Syst Appl 103:1–13

    Article  Google Scholar 

  20. Peng Y, Albuquerque PHM, Kimura H et al (2021) Feature selection and deep neural networks for stock price direction forecasting using technical analysis indicators. Machine Learn Appl 5:100060

  21. Pierros I, Vlahavas I (2022) Architecture-agnostic time-step boosting: A case study in short-term load forecasting. In: Artificial neural networks and machine learning–ICANN 2022: 31st International Conference on Artificial Neural Networks, Bristol, UK, September 6–9, 2022, Proceedings, Part III, Springer, pp 556–568

  22. Schnaubelt M (2022) Deep reinforcement learning for the optimal placement of cryptocurrency limit orders. European J Operational Res 296(3):993–1006

    Article  MathSciNet  Google Scholar 

  23. Somers M, Whittaker J (2007) Quantile regression for modelling distributions of profit and loss. European J Operational Res 183(3):1477–1487

    Article  Google Scholar 

  24. Son Y, Vohra S, Vakkalagadda R et al (2022) Using transformers and deep learning with stance detection to forecast cryptocurrency price movement. In: 2022 13th International conference on information and communication technology convergence (ICTC), IEEE, pp 1–6

  25. Zhang CX, Li J, Huang XF et al (2022) Forecasting stock volatility and value-at-risk based on temporal convolutional networks. Expert Syst Appl 207:117951

    Article  Google Scholar 

Download references

Funding

The authors did not receive support from any organization for the submitted work.

Author information

Authors and Affiliations

Authors

Contributions

Not applicable.

Corresponding author

Correspondence to Vasileios Kochliaridis.

Ethics declarations

Conflicts of interest

The authors declare they have no conflict of interests.

Financial Interest

The authors have no relevant financial or non-financial interests to disclose.

Ethics Approval

Not Applicable.

Consent to participate

Not applicable.

Consent for publication

Not applicable.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Appendices

Appendix A technical analysis

1.1 A.1 Exponential moving average - EMA

EMA is a moving average type of indicator, which is given by (A1). EMA is used to smooth price signals, in order to remove market noise.

$$\begin{aligned} EMA(n) = Price(n)*k + EMA(n - 1)*(1 - k) \end{aligned}$$
(A1)

where k is the smoothing constant and is defined as \(k=\frac{2}{N + 1}\). N parameter defines the "Look-Back" sliding window and is used in many technical indicators.

1.2 A.2 Double-exponential moving average - DEMA

DEMA is an extension of EMA, given by (A2), which attempts to remove price lag that is caused by EMA. The default value of N parameter is 14.

$$\begin{aligned} DEMA_{N} = 2EMA_{N} - EMA \, of \, EMA_{N} \end{aligned}$$
(A2)

1.3 A.3 Moving average convergence/divergence - MACD

MACD is also a trend type of indicator, which shows the relationship between two moving averages (usually EMAs), one with a short period and one with a longer period. The mathematical formula of MACD is provided by (A3).

$$\begin{aligned} MACD = EMA_{N_{1}} - EMA_{N_{2}} \end{aligned}$$
(A3)

with \(N_{2}>> N_{1}\). The default values are \(N_{1} = 12\) and \(N_{2} = 26\)

1.4 A.4 Aroon UP/DOWN

Aroon, which is described by (A4) and (A5), identifies trend changes and estimate the strength of an upcoming trend.

$$\begin{aligned} \frac{25 - N_{H}}{25}*100 \end{aligned}$$
(A4)
$$\begin{aligned} \frac{25 - N_{L}}{25}*100 \end{aligned}$$
(A5)

with \(N_{H}\) and \(N_{L}\) being the timesteps between a new High price or Low price respectively.

1.5 A.5 Commodity channel index - CCI

CCI is also trend indicator, which estimates price trends, as well as the direction and strength of a trend. CCI is presented by (A6).

$$\begin{aligned} CCI = \frac{TP(n) - EMA_{N}(TP)}{MD(TP)}*0.015 \end{aligned}$$
(A6)

where, TP the typical price defined as \(TP(n) = \frac{High(n) + Low(n) + Close(n)}{3}\) and MD(TP) the Mean Deviation of Typical Price. Typically, \(N=20\).

1.6 A.6 Average directional index - ADX

ADX is a well know trend type of indicator that measures the strength of a trend and is given by (A7)

$$\begin{aligned} ADX = MA * \frac{PDI - NDI}{PDI + NDI}*100 \end{aligned}$$
(A7)

where MA is a Moving Average and PDI, NDI are Positive Directional Indicator and Negative Directional Indicator respectively.

1.7 A.7 Stochastic oscillator - STOCH

STOCH is a momentum indicator, given by (A8), which is usually used in large trading ranges or to capture slow moving trends.

$$\begin{aligned} \frac{Close(n) - L_{N}}{H_{N} - L_{N}} \end{aligned}$$
(A8)

where \(L_{N}\) and \(H_{N}\) are the minimum past value Low value and maximum past High value respectively, within a window of N prices. The default value of N is 14.

1.8 A.8 Relative strength index - RSI

RSI is a well-studied momentum indicator, which attempts to identify over-bought or over-sold securities. The mathematical formula of RSI is described by (A9)

$$\begin{aligned} RSI = 100 - \frac{100}{1 + RS} \end{aligned}$$
(A9)

where RS is the ratio of Average Price Increases to Average Price Drops within a window of N timesteps. The default period is 14.

1.9 A.9 On-balance volume - OBV

OBV is a volume type of indicator that measures the volume flow. Its formula is provided by (A10).

$$\begin{aligned} \begin{gathered} OBV(n+1) = OBV(n) + \\ \left\{ \begin{array}{ll} Volume(n) &{} Close(n + 1) < Close(n) \\ 0 &{} Close(n + 1) = Close(n) \\ -Volume(n) &{} Close(n + 1) > Close(n) \end{array} \right\} \end{gathered} \end{aligned}$$
(A10)

1.10 A.10 Bolliger bands - BBANDS

BBANDS is a volatility indicator, which is provided by (A11) and (A12) and measures the standard deviation of the simple moving average.

$$\begin{aligned} BBAND_{UP} = Mean(TP) + 2*Std(TP) \end{aligned}$$
(A11)
$$\begin{aligned} BBAND_{DOWN} = Mean(TP) - 2*Std(TP) \end{aligned}$$
(A12)

where Mean(TP) is the average typical price and Std(TP) is the standard deviation of typical price within a look back window N. The default window of Bollinger-Bands is \(N=20\).

1.11 A.11 Volume-weighted average price - VWAP

VWAP is a volume-weighted moving average, which is given by (A13) and defined as the average price of an asset weighted by the total trading volume over a period of N timesteps. The default period is usually \(N=14\).

$$\begin{aligned} VWAP(n) = \frac{\sum _{n=0}^{N - 1} TP(N - i)*Volume(N - i)}{\sum _{n=0}^{N - 1} Volume(N - i)} \end{aligned}$$
(A13)

1.12 A.12 Accumulation/distribution line - ADL

ADL is another volume-based indicator, which attempts to measure the underlying supply and demand (bids and asks). The mathematical formula of ADL indicator is described by (A14).

$$\begin{aligned} ADL(n) = ADL(n-1) + \frac{(Close - Low)-(High - Close)}{High - Low} \end{aligned}$$
(A14)

Appendix B Sensitivity analysis

Table 10 Analysis of Budget and Transaction Volume parameters in the evaluation datasaet of Bitcoin market
Fig. 12
figure 12

Average Maximum Volatility (left) and the respective TCN’s Mean Absolute Log Error (right) per Horizon in Bitcoin Market. The orange point represents the selected value of our framework

Table 11 UNSURE’s perforance in terms of PNL and ADD metrics in respect to Virtual Fees parameter in the evaluation dataset of Bitcoin market
Table 12 Analysis of TCN’s performance in respect to Pinball Loss Quantile (\(\tau \)) parameter in the evaluation dataset of Bitcoin market

Rights and permissions

Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Kochliaridis, V., Papadopoulou, A. & Vlahavas, I. UNSURE - A machine learning approach to cryptocurrency trading. Appl Intell 54, 5688–5710 (2024). https://doi.org/10.1007/s10489-024-05407-z

Download citation

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s10489-024-05407-z

Keywords

Navigation