1551-3203 (c) 2018 IEEE. Personal use is permitted, but republication/redistribution requires IEEE permission. See http://www.ieee.org/publications_standards/publications/rights/index.html for more information. This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication. Citation information: DOI 10.1109/TII.2018.2811377, IEEE Transactions on Industrial Informatics TII-17-2357 1 Replicating a Trading Strategy by means of LSTM for Financial Industry Applications Luigi Troiano, Member, IEEE, Elena Mejuto Villa, Student Member, IEEE, Vincenzo Loia, Senior Member, IEEE Abstract—This paper investigates the possibility of learning a trading rule looking at the relationship between market indica- tors and decisions undertaken regarding entering or quitting a position. As means to achieve this objective we employ a Long- Short Term Memory (LSTM) machine, due its capability to relate past and recent events. Our solution is a first step in the direction of building a model-free robot, based on Deep Learning, able to identify the logic that links the market mood given by technical indicators to the undertaken investment decisions. Although preliminary, experimental results show that the proposed solution is viable and promising. I. I NTRODUCTION D EEP LEARNING (DL) is gaining a wide popularity for industrial applications due its capability to train complex non-linear models in very large parameter spaces over massive datasets. Architectures and models have been investigated in the past two decades, but availability of GPU computing enabled DL industrial applications such as automotive [1], control systems [2], fault detection and recovery [3], [4] and biomedicine [5], [6], just to mention some. Financial Industry is one the sectors that can benefit more of DL in automating complex decision making, due to the wider range of information today made real-time available by multiple sources and because of DL capability to explore non-linear relations within and/or between different sources of information. Most of the decisions regard the issue of buy/sell orders according to the market mood captured by technical indicators, that are metrics whose value is derived from price and volume time series in a stock or asset. A trading strategy is the set of rules followed in taking such decisions by human traders or algorithms, being this second option preferred to the first to trade in fast paced financial markets. Our research hypothesis is that a robot trained by DL is able to replicate the logic underlying a strategy only by looking at undertaken trading decisions. As said, those decisions are taken by traders according to technical indicators. So, they are the only source of information given to the robot, without assuming any model for the rules followed by the trader. The remainder of this paper is organized as follows: Section 2 provides a very brief overview of related literature, Section 3 describes the DL model we consider for our experimentation, Section 4 reports the experiment and Section 5 outlines conclusions and future directions. Manuscript received October 6, 2017; revised January 22, 2018. L. Troiano and E. Mejuto Villa are with the Department of Engineering, University of Sannio, Benevento, 82100 Italy (email: troiano@unisannio.it, mejutovilla@unisannio.it). V. Loia is with the Department of Innovation Systems, University of Salerno, Fisciano, 84084 Italy (email: loia@unisa.it). II. EXISTING APPLICATIONS OF ML/DL TO FINANCE Besides model driven approaches (e.g., see [7], [8]), a vast literature concerns applications of machine learning (ML) to the Financial Industry with respect to time series forecasting, prediction of price movements, portfolio management, risk assessment, identification of trading strategy parameters, and similar. More recently, DL follows the same directions. Various DL architectures have been investigated for predict- ing different kinds of financial time series. For instance, the forecasting of stock prices has been studied by Cai, Hu and Lin [9], where they propose a combined approach consisting of a Restricted Boltzman Machine (RBM) to extract discrimina- tive low-dimensional features and a Support Vector Machine (SVM) for regression. A different approach is followed by Chen, Zhou and Dai [10] in order to predict the stock market returns by means of Long-Short Term Memory (LSTM). Persio and Honchar [11] investigate different artificial neural network (ANN) architectures, namely Multilayer Perceptron (MLP), Convolutional Neural Network (CNN) and LSTM, to stock price movement forecasting, where the prediction of future trend movements are based on past returns. Authors also consider a feature extraction based on Wavelet Transform as preliminary to the prediction task which yields better results. A similar problem is faced by Dixon, Klabjan and Hoon Bang [12], where they make use of a Deep Neural Network (DNN) as predictor of price movements over the following 5- minutes for several commodities and forex futures. As input they consider price differences, price moving averages and return pair-wise correlations to build a memory from historical data and capture co-movements between symbols. Portfolio management have been investigated by Heaton, Paulson and Witte [13] where they present an automated portfolio selection procedure based on, first encoding a large dataset of historical returns by means of an Autoencoder (AE) and then decoding it by solving an optimization problem. Closer to the problem faced in this paper, Arévalo, Niño, Hernández and Sandoval [14] propose a High-Frequency Trad- ing (HFT) strategy based on the output given by a DNN used to forecast the next 1-minute average price. Instead, we aim to replicate an existing strategy by learning hidden rules that link technical indicators to decisions in assuming long/short positions over time. DL is being widely implemented to process temporal information regarding video, audio and text [15], [16]. Our approach differs from other financial studies described above since we aim to exploit this capability for teaching a robot about how to trade financial markets by means of LSTM and using only technical indicators of historical data.