Sentiment Moving Average

Monday, 29 May 2017 Daniel Chow

Technical Analysis is the process of using charts and indicators based on the price and volume to predict the future movements of financial assets.

It bears similarities with Sentiment Analysis as Technical Indicators are used to guess the opinions of other investors. For example, a large volume with increasing price could signify that investors are largely positive and bullish about the asset.

As such, Technical Indicators is a proxy for Sentiment Analysis.

This post will hope to show that incorporating Sentiment Analysis into a simple Technical Strategy can improve its performance.

Strategies to be Compared
The following 2 strategies will be compared.

Strategy A
If (5-day SMA > 10-day SMA): Long Asset
Else: Short Asset

Strategy B
If (5-day SMA > 10-day SMA) and (2-day Average Sentiment > A1): Long Asset
Else if (5-day SMA > 10-day SMA) and (2-day Average Sentiment < A2): Close Position
Else if (5-day SMA <= 10-day SMA) and (2-day Average Sentiment < B1): Short Asset
Else if (5-day SMA <= 10-day SMA) and (2-day Average Sentiment > B2): Close Position

The basis of both strategies is when the short-term moving average is above the long-term moving average, the asset price is in an upward path. Hence, we want to follow the trend and long the asset. Conversely, we want to short the asset in the other case.

The difference between the strategies is that B has additional entry and exit conditions for when the sentiment data does not agree with the moving average condition. A 2-day average is used here to smooth out noise which could cause the strategy to change positions constantly.

It is obvious that Strategy A will always have open positions whereas Strategy B will occasionally have no positions, instead holding cash until another opportunity arises.

Testing Methodology
Sentiment data from the FinSentS API will be used for the comparison of the 2 strategies. A1, A2, B1, B2 are selected to be 5, 4, 6, 7 respectively for Strategy B.

For the asset, Apple Inc. (AAPL) is used.

When either Strategy enters a position, the position size will be equal to 90% of the portfolio’s value. This is to simulate the leaving of some cash holdings to prevent for margin calls.

More about the data:
The data used in this particular instance is powered by FinSentS published by InfoTrie Financial Solutions.

The FinSentS News Sentiment database offers daily media sentiment indicators for 23,000+ global equities, calculated by applying sophisticated real-time machine-learning algorithms to the content of thousands of news websites and media sources from around the world.

Each stock has 5 indicators:
– Sentiment Score: a numeric measure of the bullishness / bearishness of news coverage of the stock.
– Sentiment High / Low: highest and lowest intra-day sentiment scores.
– News Volume: the absolute number of news articles covering the stock.
– News Buzz: a numeric measure of the change in coverage volume for the stock.

More details and Source Code on Quantopian

Leave a Reply

Your email address will not be published. Required fields are marked *