Algorithmic trading uses computer programs to execute orders based on predefined rules, making it especially suitable for highly volatile markets like cryptocurrencies. This article explores how artificial intelligence, particularly neural networks, can predict future price movements of crypto assets and be applied to develop effective trading strategies.
Introduction to AI-Driven Crypto Trading
Financial trading systems increasingly rely on algorithms to identify and capitalize on profit opportunities. The cryptocurrency market has seen explosive growth in both research and trading activity in recent years. This piece presents a neural network-based approach to cryptocurrency trading that uses a single dataset to learn universal price patterns, evaluated across extensive historical data.
The unique characteristics of cryptocurrency markets demand innovative research methods. Technical analysis proves particularly applicable here due to market inefficiencies that create opportunities. Low fees and freely available trading APIs from digital exchanges have significantly lowered the entry barriers to algorithmic trading.
The presented strategy uses a Multilayer Perceptron (MLP) algorithm that classifies market conditions into three categories: buy, hold, and sell. Through feature extraction and label preprocessing of price and volume time series data, the algorithm is trained and tested to make reliable predictions across different market cycles.
Key Components of AI Trading Systems
Dataset Preparation
The foundation of any AI trading model is quality data. The dataset used here includes price and volume time series information with extracted features such as candlestick patterns, financial indicators, and moving averages. Labeling typically follows either price regression or price direction prediction approaches.
Data Collection
The dataset comprises 402 different crypto assets sourced from a popular cryptocurrency trading platform in OHLC+volume format at 4-hour intervals. All cryptocurrencies are paired with the USDT stablecoin. After feature extraction, the dataset contains approximately 1.5 million samples.
Feature Extraction
Selected indicators include Bollinger Bands, RSI, Ultimate Oscillator (ULTOSC), percentage change in closing price, Z-Score, and EMA crossovers. These allow the neural network to discover useful patterns independently. The feature vector also incorporates time information and EMA crossovers, totaling 36 entries.
Labeling Algorithm
A three-label classification system enhances prediction accuracy. The algorithm defines time windows and calculates returns for individual trading operations—profits or losses between opening and closing positions.
Threshold parameters 𝛼 and 𝛽 determine return value thresholds for predicting price changes. The algorithm updates the exponential moving average of closing prices, computes return rates, and generates buy, sell, or hold signals based on these thresholds. Returns that are too small or too large result in hold labels.
Model Architecture
Multilayer Perceptron Design
The MLP includes an input layer, two hidden layers, and a classification output layer with three nodes. Following the universal approximation theorem and minimum neuron principle, layers with 128, 64, and 32 nodes were selected. The model architecture intentionally allows slight overfitting on training data while maintaining high accuracy on test sets, avoiding dropout layers or weight regularization to address overfitting.
Parameter Optimization
Threshold values 𝛼 and 𝛽 were determined through statistical analysis of open-close percentage price changes across the entire dataset, set at the 85th and 99.7th percentiles respectively. To balance the dataset, random undersampling was applied to the hold class, which represented approximately 70% of instances.
Through grid search, optimal combinations of forward and backward window sizes were identified. The top five accuracy-performing window size combinations were selected after multiple training and testing iterations with averaged results.
Performance Evaluation and Backtesting
Model Comparison
Several models including XGBoost, Logistic Regression, and SGD Linear were tested using One-vs-Rest strategy to compare binary and ternary classifier performance. Results showed MLP and XGBoost outperformed linear models, with MLP demonstrating the best overall performance, making it the final classifier choice.
Backtesting Methodology
Backtesting uses historical data to simulate real trading scenarios, with profit serving as the primary metric for evaluating algorithm performance. The methodology avoids opening multiple long or short positions for the same asset simultaneously and ensures all positions are closed at the simulation period end for profit calculation.
Through simulation algorithms, the model with maximum returns was selected and backtested on Bitcoin, Ethereum, and Algorand data. Results demonstrated strong generalization capabilities across different cryptocurrencies.
In actual trading simulations, the model achieved high return rates, particularly excelling in long-term Ethereum backtesting. The implementation also included a protective stop-loss mechanism based on regular expressions.
Short-term backtesting revealed how strategies based on lagging indicators behave during market crashes. The MLP model smoothed the TerraLuna crash impact compared to dummy models, with similar behavior observed during the FTX collapse. MLP classifier outputs were primarily influenced by lagging indicators.
👉 Explore advanced trading strategies
Comparative Analysis with Recent Approaches
Comparing price prediction and trading strategies requires maintaining certain invariants in experimental setups. Different methods must be evaluated using shared data and identical metrics. For financial backtesting, common data periods must serve as evaluation sets.
This research compared against five relevant papers that used 2-class labels and time frames ranging from 1 minute to 24 hours, covering different periods. Data sources included OHLC+V format plus Twitter sentiment, blockchain data, and other financial indices.
The comparison revealed that while some systems achieved higher accuracy, they often failed to maintain profitability when accounting for trading fees. One study reported 115% ROI but would have resulted in losses after considering 0.3% commission fees. Another high-frequency strategy executing 2,852 transactions showed potential for 258% losses.
Our system trades less frequently but performs well in sideways markets and during short-term upward trends, demonstrating more consistent profitability after accounting for transaction costs.
Feature Importance and Model Interpretation
The field of machine learning interpretability aims to understand model prediction behaviors by mapping inputs to outputs. SHAP (SHapley Additive exPlanations) provides a method for explaining any black-box ML model output by calculating feature importance attribution.
SHAP values enable local explanations for each specific input. Feature importance can be inferred by calculating the mean absolute SHAP values for each feature. Technical indicators, moving average crossovers, and time information ranked among the top ten most valuable features, while candlestick patterns proved relatively ineffective.
Conclusion and Future Directions
This research presents a simple prediction model based on large datasets and intelligent labeling for forecasting blockchain asset price trends and applying these to trading strategies. Findings indicate that technical analysis tools can identify patterns through large datasets, improving price trend prediction accuracy.
Backtesting demonstrates that technical analysis methods can provide better statistical advantages than random trading or simple "buy and hold" approaches. The study also reveals that technical indicators, moving average crossovers, and time information represent the most valuable features, while candlestick patterns show relatively lower effectiveness.
Future research could explore multi-timeframe price action analysis innovations combined with existing large datasets, labeling algorithms, optimal features, and neural networks. Additionally, trading systems could be applied to different financial markets including foreign exchange, individual stocks, market indices, commodities, and CFDs.
It's important to note that CFDs represent leveraged derivatives with significantly higher risk profiles than spot trading.
👉 View real-time market analysis tools
Frequently Asked Questions
How accurate are AI predictions in cryptocurrency trading?
AI models can achieve significant accuracy in predicting price directions, but perfect prediction is impossible due to market volatility. The MLP model discussed demonstrated strong performance across different market conditions, though results vary based on market regime and asset characteristics.
What data is most important for AI trading models?
Technical indicators, moving average crossovers, and time information proved most valuable in this research. While social media sentiment and blockchain data can provide additional insights, technical indicators derived from price and volume data formed the most predictive features.
How much historical data is needed to train effective models?
The study used approximately 1.5 million samples across 402 cryptocurrencies. Effective training typically requires sufficient data to capture various market conditions, with multiple market cycles preferred for robust model development.
Can these strategies be applied to traditional markets?
Yes, the underlying principles can be adapted to traditional markets like stocks, forex, and commodities. However, each market has unique characteristics that may require parameter adjustments and feature engineering modifications.
What are the risks of algorithmic trading?
Risks include model overfitting, unexpected market events, technical failures, and changing market dynamics that render previously successful strategies ineffective. Proper risk management and continuous monitoring are essential.
How do transaction costs affect algorithmic trading profitability?
Transaction costs significantly impact net returns, especially for high-frequency strategies. The study found that some apparently profitable strategies became unprofitable after accounting for realistic trading fees, highlighting the importance of including costs in backtesting.