Multivariate LSTM Time Series Forecasting

Multivariate LSTM Time Series Forecasting with Technical Analysis Integration

This code integrates multivariate LSTM (Long Short-Term Memory) neural networks with technical analysis (TA) indicators to forecast cryptocurrency prices. It fetches historical price data from Binance using their API, preprocesses the data, and incorporates various TA indicators such as Relative Strength Index (RSI), Moving Averages (SMA and EMA), Moving Average Convergence Divergence (MACD), and Average True Range (ATR). The data is then framed as supervised learning samples, normalized, and trained using an LSTM model.

The model's predictions are evaluated using Root Mean Squared Error (RMSE) and visualized alongside actual price data using candlestick charts. The code also exports the results to Excel files if enabled. This comprehensive approach enables accurate and insightful predictions for cryptocurrency traders and analysts.

Example Output of the Model

Training Methodology

The LSTM model utilized in this study was trained on the complete historical dataset of Bitcoin, The data preprocessing involved supervising the data to construct input sequences consisting of 12 past candlestick data points, incorporating both price information and technical analysis (TA) indicators such as Relative Strength Index (RSI), Moving Averages (SMA and EMA), Moving Average Convergence Divergence (MACD), and Average True Range (ATR). These sequences were then framed as supervised learning samples, with each input sequence aimed at predicting the subsequent 4 candlestick data points.

There exists ample opportunity for future optimization across multiple fronts. This includes refining the model structure, exploring alternative layer architectures, enhancing data preprocessing techniques, and reevaluating the output configuration. Moreover, integrating this LSTM model with complementary models, such as convolutional neural networks (CNNs) or attention mechanisms, could uncover deeper insights and capture more intricate patterns within the dynamic landscape of the financial market.

More by Nima Mosayebi

View profile