What is Machine Learning and how do we use it in Signals?

If you go to college and take a course “Machine learning 101”, this might be the first example of machine learning your teacher will show you:

Imagine you work for a real estate agency, and you want to predict, for how much a house will sell. You have some historical data — you know that house A has been sold for $500 000, house B for $600 000, and house C for $550 000. You also know something about properties of the houses — you know the size of the house in square meters, number of rooms in the house, and the year the house was build.

The goal of the real estate agency is to predict, for how much a new house D will sell, given its known properties (size, age and number of rooms of the house). In ML terminology, the known properties of the house are called “features” or “indicators” (we use the term “indicators” in Signals, because this term has been historically used in trading). The price of the house is your “target”. [3] [9]

Let’s look at the data with a human eye:

Each row is a training example, and it contains three indicators and one target value. You might immediately see that smaller houses are cheaper, and that newer houses are more expensive. You can use this knowledge gained from historical data and if a new house comes to your agency, you might price it accordingly.

OK, but what if you have much more data, let’s say hundreds thousands of houses? You as a human will never be able to process such data. Another problem can appear if you have lots of indicators — not only number of rooms, size and age of the house, but let’s say thousands of indicators. Your human mind will have great difficulties to reveal relationships between these features. It may take you months trying to understand the data, and still you might just project your false assumption — for example, you believed that bigger houses are more expensive before you saw the data, and you will be tempted to believe it even if the data say otherwise. [5]

What if someone else than human can learn from this data, someone who is much better suited for processing huge and somewhat boring structured data? An algorithm? A “machine”?

It turns out that there are such algorithms. Machine learning algorithms, which accept the data in format we showed above, learn from these data (or we can say that we “train” the algorithm on the data, therefore these data are called “training data”), and when they later receive a new, unseen example, they output a prediction. These algorithms can be as simple as linear regression and as complex as neural networks, but it is just mathematics. The main idea behind all these algorithms is optimizing on the known data to find a function (linear in the case of linear regression or quite complex in the case of neural networks), which fits the data well but not too much to “overfit”. This fitted function is then used to predict the “target” for the unseen data. [6] [12] [8]

How do we use machine learning in Signals?

Machine learning is much more than the simple example described above. In Signals, we use ML in the following ways:

1. Strategy optimization

Even if you decide not to use machine learning and to define your strategy manually, methods from computer science and statistics, which are closely related to machine learning, can help you.

In your strategy, each indicator has several parameters. You might use a random set of parameters, or you can try to grid-search through all the possible parameters and use the parameters which perform best on historical data. The problem is, the first approach never works, and the latter approach becomes computationally unfeasible if you have more than just a few parameters.

This problem is called optimization and is well-studied. In Signals, we implement genetic algorithms for parameter optimization, and in the future we plan to implement other methods, such as bayesian optimization. [4] [12]

2. Signals extraction

This use of ML is most similar to the toy example with houses, described in the beginning of this article. In Signals extraction, the data we use are time-series data, such as bitcoin price chart. The user selects indicators (features) from Indicator Marketplace and feeds their outputs extracted from time series to the machine learning algorithm. The ML algorithm then learns from the data, finds non-linear relationships between the indicators, and predicts the target value on the unseen data. [10] [16]

How does Signals extraction works?

Time series preprocessing is needed in many other fields than in trading — speech, audio or accelerometer signal processing, weather forecasting, …

In trading, technical analysis indicators are popular. There are hundreds of these indicators and they are built on years of research in time series processing as well as on years of experience of day traders. You can find them implemented in most trading software.

Traders mostly use these indicators to indicate buy or sell signals and they usually use just a few of these indicators. [7] [2] At Signals, we will give you an opportunity to use the technical indicators as features for your machine learning algorithm.

We call this feature Signals Extraction, users select the combination of indicators which they want to use in their model and then let machine learning techniques to find the most profitable patterns based on them. [9] [13] Once the Signals extraction is performed on historical data (let’s say January to May), the Signals platform evaluates its performance on unseen historical data (let’s say from June to August) and outputs parameters of the performance such as drawdown and profit.

This ML playground will enable users to experiment with multiple ML algorithms with different subsets of indicators and use only the algorithm which performed well on unseen historical data to make money in the real world!

Signals give you the playground and our experts take care of the data flow, so you will not make some stupid mistake — as implementing the features/algorithm incorrectly and giving them completely unmeaningful parameters, or as predicting the past.

However, there are many things you will have to decide for yourself.

  • Which combination of technical indicators will you try, and what kind of parameters for the indicators will you use (e.g. sizes of time window)?
  • Will you try some feature (indicator) selection/transformation algorithm?
  • What kind of machine learning algorithm will you try? What parameters of these algorithms?
  • Will you learn on the whole historical data, or just on past few months? Or will you always learn only on past few days and predict the next day?
  • What will be your target? How will you define the buy/sell signal?

There are so many options and so much data, that you will never be able to try all of them. That’s what makes algorithmic trading so addictive.

3. Indicators based on Machine learning

In the toy example with house prediction, there is one important thing to note: the indicators were designed by human. Someone had to decide that the algorithm will learn to predict the price from the size of the house, number of rooms and the age of the house, and not from other known properties, as the first letter of the street or the second letter of the city. The technical indicators described above are also human-designed, and although they work very well in many cases, they might work even better with other features — features based on machine learning.

Machine learning techniques can be used to

1. learn the indicators completely from the unstructured data, using e.g. single layer or deep neural networks. [1]

2. create the indicators using advanced ML techniques, as when you use Natural Language Processing methods for sentiment analysis of media and social networks.

Your machine learning predictor can use these ML indicators next to technical indicators. One of your new indicators, which you will feed the ML predictor, might be the sentiment (= the mood) about bitcoin on Twitter in last 10 minutes (on scale 1–10) and another new indicator might be a neural network representation (= a n-dimmensional vector) learned from the time series of Ethereum in last 15 minutes.

Of course, you can decide to believe in machines completely and to use solely machine learning based indicators to feed your ML predictor! On the other hand, you might add some human feature engineering to your indicator-learning algorithm — for example, you might feed it with data transformed by Fourier transformation instead of the raw signal.

There are also machine learning algorithms which are designed to work with the raw time series — they take the time series as an input and predict the next value. Probably most popular of these algorithms are LSTM. LSTMs are difficult and expensive to train (which can actually be your advantage in the trading market!), and they perform really well for some time series problems. You can experiment with LSTMs in Signals.[11] [14] [15]

One of the best things about Signals is that you can implement your own indicators. 20 % of tokens will be used to support the Data Science community and we are excited to see what new indicators will the community bring to the platform as we already received a lot of requests for cooperation from developers an data science community.

Of course, each indicator has to implement Signals indicator specification so as it could be automatically used as a graphical component in the Signals Strategy Builder and used by cryptotraders.

[1] A. Coates, H. Lee, and A. Ng., “An Analysis of Single-Layer Networks in Unsupervised Feature Learning”, JMLR Workshop and Conference Proceedings, vol. 15, pp. 215–223., 2011.

[2] A. N. Azizan and J. C. P. M’ng, “Can technical analysis predict the movement of futures prices?”, IUP Journal of Financial Risk Management, vol. 7, no. 3, pp. 57–75, Sep. 2010

[3] A. W. Lo and A. C. MacKinlay, “Stock market prices do not follow random walks: Evidence from a simple specification test,“ Rev. Financial Stud., vol. 1, no. 1, pp. 41–66, Jan. 1988.

[4] D. Barber, Bayesian reasoning and machine learning. Glasgow, U.K.: Cambridge University Press, 2012.

[5] G. Friesen and P. A. Weller, “Quantifying cognitive biases in analyst earnings forecasts,“ J. Financial Mark., vol. 9, no. 4, pp. 333–365, Nov. 2006.

[6] I. Kaastra and M. Boyd, “Designing a neural network for forecasting financial and economic time series,“ Neurocomputing, vol. 10, no. 3, pp. 215–236, Apr. 1996.

[7] J. Stanković, I. Marković and M. Stojanović, “Investment Strategy Optimization Using Technical Analysis and Predictive Modeling in Emerging Markets“ Procedia Economics and Finance, vol. 19, pp. 51–62, 2015.

[8] K. P. Murphy, Machine learning: A probabilistic perspective. Cambridge, MA, USA: MIT Press, 2012.

[9] M. T. Leung, H. Daouk ,and A. S. Chen, “Forecasting stock indices: A comparison of classification and level estimation models,“ Int. J. Forecast., vol. 16, no. 2, pp. 173–190, Apr.–Jun. 2000.

[10] N. I. Indera, I. M. Yassin, A. Zabidi, and Z. I. Rizman, “Non-linear autoregressive with exogeneous input (narx) bitcoin price prediction model using PSO-optimized parameters and moving average technical indicators,” J. Fundam. Appl. Sci., vol. 9, no. 3S, pp. 791–808, Sep. 2017.

[11] Ordóñez FJ, Roggen D. Deep Convolutional and LSTM Recurrent Neural Networks for Multimodal Wearable Activity Recognition. Liu Y, Xiao W, Chao H-C, Chu P, eds. Sensors (Basel, Switzerland). 2016;16(1):115. doi:10.3390/s16010115.

[12] S. A. Mitilineos and P. G. Artikis, “Forecasting of future stock prices using neural networks and genetic algorithms,“ Int. J. of Decision Sciences, vol. 7, no. 1/2, pp. 2–25, Apr. 2017.

[13] S. Thawornwong and D. Enke, “The adaptive selection of financial and economic variables for use with artificial neural networks,” Neurocomputing, vol. 56, pp. 205–232, Jan. 2004.

[14] T. Fischer and C. Krauss, “Deep learning with long short-term memory networks for financial market predictions,“ Eur. J. Oper. Res., pp. 1–16, Jan. 2018.

[15] X. Pang, Y. Zhou, P. Wang, W. Lin, and V. Chang, “An innovative neural network approach for stock market prediction,“ J. Supercomput., pp. 1–21, Jan. 2018.

[16] Y. Shynkevich, T. M. McGinnity, S. A. Coleman, A. Belatreche, and Y. Li, “Forecasting price movements using technical indicators: Investigating the impact of varying input window length,” Neurocomputing, vol. 264, pp. 71–88, Nov. 2017.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.