Using an automated day trader to generate income(fattyfatfat.com) |
Using an automated day trader to generate income(fattyfatfat.com) |
On a similar note, say this guy did lose his $3500. Do you think you'd be reading this post on how to automate day trading? Randomness and the survivorship bias play a huge, huge role here.
As far as the website ideas go, I'm pretty sure that some very smart people have demonstrated that using past performance to estimate future performance simply does not work; no amount of tweaking buy/sell algorithms will help you predict where the market is going tomorrow.
you're exactly right. its just a bunch of if then statements. I played with quite a few variations of a VERY simple, primitive strategy.
I'm the first to admit that that day's P&L was largely the product of luck. In fact, I had quite a bit of remorse after the fact and was thankful that the coin flipped my way that day.
Regarding predictive engines, you're definitely right as well. Most educated financial professionals don't believe tat you can predict future price movement with any degree of certainty, but there IS a fairly large following up that believes that price behavior is at least price reverting in the short term.
I got lucky, I basically flipped a coin and HAPPENED to do it on a day where the SP500 moved a LOT. moving averages do TERRIBLY in environments where the market doesn't trend hugely in one direction. I think I talked about that a bit later.
On that note though, I still work with this, though my approach has changed dramatically. Its certainly possible to structure a trading strategy to fit your risk profile.
Nobody can win every time, but you can design the strategy to provide losses you are comfortable with.
Regarding tweaking buy/sell algos to predict future movement though, there's plenty of literature on that on both sides, so I won't really argue with you.
If you're itnerested, I recommend reading about high frequency algorithmic trading. You can also read my similar blog posts about why I think technical analysis is absolute drivel and the potentical justification for running a moving average algo.
This is not always true.
I had a theory a few years ago that went like this: The price of a stock is a direct function of the perceived price of the company multiplied by a risk factor: The more risk the less the stock is worth. On the day the yearly report is publicised for a company the risk is big just before the publication because nobody knows for sure what the numbers are, and low just after the publication because everybody now knows. So according to my theory the stock price of an arbitrary company should statistically go up on the day that the yearly report is made public.
I, painstakingly, found some historical data on this (it wasn't easy) and found that it was spot on. A bit of statistical analysis showed thet there was a definite gap to be exploited.
A friend of mine showed in his Masters thesis that there were certain patterns that would almost always be present in IPO's that could be exploited if you knew them.
So there are definitely loopholes where past behaviour shows future performance, but not a lot of them.
And professional investors aren't always as smart as they're made out to be. I know a few, and hackers are a lot smarter in regard to numbers.
Genuinely measuring the market (by trading) changes it.
unfortunately, i didn't have as much time in college to study this as i would have liked, and all of the good volatility data seems to be hidden behind a pay wall (bloomberg stations!)
one thing is for sure: even though the market approximates efficiency, there are still arbitrage opportunities to be found in the right places.
My personal this-is-what-i-think theory is that there are lots of patterns in the pricing of equities and other market components, but if they ever become publicly known, they cease to exist. The best hedge funds (or best traders, take your pick) manage to find patterns that no one else does. This does not protect them from a spectacular implosion if their models for some reason become invalid.
There is a cult of believing in the perfect randomness of market pricing. Saying that market developments are random is practically the same as believing in the efficient market hypothesis. The market cannot be perfectly efficient, because there are always interactions that no one will be able to predict. Most of these interactions are no doubt chaotic (unpredictable), but there is no way that traders instantly discover every pattern that is predictable.
You can game this by looking at historical IV for pre-earnings and see if the current is over/under. You can then sell straddles or strangles if you think the price will stay in that area.
It's even better for GOOG because they always release earnings right before options expiration, so there's a ton of voodoo going on in their price.
There are historical prices available at finance.google.com. Backtesting your strategy before playing around with real money is probably a good idea.
I recommend Random Walk Down Wallstreet or Fooled by Randomness or, if you really want a brutal introduction to randomness, play and study the mathematics of poker.
If price goes up then sell, if price goes down then buy. If the company meets these financial criteria then buy, if not then sell. If the price approaches a resistance level then sell.
Whether your basing the investment decisions on fundamental or technical analysis, either way its an IF/THEN statement at some level.
By how much? Within what time period? Are there any other factors that might be pertinent?
The world is not simple.
1. Why did he decide to enter into this strategy at 10:45 am on October 15th? 2. What would the outcome of the same strategy have been if it was left running for the next month, for the past year, for the past 10 years.
I'm curious.
Questions about how the backtest was run.
1.How do you get your data? 2.you seem to have written an excel spreadsheet to run the backtest, what's going on with that? How did you design it?
For other people on HN, does anyone here use backtesting tools? What do you think of the existing software you use?
For instance, it would have a few algorithms built in, you could choose which you want and with what parameters and then it would monitor how it performs. Also available would be the ability to see how this algorithm would have performed in the past (to see how it worked in bad markets, etc).
It could also have a generic API to allow you to run your own algorithm on your end and simply make calls to BUY and SELL certain things.
(In the future it could even allow _real_ trades, etc. One other cool way to make money off this would be to actually invest in the best performing strategies as they occur over time.)
I'm guessing this is all available to the big firms, but haven't ever heard of anything geared to the hackers who want to try things out.
Does anyone know if this sort of thing exists? Would anyone else think this is neat?
This should do the trick. I've never tried it myself but certainly looks interesting. I know of a few people who use it to try out different systems.
You can pull close data from Y! Finance.
Tradestation and metatrader work well for backtesting.
I've personally never used it. I just download raw pricing data then backtest it myself. You could learn how to do it on even yahoo data if you wanted (for day-over-day trading). Bloomberg is by far the best for intraday price information.
The cost of a ES mini (SP500 mini future) trade is $2.40.
Stocks trade for half a penny to a penny per share with a minimum of $1.00 per transaction.
I think they require 20k to start a new account these days though.
IB has been by far my favorite brokerage
I use thinkorswim because I'm an options guy.
http://individuals.interactivebrokers.com/en/main.php
Tradeking is $4.95 per trade.
Any books you'd recommend to a programmer with day trading aspirations?
http://fattyfatfat.com/2008/12/moving-average-crossover-theo...
I modeled the woodiescciclub.com trading strategies, primarily because the math is simple and the patterns are well defined. However since then I've seen other parties on the web talk about how the Woodies patterns actually don't make money consistently, although I didn't corroborate this.
I actually found CL to be a fantastic language for this. I was writing up the Woodies patterns using a DSL I had created:
(defpattern zlr "Zero Line Reject" :with-trend
((count 1) (within 100 250) (trend :up :or-opposite-invert))
((count 1) (within 100 200) (trend :up :or-opposite-invert))
((count 0 10) (within -50 99) (trend :up :or-opposite-invert))
((count 1) (within -50 50) (trend :up :or-opposite-warn) (angle :down))
((count 1) (within 0 115) (trend :up) (angle :up) (away 8)))
(defpattern hfe "Hook From Extreme" :counter-trend
((count 1) (within 200 300) (trend :up))
((count 1) (within 0 199) (trend :up) (angle :down) (away 3)))
...etc
The defpattern macro was creating, for example, #'is-zlr, #'is-zlr-up, #'is-zlr-down, which were then used by a trading engine that monitored 5-minute bars on a given futures contract and launched trades.Another CL feature, restarts in the condition system, helped too. When the data feed broke or got corrupt, an exception thrown which could reload the data feed and restart back in the listening loop without forgetting any context was helpful.
Also just running in a Lisp image was great because I could swap functions during a live feed without stopping the program.
In the end, the programming worked great, but the trading system lost money. I had it working in backtesting over a few months and then papertrade mode for weeks, and then when I took it live, the volatility rose and it started hitting the stop all the time. I adjusted things like stops based on ATR, but I really just ran out of my little budget to play with it.
It did however teach me CL. ;-)
Modern trading platforms have built-in tools and programming languages and writing things from scratch in CL is really just an academic exercise.
I believe it's possible to do algorithmic daytrading, but quite a bit more difficult than it seems. There are way more market behavior modes than you can appreciate at first, and the keys to success lie more in counterintuitive aspects of your system like position sizing rather than intuitive aspects like entry strategy.
The best talk I heard from someone on the subject indicated that it takes years and the end result is a fairly sophisticated algorithm-switching engine, because the hard part is just to survive.
That's not the most polite thing to say. Some of the people who give day trading advice might even be sincere and not know that they are frauds. But it's the truth.
2. Yes, it is that simple. Note that simple != easy.
if (mktStatus == FALLING) {
Sell();
return true;
}
if (mktStatus == SURGING) {
Buy();
return true;
}
if (mktStatus == FEAR) {
Loathing();
return true;
}
if (mktStatus == OVERMYHEAD) {
UseProfanity();
return true;
}
return true;Most languages I am familiar with require booleans to be either TRUE or FALSE, although I have met a few where undefined or NULL are possible values.
But seriously -- the author's comments seem to indicate that he is not totally comfortable with the technique and that he is aware it could lose, even though it didn't in this case.
I still dabble with variations of it (made like 250 bucks last friday), but I'm now doing way more research and backtesting before I drop things into the market for real.
I did it for fun, to learn, to gamble, and hopefully get lucky. God knows I've spent money in worse ways before.
Regarding the theory that other players would jump in the market and cause the opportunity to go away: you're right, but they'd really have to parametrize the same strategy in the same way as you. thousands of people use moving averages already, but all parametrized differently so they produce buy and sell signals at different times.
There's certainly no ideal parametrization that is alawys profitable, as most research shows (and I tend to believe)
There's other quant strategies that HF's use... like taking a bid out of a stock near support to trigger all the stop loss orders and then covering their shorts quickly.
FWIW I think open source software is a great thing but in general a horrible way for any sizable corporation to try to make money.
Fund your IRA to the max, and if you're 20+ years from retirement buy all ETFs with low expense rations. If you're closer to retirement, buy fewer stocks and more t-bills, etc.
Sure, its highly controlled gambling, but you of all people should realize that its not a losing game for everyone. If anything, its just a suckers game for small timers -- like all other gambling.
No, it's not. Far from it. EMT is not practical in the short term.
The Intelligent Investor - Warren Buffet's favorite
A Random Walk Down Wall Street for one perspective.
Mark Douglas books for a different perspective
Options Volatility & Pricing for the technical stuff.
And Inside the Mind of a Street Addict for the bathroom read.
Options Volatility and Pricing by S. Natenberg (sp) is a great theoretical primer for options, though typically a bit dense for people outside the industry. The writing style is brutal, but this book has probably made more millionaires than any single other book in history. Walk around the option exchange floors and every clerk has a copy, to this day.
Read Van Tharp's Trade Your Way to Financial Freedom it's a must... teaches you that the entry is not important. It's the position sizing, risk management, and the exits.
Also: - Options as a strategic investment
- Mind over markets
I still stand by my above claim that Tech Analysis (and especially LONG term trending) has no theoretical basis, except for the fact that everyone else believes in it.
Outside factors like news don't occur everyday, so the using technical analysis for intraday trading is very reasonable
And there is statistical data to back up that trend following does work.
and on having the "secret sauce" to beat the market. Read about Edward Thorpe. He's a badass. He wrote the book "beat the dealer" which was the bible on counting cards and beating vegas at blackjack.
Then he figured out how to price options (convertibles, really) and made a killing in his own hedge fund (Princeton Newport Associates, I believe).
He had the secret sauce, used it to make a killing instead of publishing it. YEARS later, black and scholes published the essentially SAME formula for price options and eventually won a nobel price for their work.
But Thorpe stuck to his guns and made his fortune. Merits to both sides, I suppose.
In this particular case: a Nobel prize.
See Fooled by Randomness for a more detailed explanation.
You can treat it as gambling yes, but it's not.
Again, read Fooled by Randomness.
However my opinion is that Forex is not gambling. In wagers to win big you must either combine different bets with odds that pay as someone predefined. If you combine more, the need for luck increases. If you bet a large amount of money on high paying odds then again you need luck.
In contrary, foreign exchange you just trade the currency according to your prediction. The only way to automatically lose the negative lot is going off your margin. To win big, your prediction doesn't need to go against the odds like a soccer bet for example.
But, I will check out that book. Thanks
As for the attacks on technical analysis, many practitioners probably are deceiving themselves that they've found some secret sauce. However, since the market is made of 100% of the people who transact in it, the presence of technical traders means that there must be some price movements as a result of these trends. One ideal would be to find a strategy that beats other technical analysts to the punch. A lot of people use the 12/26 MACD, but maybe the 11/25 MACD would help you eat their lunch before they entered the market...
It is all very tricky and takes a lot of discipline to avoid fooling yourself and getting into real trouble. Also, people need to make sure to focus on both sides of the trade - you only book the profit once you've actually sold the position (most people seem to be much more focused on entries than exits)
If anyone is interested in this kind of software but aren't so into learning a new language (perhaps less applicable to this group), you should check out QuantRunner Software http://www.quantrunner.com. In full disclosure, I am the CEO of the company, but we really focus on making this kind of back testing analysis easier for people to do without programming experience. We also have some novel tools for helping people actually improve their strategies, rather than simply iterate tests. If I had the true answers on the best strategies, I probably wouldn't run a software company. All we hope for is to make it easy enough for people to do their homework without having to worry about coding errors as well as poor strategies.
In practice, no. Trading a couple lots of /es futures will not do much to the market. More like pissing in the ocean. In illiquid markets you can move price, but not the stuff that you would want to blackbox anyways.
And since making money is presumably based on volume, if you did small trades, you'd end up doing a lot of them to make it worth your while. But in almost all forms of betting, it's better to make fewer, better wagers.
And since making money is presumably based on volume, if you did small trades, you'd end up doing a lot of them to make it worth your while.
Not true with futures. They are risky, but you can get some pretty nice returns, especially in the volatility that we're having right now. On a single contract you can expect to pull 1k-2k, and that's on one trade per day. In terms of R, you're looking at 10R-20R per trade if you're experienced enough (>2 years).
I'd much rather have 10,000 independent bets each with a 0.5% edge than 10 independent bets each with a 20% edge.
The volume on the day the reports came out was quite heavy, but if you had bought a substantial amount of stock it would certainly alter the market as you say. The point is that I'm pretty certain there are holes that will allow you to look at historic data and make statistically good buys - but you have to look where noone else is looking. Like the correlation of Nokia stock to the Finnish weather. Some of these will be large enough that you can make money, even though you alter the experiment.
On an unrelated note - I just read through your blog and found it very insightful :-)
And thanks!
Not with trading, you want to cut losses quick and let winners run. The model behind Long Term Capital Management, as well as a ton of quant firms that went under this past Q, was the take-a-bunch-of-trades-for-small-profit... and it works until you get a six sigma event (see 2008).