Live data from Hacker News

Show HN: I discovered a trading algorithm that returns ~24.85% annually

github.com

111–120 of 134 posts

Re: Show HN: I discovered a trading algorithm that returns ~24.85% annually

#111
post #2

This is a simple trading algorithm I discovered that operates on the Vanguard sector ETFs. This backdating algorithm provides on average a return of ~0.0878% for each trading day, or ~24.85% annualized return assuming 253 trading days per year. ## The Algorithm This algorithm is really simple. 1. On day `n`, determine which ETF gave the highest return 2. On day `n+1`, short sell the previous day's highest performing…

Checkout strategy in this book. It has a similar strategy but overlays with 200 day SMA and RSI.

Larry Connors, Buy the Fear Sell the Greed

Re: Show HN: I discovered a trading algorithm that returns ~24.85% annually

#112
post #57

There are so many misconceptions on this thread about what makes a good quant trading strategy. First of all, if you're shorting US equities and making 25% annually, that would be awesome. Heck, even being flat would be great because a strategy that is long SP500 could also short your equities and be delta-neutral and likely have a much lower volatility for the same return. Second, so many people are mentioning commi…

You seem to know your stuff about this. Do you know any good starting points to learn about algorithmic trading? Any youtube channel or book?

/r/algotrading

- Trading Evolved, Andreas F. Clenow

- Systematic Trading, Robert Carver

- Developing & Backtesting Systematic Trading Strategies, Brian Peterson

- Algorithmic Trading, Ernest P. Chan

- Algorithmic Trading and DMA, Barry Johnson

- Trading Systems, Emilio Tomasini & Urban Jaekle

- Evidence-Based Technical Analysis, David R. Aronson

- Machine Learning for Algorithmic Trading, Stefan Jansen

Re: Show HN: I discovered a trading algorithm that returns ~24.85% annually

#113

Earlier quoted context omitted.

Don’t know why this is on HN front page given it is an error.

The wording in the original comment was too strong, I've edited it. It's probably not best to consider it a plain "error" since this calculation is actually a typical one provided in finance. It's just that you usually look at other stats too rather than just this one, which gives you an idea about its accuracy wrt realized return e.g. Sharpe, Max Drawdown, Skew, Kurtosis

No, you were correct, arithmetic mean of returns is not standard in finance. If it was, financial crashes would be much worse. They do arithmetic means of "log returns" because 1/n sum(log(r)) = log(product(r)^(1/n)). That is, in log world, the arithmetic mean is the geometric mean.

Re: Show HN: I discovered a trading algorithm that returns ~24.85% annually

#114
post #57

There are so many misconceptions on this thread about what makes a good quant trading strategy. First of all, if you're shorting US equities and making 25% annually, that would be awesome. Heck, even being flat would be great because a strategy that is long SP500 could also short your equities and be delta-neutral and likely have a much lower volatility for the same return. Second, so many people are mentioning commi…

You seem to know your stuff about this. Do you know any good starting points to learn about algorithmic trading? Any youtube channel or book?

I'll spare you the years of money + research, the majority of it all funnels back into "mean reversion" as the core operating principle. Ceteris paribus in terms of information advantages of course.

You can get good at eeking out those advantages and exploiting them, but you're talking about making it your job to find financial "security holes" where the reward is printing cash. And there's a lot of really smart people spending a lot of time doing that. And you have to consistently find new holes as each one gets closed by market participants as you reveal your hand. And then you have to ask yourself if that's how you really want to contribute your time to the world.

If you don't think it's your calling, best to find products/companies you really believe in and make calculated risk-taking investments. As Carnegie would say "put all your eggs in one basket, and then watch that basket"

Re: Show HN: I discovered a trading algorithm that returns ~24.85% annually

#115

As others have said, "Average return is just one statistic". When trading, losses hit harder than wins. Go up 50% then down 50% and you're not even, you're down 25%. The degree of overestimation from this mean return -> "annualized return" calculation depends on what the returns distribution looks like. Here's the calculation used in main.js line 77 applied to a very extreme unrealistic example. I simulated 253 days…

> Go up 50% then down 50% and you're not even, you're down 25%.

It helps if you measure in the right units[0], namely bits, orders of magnitude, or fractions thereof. Up 50% is log(1.5) = +0.58 bits, down 50% is log(0.5) = -1 bits, and indeed 0.58-1 = -0.42, or 1.5*0.5=0.75, down 25%.

0: Well, strictly speaking the problem is that up/down X% isn't even in units at all.

Re: Show HN: I discovered a trading algorithm that returns ~24.85% annually

#116

Earlier quoted context omitted.

Sorry guys - it should have said: All the way to the moon.

The algorithm has a buddy: The algorithm of just buying the worst performing etf of yesterday.

Using the OP's data, that inverse algo is a dead loser.

Re: Show HN: I discovered a trading algorithm that returns ~24.85% annually

#117

As others have said, "Average return is just one statistic". When trading, losses hit harder than wins. Go up 50% then down 50% and you're not even, you're down 25%. The degree of overestimation from this mean return -> "annualized return" calculation depends on what the returns distribution looks like. Here's the calculation used in main.js line 77 applied to a very extreme unrealistic example. I simulated 253 days…

> Go up 50% then down 50% and you're not even, you're down 25%. It helps if you measure in the right units[0], namely bits, orders of magnitude, or fractions thereof. Up 50% is log(1.5) = +0.58 bits, down 50% is log(0.5) = -1 bits, and indeed 0.58-1 = -0.42, or 1.5*0.5=0.75, down 25%. 0: Well, strictly speaking the problem is that up/down X% isn't even in units at all.

I assumed they meant dollars.

Re: Show HN: I discovered a trading algorithm that returns ~24.85% annually

#118

Average return is just one statistic. You can earn an arbitrarily high daily average return by taking an ordinary strategy (e.g. buy and hold the S&P 500) and applying large amounts of leverage. Returns will be great until the strategy blows up. What was the volatility of this strategy? When backtested on the historical data, what was the maximum drawdown? What happens when trading costs or slippage (buying at the as…

He is trading Vanguard Sector ETFs, I doubt there is any issues with execution quality or getting blown up by a rise in volatility.

Any issue with execution quality would really hurt profitability, however. The yearly average rate of return is noted as about 25%. If there's a 0.1% slippage on the buy and sell sides, over a year's worth of trades that profit is gone.

And I'm not worried about "getting blown up" by a rise in volatility (although since this is fundamentally a short position it would be blown up by a theoretical 100% rise in a sector ETF), but I'm more interested in the risk-adjusted return or Sharpe ratio.

Since individual sectors are less diverse than the market as a whole, and since this strategy invests (shorts) one sector at a time, I would expect it to see greater day-to-day variability even before the reversion to mean comes into play. I'm curious about how much greater.

Re: Show HN: I discovered a trading algorithm that returns ~24.85% annually

#119
post #57

There are so many misconceptions on this thread about what makes a good quant trading strategy. First of all, if you're shorting US equities and making 25% annually, that would be awesome. Heck, even being flat would be great because a strategy that is long SP500 could also short your equities and be delta-neutral and likely have a much lower volatility for the same return. Second, so many people are mentioning commi…

You seem to know your stuff about this. Do you know any good starting points to learn about algorithmic trading? Any youtube channel or book?

Might checkout this course. The videos are online for free & the syllabus has some pretty good resources as well.

http://lucylabs.gatech.edu/ml4t/

The former instructor / creator & author of one of the books eventually joined JP Morgan as a ML research director (cant recall exact title).

Re: Show HN: I discovered a trading algorithm that returns ~24.85% annually

#120
post #66
post #5

Earlier quoted context omitted.

It looks like it is mean reversion. This is my first time hearing that term. The way I discovered this algorithm was initially I wanted to buy the previous day's best performing sector ETF, with a hypothesis that the momentum would continue. But I learned that it actually ended up losing money. So I decided to inverse the algorithm. There are still a few optimizations I can test out, e.g. Buying the previous day's wo…

No offence, but how can you have spent any time trading without knowing about mean reversion? It's the most basic and well known phenomenon in trading, along with momentum.

there are a whole lot of people losing money in the markets while knowing all about prior art and terminology.

There is a good reason successful hedge funds like RenTech are not hiring finance people but mathematicians who have no idea about "mean reversion" and other pseudo-scientific terms.

Post reply on HN