A backtested algorithm for trading meme stocks – 366% on AMC in just under 2 months and 16 trades

Introduction

I recently started working as a contributor on sentimentinvestor’s open source software and I decided to start building algorithms using the data. Given the recent AMC mania I’ll share one that spun a huge return in just under a couple of months.

For non-devs, I’ll explain conceptually how you can do something like this. For developers, I will also show how to implement this, but (for obvious reasons) I won’t share the codebase, if you want to know please message me (I just don’t want to disseminate it publicly as I want to continue trading with it).

The Concept

I used social media activity (i.e. number of posts, comments etc) from various places to input the data. I suspected (and now confirmed) that activity to some extent preempts price changes for meme stocks.

While the platform has some better (more precise metrics) for volume, I decided to go for RHI, which is essentially in their words “how much as stock is being talked about compared to usual”. Its calculated by taking the total activity in the past day and dividing by the average daily activity of the past week.

I chose this metric because it is very clean, although it loses information.

I compared the graphs of RHI and stock price for various meme stocks and I saw a clear pattern which I decided to build a strategy around.

RHI for the last month

$AMC price for the last month

Here the first graph is RHI and the second is price. Notice the surges around May 13 and of course May 23, the dip around the start of may, peak a couple of days ago and so on

Step 0 (for algotraders only) – clean your data: I used the Sentipy Python module to download historical RHI data. I then cleaned it. I used a simple method of converting RHI datapoints into deltas. RHI comes with an hour on hour granularity so I compared the RHI to what it was a couple of hours ago and saw if it went up, this was stored as a 1, if it decreased it was stored as a 0.

This gives you a chain of 1s and 0s. This looks something like 00000010000011111111010011111111. Here you can see 2 distinct chains of 0s and 1s with some noise. You need to remove this noise.

Honestly, how you clean your data is not that important, the above method is primitivebut effective.

Step 1: Identify stationary points in RHI

While the stationary points are consistent we can do better by indentifying points of inflection – as this will give us even more warning. You do this by seeing when the direction of the graph is changing. Sometimes this will be obvious like in the above RHI graph you see around May 23/24 there is a clear inflection point. Of course you would only know this a few hours later in case it is noise. You can set your tolerance for noise as quite low because RHI is very clean. In fact I set mine for only 5 hours as you would have cleaned all the noise.

Step 2: Buy or sell

Now all that’s left is buying and selling when you have set your stationary points. This gave me 16 trades over around 2 months. Of these 15 have been successful yielding about 183% on just buy/sell and double that on margin.

End notes

I have tested this on other meme stocks and while yields have not been as high (the last AMC trade I made yielded 88%) they have been great. I have not tested this on stuff like $AAPL or $GS and I doubt it would be as effective.

Algotraders take note! – you can make more accurate decisions with less noise tolerance although conversely you get fewer trades in. I tried with a few different scales and they all yielding nearly the same thing. Having said this, the fact that this works macrocopically and at a greater granularity is exciting.

Challenges

Making this work better- since we use RHI which is fairly abstracted we lose information so to speak. Using AHI or raw platform breakdowns have the potential to be even more profitable. If anyone plans on making something like these please hmu as I am interested to see where that could go…

Quick disclosure: this is an open source project of which I am a contributor. Also please do not take this as financial advise or make assumptions of its accuracy.

submitted by /u/sensingtrends
[link] [comments]

Jump To The Original Source

Share this Story
Load More Related Articles
Load More In Stock News

Facebook Comments

Check Also

U.S. Justice Dept. to ‘strengthen’ policies on getting lawmakers’ records

Published by Reuters By Jan Wolfe and Lisa ...

Archives