A Look into Machine Learning for Technical Analysis

Brief and Background

Technical analysis is a trading discipline by which investors analyse chart patterns visually to identify patterns which have previously shown to be indicative of certain price movements. Technical analysts have classified quite a number of patterns, generally pertaining to indicators of price trends, chart patterns, volume and momentum indicators, oscillators, moving averages and support and resistance levels.

Regarding the choice of machine learning algorithms, computer vision stands out as an immediately intuitive option. Traditionally, technical analysis is a visual endeavour in which a human trader manually identifies and classifies patterns on a visual chart. Thus, it makes sense that object detection and classification models would be well suited to doing the same, likely with a higher accuracy than a human user.

Our goal is to automate the detection of these patterns via machine learning, and to feed that data into live trading bots as one of several data points by which they will make trading decisions. In particular, we are aiming to identify patterns such as head-and-shoulders, rising wedge, Wyckoff accumulation and distribution, gartley patterns, and Fibonacci retracements — and ideally incorporate liquidity cluster data into these classifications.

TrendSpider

TrendSpider is an automated technical analysis platform which leverages unique machine learning algorithms to detect chart patterns. Their services include:

Smart Charts

Automated Trendline Detection

Breakout Detection

Automated Fibonacci Retracements

Candlestick Pattern Recognition

Automated Gap Detection

Truth in Analysis Timestamp

Heat Maps

Anchored Volume by Price

Horizontal Support and Resistance

Alerts

Raindrop Charts

Raindrop Charts™

A human-friendly volume profile chart

by Ruslan Lagutin, Co-Founder and CTO, TrendSpider

This visualisation may be quite useful for elegantly incorporating more data into computer vision analysis without overcomplicating the image — an aspect of the problem which is quite important, and will be discussed later in this article.

Digital Asset Integration

Strategy Tester

Market Scanner

Closing Statements

Tickeron

The next service explored in this sprint, Tickeron, offers trading and analysis solutions using artificial intelligence and natural language processing across various markets, including cryptocurrencies. Their services include:

Trendline and Pattern Recognition Search Engines

Stochastic and RSI Detection

AI Trading Bots

Closing Statements

Trading via Image Classification — J.P. Morgan

Their study looked at three binary indicators:

Bollinger Bands (BB) crossing:

  • 2 bands of 20 day moving standard deviations
  • Buy signal: when the price crosses over the lower 20 day moving standard deviation

Moving Average Convergence Divergence (MACD) crossing:

  • 26 day short and long exponential moving averages (EMA)
  • Buy signal: 9 day EMA ‘crosses above’

Relative Strength Index (RSI) crossing:

  • RSI oscillator summarizes the magnitude of recent price changes to evaluate overbuying and overselling — asset momentum
  • Out of 100
  • Signals: oversold/overbought RSI are standardly 30/70, buy when RSI crosses above 30 (overselling)

They used 5000 samples per class, per indicator — 10,000 images per trigger. Images were cropped according to the number of effective trading days their respective triggers consider. Each sample has 80–108 features depending on the size of the window required to compute the label:

  • BB crossing: 4x20
  • MACD crossing: 4x26
  • RSI: 4x27

Images were labelled according to trading opportunities, and trading volume information was incorporated into the chart’s candlesticks — reminiscent of TrendSpider’s Raindrops.

A key area of interest they discussed was that of image resolution. Higher resolutions can lead to pixelation being amplified in the feature space, which introduces noise and can skew predictions. As such, the image resolution was varied on a logarithmic scale and output accuracy was tested over the following machine learning classifiers:

  • Logistic Regression
  • Gaussian Naive-Bayes
  • Linear Discriminant Analysis
  • Quadratic Discriminant Analysis
  • Gaussian Process
  • KNearest Neighbors
  • Linear SVM, RBF SVM
  • Deep Neural Net
  • Decision Trees
  • Random Forest
  • Extra Randomized Forest
  • Ada Boost
  • Bagging
  • Gradient Boosting
  • Convolutional Neural Net

A Lanzcos filter was used for downscaling as an anti-aliasing solution, while preventing sharpness. A 30x30 pixel resolution was found to be ideal.

As the researchers expected, MACD underperformed on account of its inherent complexity. The best performing data used only close data as a timeseries line plot, however, this difference was only marginal between those which incorporated OHLC (candlesticks) as we can see in the following graphs:

Key Takeaways

A major point discussed was their realisation of the importance of time dependency in graphical representation as to whether or not time-dependent signals can be detected in static images.

A time series goes from left to right, in the case of technical analysis, more recent data points on the right side of the chart are generally more significant to the model. The authors proposed two methods of incorporating this notion.

Using labels to attribute a notion of time to data points

  • Labelling candlesticks using three algorithms to compute a time-dependent function, encapsulating a corresponding notion of time
  • Using this, cross triggers will always trigger because of the last few data points, restricting the model from detecting an irrelevant cross in the past

Augmenting images with sequential features

  • They also tried varying the width of the candlestick boxes linearly and overlaying close values on each candlestick to give a sense of time — smaller candlesticks were further into the past and vice versa
  • This method was however considered less effective than labelling

Closing Statements

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
GDA Fund

GDA Fund

222 Followers

GDA is developing the decentralized financial application development environment and rapid financial engineering protocol built on Ethereum.