Introduction
This paper describes the implementation of an automated equity trading strategy based on social media derived bullishness and bearishness sentiment indicators and the results from back-testing this strategy. The sentiment factors were provided by PsychSignal who have developed natural language processing software with the purpose of calculating bullishness and bearishness indices from StockTwits, Twitter and chat rooms.
The PsychSignal data and market data used in this research, together with the QuantOffice implementation of this strategy, are available from Deltix Cloud Services (DCS).
Trading logic description
We developed the trading strategy based on intraday PsychSignal bullish/bearish indices using two approaches. In both cases, we were operating on the hypothesis that past bullish/bearish indicators for a specific security provide predictive power on the future price of that security and that we can profitably trade using this insight.
1. Regression based model
We took as predictors the two most recent days of daily bullish and bearish indicators data. These daily predictors were smoothed using an EMA (Exponential Moving Average) indicator and acted as the regressors (independent variables) in our model. As the regressand (dependent variable), we calculated the close-to-next-day-open price change for each security in the S&P500 over a period of 50 days (the training period). We applied linear regression to the resultant matrix of regressor values and the vector of the regressand values. The regression parameters were set as weights in the indicator formula and the following signal logic was applied:
If indicator is positive and current price is lower than the 50 day EMA-smoothed day close price, then open a long position at market close and close that position at next market open.
If indicator is negative and current price is higher than 50 day EMA-smoothed day close price with then open a short position at market close and close that position at next market open.
The order size for opening order is calculated by the following formula:
where: retON = list of overnight returns collected for the last 50 days.
The following variations of this model are available via input parameters of the strategy:
- Using the return calculated as 15 min before close price, as an extra parameter in the regression model.
- Instead of comparing the indicator to 0, we can compare it to some enhanced boundaries. As an example of such boundaries, +/- absolute value of the 30 day SMA (Simple Moving Average) of the indicator was used: if indicator is greater than the absolute value of the SMA, then open long position, if it is less then open a short position.
2. RSI based model
In this model, daily predictors are smoothed by collecting data for each predictor into an EMA indicator. The day close EMA values are smoothed with EMA daily indicators and the RSI (Relative Strength Index) is calculated as:
If RSI<15 and current price is lower than 50 day EMA-smoothed day close price then open long position at market close and close that position at next open.
If RSI>85 and current price is higher than 50 day EMA-smoothed day close price then open short position at market close and close that position at next open.
The order size for opening order is calculated by the following formula:
where: retON means list of overnight returns collected for the last 30 days.
Results
The strategy was run on securities in the S&P100.
Consolidated results
Parameter | Regression based | SMA boundaries | Return in regression, SMA boundaries | RSI |
---|---|---|---|---|
Net Profit/Loss | 390,804.54 | 404,459.44 | 325,423.34 | 137,914.56 |
Total Profit | 2,176,093.57 | 1,734,422.43 | 1,614,855.21 | 326,873.83 |
Total Loss | -1,785,289.03 | -1,329,962.99 | -1,289,431.87 | -188,959.27 |
Cumulated Profit % | 390.80% | 404.46% | 325.42% | 137.91% |
Max Drawdown | -106,957.11 | -95,237.32 | -62,589.54 | -20,407.60 |
Max Drawdown % | -18.80% | -16.77% | -13.00% | -19.80% |
Max Drawdown Date | 7/24/2013 | 7/23/2013 | 7/25/2013 | 12/31/2012 |
Return/Drawdown Ratio | 3,65 | 4,25 | 5,2 | 6,76 |
Drawdown Days % | 46.07% | 41.88% | 50.26% | 54.97% |
Max Drawdown Duration | 21 | 21 | 21 | 29 |
CAGR | 771.97% | 805.16% | 617.77% | 225.39% |
Sharpe Ratio | 2,88 | 3,13 | 3,1 | 2,7 |
Annualized Volatility | 184,48 | 175,93 | 143,03 | 69,47 |
Sortino Ratio | 5,55 | 5,61 | 5,75 | 5,76 |
UPI | 5,18 | 6,79 | 4,13 | 4,14 |
Information Ratio | 2,88 | 3,13 | 3,1 | 2,7 |
Optimal f | 2,27 | 2,6 | 3,02 | 4,67 |
All Trades # | 5657 | 4341 | 4226 | 739 |
Profitable Trades Ratio | 0,51 | 0,54 | 0,51 | 0,58 |
Winning Trades # | 2897 | 2338 | 2172 | 427 |
Losing Trades # | 2760 | 2003 | 2054 | 312 |
Average Trade | 69,08 | 93,17 | 77,01 | 186,62 |
Average Winning Trade | 751,15 | 741,84 | 743,49 | 765,51 |
Average Losing Trade | -646,84 | -663,99 | -627,77 | -605,64 |
Avg. Win/ Avg. Loss Ratio | 1,16 | 1,12 | 1,18 | 1,26 |
Average Profit per Share | 0,02 | 0,03 | 0,03 | 0,05 |
Max Conseq. Winners | 13 | 26 | 19 | 47 |
Max Conseq. Losers | 15 | 16 | 14 | 13 |
Detailed results
1. Regression based algorithm
Parameter | All Trades | Long Trades | Short Trades |
---|---|---|---|
Net Profit/Loss | 390,804.54 | 378,866.62 | 11,937.92 |
Total Profit | 2,176,093.57 | 845,980.89 | 1,330,112.68 |
Total Loss | -1,785,289.03 | -467,114.27 | -1,318,174.76 |
Cumulated Profit % | 390.80% | 378.87% | 11.94% |
Max Drawdown | -106,957.11 | -53,779.96 | -158,289.04 |
Max Drawdown % | -18.80% | -15.74% | -60.24% |
Max Drawdown Date | 7/24/2013 | 6/24/2013 | 7/24/2013 |
Return/Drawdown Ratio | 3,65 | 7,04 | 0,08 |
Drawdown Days % | 46.07% | 45.03% | 64.40% |
Max Drawdown Duration | 21 | 16 | 27 |
CAGR | 771.97% | 743.23% | 16.59% |
Sharpe Ratio | 2,88 | 3,08 | 0,07 |
Annualized Volatility | 184,48 | 167,3 | 242,09 |
Sortino Ratio | 5,55 | 5,57 | 0,11 |
UPI | 5,18 | 10,02 | 0,05 |
Information Ratio | 2,88 | 3,08 | 0,07 |
Optimal f | 2,27 | 2,66 | 0,03 |
All Trades # | 5657 | 1859 | 3798 |
Profitable Trades Ratio | 0,51 | 0,61 | 0,47 |
Winning Trades # | 2897 | 1125 | 1772 |
Losing Trades # | 2760 | 734 | 2026 |
Average Trade | 69,08 | 203,8 | 3,14 |
Average Winning Trade | 751,15 | 751,98 | 750,63 |
Average Losing Trade | -646,84 | -636,4 | -650,63 |
Avg. Win/ Avg. Loss Ratio | 1,16 | 1,18 | 1,15 |
Average Profit per Share | 0,02 | 0,07 | 0 |
Max Conseq. Winners | 13 | 55 | 34 |
Max Conseq. Losers | 15 | 23 | 44 |
2. +/- SMA value as boundaries
Parameter | All Trades | Long Trades | Short Trades |
---|---|---|---|
Net Profit/Loss | 404,459.44 | 377,455.08 | 27,004.36 |
Total Profit | 1,734,422.43 | 1,047,071.96 | 687,350.47 |
Total Loss | -1,329,962.99 | -669,616.88 | -660,346.11 |
Cumulated Profit % | 404.46% | 377.46% | 27.00% |
Max Drawdown | -95,237.32 | -70,438.24 | -99,399.48 |
Max Drawdown % | -16.77% | -16.54% | -43.90% |
Max Drawdown Date | 7/23/2013 | 6/24/2013 | 08.01.2013 |
Return/Drawdown Ratio | 4,25 | 5,36 | 0,27 |
Drawdown Days % | 41.88% | 45.55% | 60.73% |
Max Drawdown Duration | 21 | 16 | 28 |
CAGR | 805.16% | 739.85% | 38.46% |
Sharpe Ratio | 3,13 | 2,54 | 0,28 |
Annualized Volatility | 175,93 | 202,45 | 131,01 |
Sortino Ratio | 5,61 | 4,3 | 0,43 |
UPI | 6,79 | 7,18 | 0,18 |
Information Ratio | 3,13 | 2,54 | 0,28 |
Optimal f | 2,6 | 1,81 | 0,22 |
All Trades # | 4341 | 2218 | 2123 |
Profitable Trades Ratio | 0,54 | 0,6 | 0,48 |
Winning Trades # | 2338 | 1325 | 1013 |
Losing Trades # | 2003 | 893 | 1110 |
Average Trade | 93,17 | 170,18 | 12,72 |
Average Winning Trade | 741,84 | 790,24 | 678,53 |
Average Losing Trade | -663,99 | -749,85 | -594,91 |
Avg. Win/ Avg. Loss Ratio | 1,12 | 1,05 | 1,14 |
Average Profit per Share | 0,03 | 0,06 | 0 |
Max Conseq. Winners | 26 | 34 | 23 |
Max Conseq. Losers | 16 | 40 | 34 |
3. Return in regression, SMA boundaries
Parameter | All Trades | Long Trades | Short Trades |
---|---|---|---|
Net Profit/Loss | 404,459.44 | 377,455.08 | 27,004.36 |
Total Profit | 1,734,422.43 | 1,047,071.96 | 687,350.47 |
Total Loss | -1,329,962.99 | -669,616.88 | -660,346.11 |
Cumulated Profit % | 404.46% | 377.46% | 27.00% |
Max Drawdown | -95,237.32 | -70,438.24 | -99,399.48 |
Max Drawdown % | -16.77% | -16.54% | -43.90% |
Max Drawdown Date | 7/23/2013 | 6/24/2013 | 08.01.2013 |
Return/Drawdown Ratio | 4,25 | 5,36 | 0,27 |
Drawdown Days % | 41.88% | 45.55% | 60.73% |
Max Drawdown Duration | 21 | 16 | 28 |
CAGR | 805.16% | 739.85% | 38.46% |
Sharpe Ratio | 3,13 | 2,54 | 0,28 |
Annualized Volatility | 175,93 | 202,45 | 131,01 |
Sortino Ratio | 5,61 | 4,3 | 0,43 |
UPI | 6,79 | 7,18 | 0,18 |
Information Ratio | 3,13 | 2,54 | 0,28 |
Optimal f | 2,6 | 1,81 | 0,22 |
All Trades # | 4341 | 2218 | 2123 |
Profitable Trades Ratio | 0,54 | 0,6 | 0,48 |
Winning Trades # | 2338 | 1325 | 1013 |
Losing Trades # | 2003 | 893 | 1110 |
Average Trade | 93,17 | 170,18 | 12,72 |
Average Winning Trade | 741,84 | 790,24 | 678,53 |
Average Losing Trade | -663,99 | -749,85 | -594,91 |
Avg. Win/ Avg. Loss Ratio | 1,12 | 1,05 | 1,14 |
Average Profit per Share | 0,03 | 0,06 | 0 |
Max Conseq. Winners | 26 | 34 | 23 |
Max Conseq. Losers | 16 | 40 | 34 |
4. RSI
Parameter | All Trades | Long Trades | Short Trades |
---|---|---|---|
Net Profit/Loss | 325,423.34 | 304,738.15 | 20,685.20 |
Total Profit | 1,614,855.21 | 603,891.16 | 1,010,964.04 |
Total Loss | -1,289,431.87 | -299,153.02 | -990,278.85 |
Cumulated Profit % | 325.42% | 304.74% | 20.69% |
Max Drawdown | -62,589.54 | -26,493.13 | -113,048.33 |
Max Drawdown % | -13.00% | -8.72% | -48.37% |
Max Drawdown Date | 7/25/2013 | 6/24/2013 | 08.01.2013 |
Return/Drawdown Ratio | 5,2 | 11,5 | 0,18 |
Drawdown Days % | 50.26% | 43.98% | 63.35% |
Max Drawdown Duration | 21 | 10 | 37 |
CAGR | 617.77% | 570.69% | 29.17% |
Sharpe Ratio | 3,1 | 3,58 | 0,15 |
Annualized Volatility | 143,03 | 115,91 | 184,57 |
Sortino Ratio | 5,75 | 6,89 | 0,24 |
UPI | 4,13 | 9,86 | 0,09 |
Information Ratio | 3,1 | 3,58 | 0,15 |
Optimal f | 3,02 | 4,25 | 0,09 |
All Trades # | 4226 | 1301 | 2925 |
Profitable Trades Ratio | 0,51 | 0,62 | 0,47 |
Winning Trades # | 2172 | 804 | 1368 |
Losing Trades # | 2054 | 497 | 1557 |
Average Trade | 77,01 | 234,23 | 7,07 |
Average Winning Trade | 743,49 | 751,11 | 739,01 |
Average Losing Trade | -627,77 | -601,92 | -636,02 |
Avg. Win/ Avg. Loss Ratio | 1,18 | 1,25 | 1,16 |
Average Profit per Share | 0,03 | 0,08 | 0 |
Max Conseq. Winners | 19 | 35 | 26 |
Max Conseq. Losers | 14 | 17 | 46 |
· Using the return calculated as 15 min before close price, as an extra parameter in the regression model.
· Instead of comparing the indicator to 0, we can compare it to some enhanced boundaries. As an example of such boundaries, +/- absolute value of the 30 day SMA (Simple Moving Average) of the indicator was used: if indicator is greater than the absolute value of the SMA, then open long position, if it is less then open a short position.
The Deltix Quantitative Research Team
Latest posts by The Deltix Quantitative Research Team (see all)
- Improving Order Execution in FX – Rethinking TCA - January 26, 2018
- Using Deltix for Trading Cryptocurrencies and Bitcoin Futures - December 11, 2017
- Advantages Of Recording Your Own Market Data - July 8, 2016