Live data from Hacker News

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

github.com

81–90 of 134 posts

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

#81

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…

Where do you take that uniform distribution from? I don’t think any ETF would conform to that.

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

#82
post #81

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…

Where do you take that uniform distribution from? I don’t think any ETF would conform to that.

[deleted]

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

#83
post #69

Earlier quoted context omitted.

It's very simple, the best strategy for the last 20 years (with hindsight) would be to buy the shares that have performed best over this period, but it wouldn't work better than chance going forward. Obviously, sitting down and creating that "strategy" would be silly, nobody would think that would work. But if you're using ML or just test a million random strategies, you could end up with something along those lines,…

> the best strategy for the last 20 years (with hindsight) would be to buy the shares that have performed best over this period, The best strategy doesn't seem to me to be straightforward to calculate, even with perfect hindsight. It might be to continually switch in the short-term most profitable asset, after taking into account the transaction costs and risks of influencing the market.

Sure, it's just an example. Let's say you're looking for the best buy and hold strategy then, the point is that what you actually want in the future is a strategy that doesn't depend on the particular circumstances in the preceding 20 years.

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

#84
post #9

What software do you use to implement algorithms like this? Do you have to write your own python/other scripts and interact with trading API's for whatever service you use, or are there nice pre-written open source trading algorithms that make building stuff like this easier.

There are cloud services which will run your trading algorithms.

Here's one I found just with a google search: https://alpaca.markets/

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

#85
Many moons ago I ran a site called ETF Timing that automated technical analysis against ETFs.

There is so much wrong with this I don't know where to start. But this seems common these days, I think it's due to the influx of inexperienced traders who have no proper statistical background.

I'll let ryanmonroe point out the first glaring problem with these types of simple "algorithms":

https://news.ycombinator.com/item?id=27415821

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

#86
Most mean reversion systems have a high win rate. But the profits from wins are usually small and a losses are large. You have a hard time avoiding losses because you have to let mean reversion trades run and you can't have small stop loss settings.

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

#87

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…

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

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

#88

Earlier quoted context omitted.

It is a mean reversal bet. It can work. But what if one of the ETFs goes to zero? Then the algorithm will continously buy that all the way down. Erm - edit - scratch that: But what if one of the ETFs goes to the moon? Then the algorithm will continously sell that all the way up.

It will short it for one market day and then ignore it.

It would short for the next day too if the EFT was growing enough.

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

#89

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.

At sufficiently high leverage any volatility is high enough to bring on a total loss
Post reply on HN