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)


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:


If predicted/close-1 > Long Threshold


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:


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


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.


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:



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


395 Trades


666 trades (spooky)


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.


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