Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
My First Quantitative Future Trading Algorithm

Future prices are usually rapidly fluctuating, this algorithm focuses on using clear past trends to take action through daily query. It will hold long position if there is a clear increasing trend in price during the past week or during the past five weeks and it will hold short position if there is a clear decreasing trend. it will choose not to act if the trend is not clear to avoid incorrect judgement.

Focusing on trends that are clear and pronounced makes the algorithm less prone to short-period fluctuations. Also, weighing relatively short-term trends over long-term ones makes it more sensitive.

Backtest results on futures such as SM, CN, and SY show generally reliable returns.

I am very excited to find this platform to learn and work on quantitative finance. Thanks to teachers at Hua'an Futures who taught me about future and quantitative trading and NICK WONG whose post inspired and guided me during my work!

Thank you and please comment anything you think I could improve on!

4 responses

http://www.automated-trading-system.com/trend-following-wizards-december-2018/

You might want to check out Jez Liberty's blog to see how the Big CTAs performed last year and for the past few years.

Hi @Zeno, perhaps you follow Jez's blog more closely that i, but i do have 3 comments regarding the article as per the link:
1) Renaissance Technologies and some other big names are missing from the table.
2) Jez has taken the Average of the results from the different funds. Surely, in any such comparison, the Median would be a better measure of "typical" behavior, in which case the value at the bottom of his table would come up by about a factor of 2, from 0.85% to 1.48%.
3) Presumably the returns numbers in the table are net of (probably fairly fat) management fees, whereas @Yuanhan Li's are the direct gross numbers.
So, are the big CTA recent performances just bad for their clients or also bad for themselves, i wonder?

Rentec is a very different kettle of fish, style wise. Jez's blog attempts to track pure trend followers and with that aim, I think his choice of CTAs is probably sound. I also like the simple sample systems he runs (for demo purposes anyway). Bog standard trend following systems which WILL catch trends when they are there to be caught.

Quite correct re fat fees which you can certainly add back in. This mob are still on 2 and 20. Although don't forget the high watermark - they wont get any fees if they are below it. Also Bill Dunn is (or certainly used to be ) performance fee only.

I have not done the work properly but I believe I am right in saying all or most of these guys have suffered quite an outflow of funds over the past few years.

I have a very hard time coming to the conclusion that Trend Following is dead. Perhaps it is just asleep? I traded the method on futures for around 12 years and gave up in disgust when my broker MF Global was Corzined taking a lot of my money with it. Most of which I admittedly got back eventually.

I am ashamed to admit my heart is still in trend following - an uncomplicated, simple, "honest" sort of approach. Just as easy to curve fit but far easier to understand how to avoid it than "stat arb" or however you define Quantopian's approach.

Frankly, since MF Global (which shook me to the very core) I have been sitting it out.

I can't help feeling that the real money is in asset gathering not in devising trading algos. Unless you can match Jim Simons. Which I can't.

Thanks @Zeno for these comments which, for the most part, are fairly well aligned with mine, and certainly very much so in the case of Trend Following ideas, which are also definitely my own favorites, both in trading my own small personal account and also in "algo development" here in the Quantopian setting. And to @Yuanhan Li, please excuse me for somewhat subverting your thread, but i hope the following will be of interest to you too.

Of course i know that the general definition of TF and how it is applied "in the industry" is at least a little different to my own personal definition which, as i remember writing to you (Zeno, under another name ;-)) somewhere else once before, is that at least to my way of thinking ALL trades that are profitable are inherently following trends on some (even if only of very short duration) timescale for the periods during which they are profitable.

So, by my own definition of TF, it can never be dead, unless the market ever became so completely chaotic that its behavior would be unlike anything ever seen (except on brief occasions) in reality. If TF looks to some people to be moribund, then my thoughts are that perhaps they just need to look at different timescales. There are still plenty of trends there, although it is true that they don't seem to last for as many bars (in whatever timescale one is using) as what they used to decades ago.

My own interest in TF is not just because it is "uncomplicated, simple & honest and easier to understand" (which it is, as you say), but also because if one starts thinking in different timescales then it is not only still very much alive, but also inherently has to remain that way for a lot of fundamental reasons, including the time it takes for info to propagate, the time delays between demand & supply such as when bringing new factories & mines on-stream, lengthy unfolding of government interest rate policies, and so on. In contrast to the "tricky stuff", "stat arb" or whatever we might call it, the fundamental underpinnings of trends do not go away irrespective of how many people discover them.

This is, i think, in sharp contrast to the more complex price patterns that are "discovered", maybe give some spectacular initial profits, but then only have a limited half-life before eventually disappearing when they are widely known. So to me, there are really 2 main categories of algos or trading systems: those based on "Ideas First" and those based on "(Price) Data First". In the extreme, the "data-first" ones are pure data mining without consideration of fundamental factors, or even of WHY they work at all. Some of them do work very well and, for those who are smart and fast enough, there are lots of profits to be made, but then the system will "age" and need to be replaced. I don't know for sure, but i think Jim Simons RT is probably predominantly but not exclusively of this type, and i guess these are also the "stat arb" type people at Q.

The other category of trading systems, the one that i broadly call "ideas first", focuses predominantly on understanding the underlying reasons for WHY something works and prefers to omit things for which there is no clearly evident logical cause. So this second group includes the "fundamentalists" like Warren B, and also all of the Trend Followers like us, of whatever specific denomination of TF they may be.

As for Jim Simons, not only is he a brilliant mathematician, but he also (at least according to what i read) has a large staff of other brilliant PhDs in diverse areas of physics, applied mathematics, pattern recognition, voice & other waveform analysis, etc, etc, and a lot of money to pay for cutting edge computer power that can probably only be matched by the military and a handful of other financial institutions. Personally, i think that even the best of retail traders or individual algo developers will probably just get further & further behind that particular leading edge over time.

However i believe there is still good (even if less spectacular) potential for people who use "ideas first" rather than "data first" approaches, who think carefully about things like trend following, fundamentals, and the meaning (and reliability or otherwise) of corporate financial statement items. Designing relatively simple algos which return around 10% pa with Sharpe ratios > 2, and "Specific return" > 2 or 3x what Q calls "Common return", all in an Equity LongShort setting is definitely do-able using only these sort of relatively simple concepts without any of the more "tricky stat-arb" stuff. At least what i'm enjoying doing is seeing how far i can go by being thoughtful but not "too clever" anyway ;-)
Cheers, best wishes.