Polynomial Time Trend Model

Hey guys,

Interested to hear your feedback on the following strategy:

This is based on an article I wrote here, all the code, and my rather messy latex can be found on the link.

I have always been interested in trying to predict the beginning of a large trend. And this is my attempt at doing so.

So basically I want to fit a polynomial time trend using least squares on a rolling window. I decided to use a 24 hour rolling window, in order the model is sensitive enough to pick up movements in time to take advantage of them.

An illustration is given below:

(I made these numbers up for illustrative purposes)

https://preview.redd.it/r9r1429qp4r51.jpg?width=512&format=pjpg&auto=webp&s=73cc60d0a6b198bda3a65749cf8298cbb81bf08f

So I want to fit a model on in-sample data (red line) and then extrapolate from that into the next few periods (black dashed line).

My decision making on entering trades is:

LONG

If predicted/close-1 > Long Threshold

SHORT

If predicted/close -1 < Short Threshold

The idea here is that a quadratic trend can be approximated by a large forward looking model implied percentage change.

The preliminary results are as follows:

BITCOIN

2% target and stop loss. with -+3% thresholds. Around 250 trades in 2 years. Look ahead = 2 periods

https://preview.redd.it/y04662z0r4r51.png?width=640&format=png&auto=webp&s=296d5a02c52b48c7c89e58c99225cb142e6808e4

For the 30 minute timeframe, I just doubled the lookback/look_ahead from 24 to 48 periods, & 12 to 24 respectively. All else held constant. Although on 30 min timeframe there were 306 trades.

https://preview.redd.it/pvlp5epsr4r51.png?width=640&format=png&auto=webp&s=65a5e165b931921a6b0490443489880dd6880cee

I even checked the 5 minute timeframe, in order to keep the lookback constant at 24 hours the parameter becomes : 12 * 24 = 288, and I chose the lookahead at 4 periods. The number of trades goes up quite alarmingly to 601. But the results still look quite good:

https://preview.redd.it/roijkjsts4r51.png?width=640&format=png&auto=webp&s=6ce7c03abbfd734109d86af5ce844e23ae259faa

Ethereum

The parameters for the following charts are exactly the same as Bitcoin above. I think I probably should have constrained the threshold a bit for Ethereum since it is so much more volatile in comparison to Bitcoin. Although I wanted to keep things constant as a sort of sanity check that I didn't overfit for Bitcoin.

350 Trades

https://preview.redd.it/gw0kld43t4r51.png?width=640&format=png&auto=webp&s=059ad786cdf9f2ef768b98c2be068d2597a510d9

395 Trades

https://preview.redd.it/qgqdo9z3t4r51.png?width=640&format=png&auto=webp&s=14f3a5e0418557a13e6474a8b347d4ed20ab9a31

666 trades (spooky)

https://preview.redd.it/t2bo32rst4r51.png?width=640&format=png&auto=webp&s=b99ce3caee8636a69a70de0ce73b6678c2ec283f

Although transaction costs haven't been factored in, I think this is quite an interesting strategy that I may tweak a bit and move forward to paper trading ( probably to get a nasty surprise that it doesn't work as is the way with these things.)

I wonder if any of you guys with a strong background in statistics could perhaps point me in the right direction regarding something I found when researching this strategy. The plot below shows is taken from using the model described above to predict the +1 percentage change in Bitcoin. Notice that the red curve seems to be so similar to a Laplace distribution. I have had a look at the pdf of a Laplace and I am guessing the quadratic term in the model, causes this similarity. It looks like the tails of the realized distribution, are nicely approximated. I am wondering if anyone knows exactly why the predicted change looks like such a smooth Laplace curve, whereas the realized distribution is so 'jaggedy'? A pointer to textbooks / papers would be useful.

https://preview.redd.it/1q21kik8u4r51.jpg?width=512&format=pjpg&auto=webp&s=aef3ebd90e2e5cfdfd898fabeb8a4a603cbfa553

Submitted October 04, 2020 at 02:04PM by johncodearmo
via https://ift.tt/36wpBKT

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s