In case discussion goes cynical here, I can attest to the fact that this sort of thing can be done consistently and successfully for thousands of trades over months' time. These days though with HFT and "intelligent routing" your broker is your opponent in the equities world at least. When conditions become unfavorable to an algorithm things tend to fizzle out rather than wipe you out as long as you're not leveraged to the hilt. The point about optimizing is key: the best algorithm has the minimum number of parameters to tweak otherwise you're just curve-fitting. Whether you add value to the world is anyone's opinion.
Proceed at your own risk of time and money.
Then you know that forex is a bank driven market; these little "statistical arbitrages" (which should be a 4 letter word) are subject to scale. When they break, they drain you dry. The "street" is littered with failed FX traders. It is the crack rock of the consumer level game because you can muster such phenomenal leverage (it isn't regulated nearly as much as equities).
At the bank level, they can see who the counter party is and they track their interactions with you. If you milk them too much, they will block you and your trade is dead. I can attest to that.
What is worse is the consumer-level brokers are essentially running a game against you.
Caveat Trado
Even in equities, your brokerage is not your friend: if you place a limit order, there's nothing to stop them from placing the same order just a bit closer to the market and using you as their free stop loss.
As you see then, you may automate trading itself, but then your discretion is shifted from deciding what stock to buy or sell short to when to turn on or off an algorithm. The advantage I suppose is that an algorithm isn't necessarily directly tied to market direction.
I worked at a FX broker as a software engineer. When nerds first read about this stuff we all have the same knee-jerk reaction: "I write code. I'm smart. I could build a robot trader and make a Walter White pile of cash."
In short, I would recommend you stay the hell away from FX. It's bullshit. It's not like the any type of trading (algorithmic, quantative, manual, good luck charm) you see in stockes. I do thank the blog author for mentioning that his system never seemed to work long term. That's the key element most people can't accept.
Here are a few notes from my time in FX:
FX is traded on margin, and it's easy to lose all your money. Nearly every single person will lose all their money in FX, and those who claim success are riding a temporary wave. Even "experts" in the field can't hold big gains much more than a few weeks or months at best.
A few years back our company bought a trading system we'd been marketing like crazy and had customers buy into. Senior management decided to invest a 6-figure sum in this system with the intent of using the profits for employee bonuses. The day it crashed, not only did we have angry customers but our employees were pretty depressed.
FX trading systems are hype. Always. You'll hear the term "holy grail" in reference to trading strategies. That should be enough to keep you away. The real money is made by selling systems to idiots and writing books about it. As a matter of fact, you'll notice a lot of forums and blogs have referral links to brokers ;).
A common sentiment I heard tossed around traders and employees goes something like, "rather than trade FX, just go to Vegas and play roulette. At least you get free beers."
The technology is god-awful. You'd be blown away if you saw how shit-tacular the backend is that handles your money. I thought it was just the place I worked, but nope.
The company I worked for is very open and compliant, which I found admirable. This has continued to be their focus, so that's cool. Many brokers are corrupt, particularly if they're not in the US. Brokers have been caught increasing margins against traders, stop-gapping trades and worse. In the US the NFA is insane so they do a decent job of regulating, but it seems every year or so they nab a broker on something. Most NFA fines range in the millions so we took this seriously.
I have more war stories, but that's enough. Best advice: do not trade FX. I realize that may rile some of you, so be it. I wouldn't put my money near that shit.
If you just finished the post and you want to try coding up a trading algorithm for free, check out http://www.quantopian.com. It uses Python, not MQL, and provides free data and backtesting. (Yes, I work at Quantopian)
I studied a bit of market theory in college and learned about channel trading. The Efficient Market Hypothesis is just that - a "Hypothesis" - not a law. Plenty of academics have argued against it but they don't teach this in undergrad courses so as not to confuse students (this is seriously the answer I was given when I asked my teachers). Some people like Nassim Taleb are calling for a BAN on teaching entry level finance courses to MBAs who go out and gamble vast amounts of money based on incorrect theories.
I always thought that algo trading would be a good fit for channel strategies since the strategy is recursive in nature.
Does anyone have any pointers on how to implement channel type of strategies (as opposed to Moving Average strategies)? I'd be willing to chat about deeper into this topic.
FYI: Some (old) research shows that Exponential MA strategies make more and even out perform buy and hold strategies without taking into account tax advantages. If you have ever read a "Random Walk Down Wall Street" and don't believe in this "crap," it's actually in the footnotes of the sources the author cites.
What I found in my research is that the statistical analysis being done on markets is an approximation of the underlying phenomena. Yes - central tendencies and dispersion work 90% of the time, but they hugely under price tail events. This is the basis of Nassim Taleb's trading strategy.
What I see really happening is a recursive channel pattern at different time scales. As the recursion plays out it "zooms in" on the correct price of a security and the central tendencies and dispersion can be analyzed through traditional statistics. However, when a market correction takes place it "zooms out" by stepping back through previous market cycles and then statistical models break down. It's very weird to explain. Essentially, I see the market being a predictable Fractal pattern. Check out Mandelbrot's work on Finance to get some insight. I just disagree with his (and Nassim's) conclusion that these can't be predicted.
I've always been interested in trying to back test my theory but I didn't have the technical chops and didn't know where to start looking.
Thanks for your thoughts.
Yes it is as selfish plug but program is free and I have nothing to gain.
Is that still true? Or is algorithmic trading on a rebound?
High frequency trading typically refers to two concepts. 1) how long you hold your position, 2) how quickly you can send/cancel existing orders. Though I'll hedge and say there isn't a really accepted definition of high frequency.
Algo trading on the other hand refers to using a computer to automate trading strategies. The typical example is a pair trade with Ford and GM. When they deviate you sell one and buy the other, when the prices come back together you reverse the trade and sell the first leg and buy the second.
Algo trading is here to stay. High frequency has typically been more arbitrage focused and its followed the pattern that happens to all arbitrage opportunities and gone away as more people got in on the action.
There are algorithmic trading strategies that are high frequency, but not low latency for instance. Or low latency strategies that are not high frequency.
In my experience what people are talking about when they say that high frequency algorithms are producing less profits, what they really mean is that low latency arbitrage algorithms are not making as much profit.
Lots of high frequency algorithms remain profitable.
The FX market is a zero sum game and due to that its' incredibly cutthroat.
If they are taking the other side of your trade and the market doesn't reflect that, they've actually given you a free roll.
Evil broker places a $1.01 bid and gets a fill.
He immediately offers $1.02.
Case 1: The market runs up, he makes his tick on essentially zero commissions. On some markets, you earn commissions for providing liquidity.
Case 2: The market falls off, he smacks your bid and only loses a penny.
This is edge.
EDIT: When I say "the market", he could base his actions off an index. As for "free roll", sure... but there is still an impact on liquidity and you're in a situation where you are more likely to get a fill whenever the market is going against you.
The instrument heads toward your 5.00 target. If their order turns out to provide all the necessary liquidity at that moment, the sellers never reach you, and the instrument turns around and "Evil Brokerage" soon sell for higher. Alternatively, if the instrument is on a move and it going to go against you too, brokerage sell to you and they only lose 0.01/share. That's why I call the scenario a free stop loss.
At that point they can just tell you that your trades executed that way without the bother of actually going into the market.
Further, why would you stay on an execution platform that is so obviously bad for you?
Minor nitpick.
Since you've bought the stock first, your second trade will be a sell and not a short, unless you overfill on the second leg, in that case you'll have a partial sell and partial short.
Also, you're right, at a minimum, via a subsidiary it's possible for the brokerage to "fill" your order without it ever reaching the exchanges, I think as long as it's inside the national bid-ask price spread at that moment. They pitch this as a feature - it also lets them avoid exchange fees. Then they can manage their overall risk separately.
Yes, I stopped trying to make those trades years ago. At one time though it was a remarkably consistent way to succeed on a small scale.
This frequently is a feature for both sides of the equation due to lower fees, better execution rules, rebates, priority, etc.
I certainly know that I would never opt in to a platform that consistently provided worse execution (especially in the equities space where there are so many choices).
If this behavior is impacting your execution why are you still using "Evil Broker"?
They do that in FX (you're trading their market; it is up to you to know what is going on beyond their walls).
As for spoofing other markets, you can get away with front running.
Why trade with Evil Broker? Don't. I suppose you can argue the difference between trading and investing.
Now, if you want to trade, well, just know they're going to fuck you and lubricate appropriately.
As someone who's experience is way more on the commodities futures side of the house, I'm shocked that blatant front running is an expected cost of business in equities trading. Even in the highly monopolized CME world front running is considered beyond the pale.
I will say (in my experience in the commodities markets), 9 times out of 10 folks who claim that they are being front run are actually just unaware of how sophisticated their competition is when it comes to micro-book structure optimization.
I second your claim ("9 times out of 10") for CME. Human nature is to assign a complex answer ("they're reading the tape") to something very simple ("my model is shit").
That said, front running happens on CME, too. Again, it is the same construction: consumer sending orders through a nefarious broker.