## 3 Proposed Methodology
### Trading Recommendation  
The final phase of our methodology focused on defining a trading recommendation algorithm that exploits price predictions based on the LSTM model. The trading algorithm aims to suggest when is most appropriate to initiate trading operations (buy or sell) for a given cryptocurrency. To simplify the proposed heuristic, the algorithm invests the entire capital available in the account at each operation. However, in the future, less risky approaches could be studied, which involve better capital management in order to control losses. The algorithm takes into account some aspects: \begin{table}
\begin{tabular}{l l} \hline \hline
**Model** & **Hyperparameters** \\ \hline Random forest & max\_features: \(\sqrt{n}\); min\_samples\_split: 5; estimators: 300 \\ \hline XGBoost & eta: 0.01; gamma: 150; n\_estimators: 100; subsample: 1 \\ \hline CatBoost & depth: 6; iterations: 200; learning\_rate: 0.1; 1Z\_leaf\_reg: 0.2 \\ \hline \multirow{4}{*}{Conv1D} & conv1d\_layer: [units: 256; kernel\_size: 2; activation: ReLU]; \\  & flaten\_layer: yes: \\  & dense\_layer: 1; [units: 8; activation: ReLU]; \\  & dense\_layer: 2: [units: 1; activation: linear]; \\  & optimizer: [PERSON]; learning\_rate: 0.0001; epoch: 200 \\ \hline \multirow{4}{*}{GRU} & gru\_layer, units: 256; \\  & dense\_layer: 1: [units: 8; activation: ReLU]; \\  & dense\_layer: 2: [units: 1; activation: linear]; \\  & optimizer: [PERSON]; learning\_rate: 0.0001; epoch: 200 \\ \hline \multirow{4}{*}{LSTM} & lstm\_layer\_units: 32; lstm\_layer\_units: 64; \\  & dense\_layer. 1: [units: 8; activation: ReLU]; \\  & dense\_layer. 2: [units: 1; activation: linear]; \\  & optimizer: [PERSON]; learning\_rate: 0.0001; epoch: 200 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Hyperparameter values used for the algorithms under comparison. \begin{table}
\begin{tabular}{l c c c c c} \hline \hline
**Model** & **Category** & **RMSE** & **MAE** & \(\boldsymbol{R^{2}}\) & **MAPE** \\ \hline Random forest & Tree-based & 0.085 & 0.055 & 0.75 & 5.2\% \\ XGBoost & Tree-based & 0.110 & 0.070 & 0.68 & 6.8\% \\ CatBoost & Tree-based & 0.025 & 0.035 & 0.92 & 1.7\% \\ Conv1D & CNN & 0.005 & 0.003 & 0.95 & 1.4\% \\ GRU & RNN & 0.004 & 0.002 & 0.96 & 1.3\% \\
**LSTM** & RNN & **0.003** & **0.002** & **0.97** & **1.2\%** \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Performance comparison of the different machine learning algorithms in predicting cryptocurrency prices. * _Impact of commissions_: commission costs depend on the trading platform used, and thus, the algorithm is designed to take into account a certain percentage of the invested capital to be paid as transaction fees. * _Identification of strong trends_: the algorithm implements a heuristic to limit the number of transactions, starting a new one only in the presence of a significant event. In this way, it is possible to avoid imprudent operations during phases of price uncertainty, with notable benefits in terms of profits. * _Use of take-profit_: it leads the algorithm to close operations when the profit percentage exceeds a certain threshold. * _Use of stop-loss_: it closes operations when the loss percentage exceeds a certain threshold. It is worth noting that the algorithm is based on _future trading_, which allows traders to buy or sell cryptocurrencies at a predetermined price at a specified future date. This trading strategy enables traders to speculate on the price movements without owning the cryptocurrency. Specifically, traders can do two different types of trading operations: _shorting_ a cryptocurrency or _going long_ on a cryptocurrency. Shorting a cryptocurrency means betting that its price will decrease. Traders who short-sell borrow the cryptocurrency and sell it at the current price, hoping to buy it back later at a lower price, thus making a profit from the difference. On the contrary, going long on a cryptocurrency means betting that its value will rise, allowing traders to sell it later at a higher price and make a profit from the difference.