Live data from Hacker News

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

github.com

71–80 of 134 posts

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

#71
post #7

You did not discover a trading algorithm that returns ~24.85% annually. You massaged an algorithm until it produced a 24.85% annual return training on historical data. Come back when you are ready to claim you have made ~24.85% per year with an algorithm you created 5-10 years ago. Deny it, Downvote it: Destiny still arrives.

He's using one of the most basic and obvious algorithms in existence, you can hardly call that "massaging".

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

#72
post #11
post #7

You did not discover a trading algorithm that returns ~24.85% annually. You massaged an algorithm until it produced a 24.85% annual return training on historical data. Come back when you are ready to claim you have made ~24.85% per year with an algorithm you created 5-10 years ago. Deny it, Downvote it: Destiny still arrives.

Serious question: I fully understand the idea of historical algorithms being no true indicator of the future. With that said....... If an algorithm consistently performs over 20+ years of data (through multiple black swan events, multiple major events), then why is it not safe to assume it likely will continue going forward? Wouldn't 20 years of "evidence" be a huge amount, such that future events likely wouldn't dev…

imo in market cycle terms 20 years isn’t that long.

especially since market paradigms shift.

ie the last 20 years have been low interest rates, low inflation, with strong secular growth in tech and stagnation elsewhere, and globalization

this varies a lot from the 60s or 70s where there was massive inflation, high in interest, etc..

we may be entering a new paradigm with the changes in fiscal, monetary policy and globalism running its course

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

#73
post #29
post #6

Earlier quoted context omitted.

I decided not to add trading commissions because most brokers have removed them after Robinhood entered the market.

Short selling, though, incurs an additional borrowing cost. That's been going up for ETFs since 2020. "The price of short-selling U.S. exchange-traded funds has jumped dramatically since the beginning of March as investors seek to stem heavy losses in the wake of the coronavirus epidemic, according to data from S3 Partners."[1] This needs to be re-run with the borrowing costs added. The fact that EFT short selling co…

There's no stock loan fee if you close the position the same day.

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

#74
This doesn't take into account taxes. If you are consistently profitable on a yearly basis you're expected to pay 100% of last year's capital gains split into Estimated Taxes every quarter going forward. That eats into your return if you're reinvesting profits.

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

#75
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?

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

#77
post #10
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.

I just downloaded historical data on Yahoo Finance and parsed the CSV files. There are definitely more efficient ways to do this.

Since the question was "How do you implement this" I assume they meant how do you automate the actual trading, not how do you run a backtest.

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

#78

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.

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

#79
post #69
post #11

Earlier quoted context omitted.

Serious question: I fully understand the idea of historical algorithms being no true indicator of the future. With that said....... If an algorithm consistently performs over 20+ years of data (through multiple black swan events, multiple major events), then why is it not safe to assume it likely will continue going forward? Wouldn't 20 years of "evidence" be a huge amount, such that future events likely wouldn't dev…

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.

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

#80
So let’s assume the trick works and everyone catches on. Surely we can’t all get 25%

And that’s the problem with any successful algorithm except buy and hold value investing. The latter being hard because it requires doing little, and nobody believes that which requires the least effort to be the best.

Post reply on HN