Hacker News new | past | comments | ask | show | jobs | submit login
How to identify algorithmic trading strategies (quantstart.com)
127 points by slashdotdash on April 22, 2013 | hide | past | favorite | 66 comments



The obligatory reference for a thread about trading strategies is the collected works of Nassim Nicholas Taleb.

http://www.fooledbyrandomness.com/

http://www.amazon.com/Nassim-Nicholas-Taleb/e/B000APVZ7W

Structuring the trades to reduce your exposure to downside risk while increasing your exposure to upside from unanticipated random events is the hard strategy to implement, but it is the sole strategy for avoiding a gambler's ruin.


After reading Taleb's books and thinking about his strategy, it's akin to buying lottery tickets. Lots of little losses with a large win on infrequent random events.

It sounds more regal when you say "structure the trades to reduce your exposure to downside risk while increasing your exposure to upside from unanticipated random events" though.


Taleb responds to the analogy with lottery tickets by pointing out that lottery tickets have a strictly bounded upside (and a strict bound on the expectation of winning).


True, risk adjustments can be made to modify those bounds in real markets, unlike with actual lottery tickets where you have no control over the upside and expectation of winning. But the idea is still very similar in it's basic strategy.

Given Taleb's understanding and belief in randomness of the market, I see him as "creating his own lotteries" using rather sophisticated techniques that have paid off very well. The cost of entry is small and the potential rewards are high but he loses regularly and consistently and says he was grateful to be in a position where he could execute such a strategy without being looked down upon by his superiors (from Fooled By Randomness).


Another good phrase: "picking up pennies in front of a steamroller" - which is when you do the opposite strategy (lots of little gains, but with the risk of losing it all and more).


I love this term. One of my friends at work manages trading systems (for use by actual financial experts) and we were discussing this discredited strategy recently. It's killed one or two big companies, despite being a Nobel prize winning idea.


This specifically refers to a call of strategies that are the equivalent of writing a put option. The short term cash flows from the premium are not commensurate with the tail risk. Both LTCM and CDS on subprime are examples of this type of strategy going up. Typically the options have a duration of years which raises the probability of a tail event significantly.


I believe that this was coined in the book "Dark Pools."


You are not getting it :) The beauty is you keep the profit while the lost is socialized either via bailout or bankruptcy.

That is why Wall Street is #1.

Then you start another Wall Street firm. Ben will chip in the funding for basically free if you are well connected.

(This is also why Wall Street pays out all profit to real people, instead of keeping it within the firm.)


This also has a similar profile to the classic momentum - "trend following" - strategies. Higher quantity of loss-making trades (albeit small losses), but the winners win big.


>it's akin to buying lottery tickets.

More precisely, it's akin to buying mispriced lottery tickets with a high positive expected payoff that hasn't been priced in yet.


"Buying lottery tickets" is a good analysis. The issue is that normal technical trading (the kind Taleb criticizes) is "selling insurance" in disguise (years of small profits and then a huge "unexpected" blow-up).


I agree that "it's akin to buying lottery tickets".It is more of a protection than a strategy.


The canonical way to benefit positively from unanticipated random events is to buy volatility. There are many ways to do this - long delta hedged put/call options, long straddles/strangles, long butterflies etc. But perhaps the easiest way is to buy VIX futures.

Unfortunately, if you had a passive long investment in VIX futures since March 2004 (the earliest you could trade them) you would steadily have lost money - despite huge gains in the latter half of 2008 (and to a lesser extent in other periods).

The market is well aware that insurance-like products are useful, and so they are priced accordingly. Buying volatility is expensive.

The short vol "picking up pennies in front of a steamroller strategy" comes with the risk that you could be completely wiped out in a crisis. This happened to a lot of desks and funds practicing vol arb in 2008. But the flip side is that if you want to buy vol, you need to be able to absorb the punishing losses that can persist for years before you get to the big wins.


On the other hand, he's unilaterally refused to disclose actual audited returns for the funds that he's been involved with. This is very convenient for marketing his books and views, but creates an inaccurate impression of how profitable his approach really is: http://falkenblog.blogspot.com/2010/08/nassims-selective-ret... .


Structuring a trade to reduce downside risk while profiting from unanticipated random events is easy - just buy options. The problem is that everyone else knows this, so they're priced accordingly.


Excellent point!


I think the key thing that this piece sort of hints at is that there is money out there, but there isn't free money out there.

If you want to make money trading on the stock market (with algorithms or otherwise), you're directed to devote time, effort, skill, and a large quantity of start-up funds to the effort. Of course, you could also devote time, effort, skill and capital towards starting your own business (based around algorithms or otherwise) or you could devote time, effort, and skill towards just getting a job (programming algorithms or otherwise). Likewise, as there are big players in the stock market, there are big players in any market, and smaller, more nimble businesses can try and maneuver around them (or get crushed trying).

The stock market: just a part of real life. Neither a mystical land of fantastic riches, nor a freakish unholy pit of dishonest vipers and shattered dreams.


The trick is to treat quant trading AS a business. You are essentially running a capitalised startup when you begin quant trading. There is a period of R&D, building the product (execution system), and then iterating - just like creating a mobile/web app.

The main difference is that if you're not interested in raising external capital, then you don't need to do any marketing - all of your focus can be on the product.

I have made it clear in the article that it is NOT easy, nor a get-rich-quick scheme which many seem to think it is. It takes a significant amount of work to generate consistently profitable strategies.


Neither a mystical land of fantastic riches, nor a freakish unholy pit of dishonest vipers and shattered dreams.

Personally I think it's both of those things :-)

Trading is perhaps the ultimate convex work, to borrow Michael O. Church's term. A few extremely skilled people can pull money out of the market like magic. But the average trader's performance is worse than just buying a major index fund. And those of us below average (I am still in this group, alas) can pretty much count on losing money.

Your point that trading takes effort and capital that could be directed in other ways is well stated.


The general rule of thumb is that if a trading strategy is successful, you won't find it in a book. Books are useful for understanding the general concepts, but I use books in the negative sense (if I find the idea in a book, I immediately throw it out)


(Disclaimer: I am the author of the article.)

Consider the case of finding a set of strategies governed by a particular set of parameters in a book. For instance, the Moving Average lookback period. You will see authors posting certain strategies, albeit without revealing the market/time series with which they're carrying them out on or which exact parameters they use. This is the critical information, but it is also relatively straightforward to trial/test, assuming you have the available data.

Also - the same strategy, implemented identically, can be both successful AND a failure for two different traders with identical starting capital. Why? Because one may not have the stomach for a 50% drawdown in the equity curve, despite the fact that had they waited, a "big swing" would have been around the corner. It is as much about preferences/tolerances as it is about the actual rule set.


Obviously speed and implementation details matter significantly. Your firm may have a better backend or superior code that allows the strategy to work better. Much of finance is working with attorneys to shift the system in one's favor. Gaining access to markets that previously did not allow foreign algorithmic trading, earning fee rebates on trades not available to others, etc matter increasing more in a business approaching saturation.


I found your commentary on starting capital and the necessary willingness to let the algorithm run without interference especially informative. Thank you for the article!


It is much harder in practice than in theory to be disciplined enough to do this! I always remember this great quote (paraphrased):

"A quantitative hedge fund only needs two members in order to be successful. A quant trader and a dog. The quant trader is there to feed the dog. The dog is there to make sure the quant trader doesn't touch anything."


My rule of thumb is unless the person sharing the strategy:

* owns their own private jet/yacht/other signs of opulence

* didn't share it with anyone else

try to ignore it


"* owns their own private jet/yacht/other signs of opulence"

What if they got their private jet by tricking others into following the strategy?


That's pretty much how MLM works!



And don't discount that they own their own private jet just because they got lucky, or were in the right place at the right time.


It reminds me of this I read earlier today from http://www.theactuary.com/features/2013/04/the-mild-mannered... "The other experience that led to his change of mind was carrying out some research on London casinos. He found that the typical gambler was a successful, entrepreneurial businessman. Far from being there for the thrill of winning, or losing, money, “these people actually believed that they could win”.

He realised he was observing the upper tail of a distribution of people who were aggressive risk takers, yet naïve about the risks they were taking – the businessmen one sees in the casinos are the ones successful enough to have enough money to lose.

These same people provide the underlying dynamics of capitalism. They are not rational, they do not understand risk and are therefore prepared to take risks that a rational agent would not take. And it is these people who drive the growth of the economy.


That's not necessarily true. A market anomaly does not disappear instantaneously, but instead decays gradually as it is exploited and in turn becomes harder to exploit. Think of it as a radioactive half-life. Some research (I found the link on Mark Buchanan's blog http://physicsoffinance.blogspot.com/) suggests that half-life is quite long.


It depends on the timeframe. Trend-following anomalies may take years to go away but HFT anomalies disappear every day.


Quant trading is like anything - time and effort. You read a few sites, play with some data, read a few books, test and continually refine your strategies, learn more and brainstorm of new approaches. It can be pretty fun depending on who you are. But in the end I think enjoyment comes down to a love of problem solving, the difference with quant trading is it's financially self-sustainable and rewarding. Other projects lack the immediate pay-off, but take my word for it, will be more rewarding in the long run. Stick to your programming, your research, your show HN.

Also, the first cited site is Ernie Chan's which provides a similar established perspective


Having experienced all three, by working as a grad student, as well as in a quant fund and starting an internet/tech startup, I can say that I gained enjoyment from all of these roles.

Each experience presented interesting challenges. Quant trading was very mathematical, academically interesting and presented "big data" issues right at the start. Tech startups taught me a lot about management, getting things done (TM) and why you need to have a market BEFORE building a product! Academia taught me how to really analyse a problem to an extreme degree and how to quickly find solutions.

Right now I'm enjoying building quant trading systems. To a certain extent they can be fully automated (although you have to be aware of "alpha decay" - i.e. strategies losing their profitability over time) and thus it is possible to have other interests.


Shameless plug for a genetic algorithm based trading strategy app I made a while ago. It generates a bunch of strategies with good scores and then the UI let's you pick the one's you actually want to use. The second video is the demo: http://designbyrobots.com/2011/09/06/automated-design-of-tra...


Ways to make money in the stock market

- Own a trading floor

- Become a stockbroker

- Become a market maker

- Sell books on the subject

- Work for a financial institution


- Buy S&P500 or similar index fund with low expense ratio, sit back and relax for 30 years or so while collecting dividends


If you bought the Nikkei within the last 25 years or the S&P within the last 15 you're about as likely to be down as up, even including dividends.


In the article I read the following:

Despite common perceptions to the contrary, it is actually quite straightforward to locate profitable trading strategies in the public domain. Never have trading ideas been more readily available than they are today.

What is the input of the "retail" trader then? Especially considering that at this level tech does not make a difference (all have access to somehow high computing power).

By the way, any good backtesting tool in python or R? I started implementing a simple trading algo last week during my freetime (yeah, I have to go out more) and I was wondering how will I test it.


Have you seen https://www.quantopian.com/ ? Might be a good place to start.


There is no such thing as "consistent profitability" in trading. Trading is not a business where you make a product and sell it to someone, and the more and better you sell, the more you make. It is much more alike to gambling, but with probabilities of winning and losing a bet always changing. You need to know when to bet, but you have no way of knowing the probabilities beforehand. Thus you cannot be sure that your strategies will keep working tomorrow or a year from now. Nor can you be sure of always being able to develop a new strategy that is better than old one.


That is quite incorrect. There are many firms with consistent low volatility profits. Market makers are a good example.


Market makers are actually an example of "picking up pennies in front of a steamroller"


That is quite incorrect. Market makers are typically close to flat and are trading liquid instruments (assuming on exchange MMs like NYSE DMMs). The tail risk on a short duration trade of an exchange traded instrument is quite small, especially if the MM is not writing put options which this specific quote refers to. When writing a put option the premium collected by the writer is typically not enough to compensate for tail risk. Thus there is limited upside with extreme downside in the face of a tail event. Also the options tend of have longer durations (months or years). Firms pursuing this type of strategy are typically carrying a lot of mispriced risk on their books for a long time.


It might be true if you are talking about market makers that have an advantage over other participants due to regulations. However nowadays market making on liquid instruments is almost equivalent to high frequency trading. The tail risk might be low if you have very low latency and perfect connection to the exchange. Anyway your pnl distribution will be negatively skewed. You are unlikely to lose tons of money like Knight (their testing algorithm kind of actively tried to do it) but making a steady profit is not easy in liquid markets.


Hmm, like Knight Capital? Oh, wait..


A somewhat different situation.


Likely and apparently the unique, unchallenged, world-class, grand champion of stock market trading is James Simons. So, how'd he do it? Well, first he is a darned good mathematician.


Trading trading strategies? Getting a bit meta. The first thing to ask yourself is if you're a trader - from what I've seen it's a unique trait.


I would think that would be an interesting prisoner's dilemma gambit. Get other traders to follow a bad (or better yet: good but sub-optimal) strategy that has a side effect of making one's own strategy better. Of course if every trading trader follow this strategy and expects others to be engaging in it as well, what useful information or strategy will they pursue?


One part that's missing here is that a bunch of people following a suboptimal strategy may have the mass to overwhelm those following an optimal strategy (but who don't have enough capital to move prices in their direction)


I'm looking forward to the futures trading strategy futures market now.


Another strategy, as we've seen recently with mtgox, is to DDoS a trading service while placing massive amounts of tiny limit orders on it.


Someone discussed it here a while ago: https://news.ycombinator.com/item?id=2828804

"Most platforms slow down when there is an influx of orders into the market. Some are designed to force events during the process (which allows for action while prices move, but the prices may be stale) and others are designed to process all feed messages before forcing an event (which ensure prices are more up-to-date but doesnt allow you to make a trade earlier) Suppose you are betting that this represents a market rally or collapse (directional). Then, you can make money by figuring out the direction of the move (aggressive processing of the first few messages in a burst) and get involved before every other system catches up in the feed."

I imagine there isn't much money to be made in doing that on the equities or futures markets nowadays.


Try the calculator in this blog to see how easily one can be fooled by random data: http://www.priceactionlab.com/Blog/2012/06/fooled-by-randomn...


In other words, how to identify yourself as a market parasite.


Why do you think prop trading is parasitic?


Put server in basement of exchange, front run any trades before they actually happen between the party holding the equity and the one who will leave with it for the night. How is that not parasitic?

Running algo trading would get me fired so fast. (I work at a mutual fund company, though not just yet on anything trading related)


"Put server in basement of exchange"

The exchange colos are not in the same space as the physical trading floor. E.g. for U.S. equities, the NYSE trading floor is in NYC, but the machinery for all the major exchanges (barring CHX, I believe) is in northern New Jersey.

"front run any trades before they actually happen between the party holding the equity and the one who will leave with it for the night."

Front running is illegal, and as a prop trader it's not physically possible. In order to front run an order, you have to be in the path between the order originator and the exchange.


"Basement" as a colloquialism for "server room"


My impression (especially given his whole section on frequency of trading) was that this was NOT about HFT (which you seem to be describing), but rather a way to choose what to buy/sell and when.


It's a bit unclear: is it just about automated market research, or automating the transactions as well. The latter starts to wander into a gray area of trying to not get beaten up by HFT thugs for investments you plan to hold, or being an HFT thug oneself for investments you have not intent to hold or to run a naked short.


He's not describing HFT, he's describing an illegal activity that is not technically possible on any venue I know of.


How is HFT materially different than actual front running by a broker? You might not have individual orders from your own customers in front of you, but clearly your only interest in an equity is to find activity and sponge off a few cents by holding shares for a fraction of a second.

HFT is just a legal way to pull almost the same scam.


And you have no idea what your talking about!




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: