1.28.2012

Price Feed Failures

Lately, I have been having trouble keeping a connection to Oanda's pricefeed. I keep getting disconnected and then eventually my programs tolerance level is exceeded and it times out and dies. If you will recall, last year I migrated everything to the cloud. Sadly when I did that migration I failed to replace my fail-over system which alerted me when failures like this occurred so I could take action. Since my desktop was my trading server until that point, it was simple enough to have alerts be generated on it to awaken me even from sleep if necessary. Due to programming changes I made in separating out the individual bots from the price feeds, the bots themselves are completely unaffected by the price feed failure, at least from a technical standpoint. From a practical standpoint, they will not be getting any updated pricing information, and will therefore not be able to properly manage trades. I think the next step here is to implement some more automatic failovers to potentially other datafeeds if necessary. I have found a couple potential feeds that can work as a failover in a pinch -- the question is would you rather have data that is potentially 10 pips or more off your brokers feed, or no data at all? In most cases (depending on the strategy) I think having a general idea of where the price is, even if it's a bit off, is better than sitting blind. If we execute trades on the prices generated from the failover feed, we'll chalk up the execution price against the opening price as slippage anyway. Automatically failing over, and then rotating back to the real feed at some point will be a technical brain teaser to solve. The most interesting piece will be making the transitions transparent to the strategies using the feed. However, I also need to bulk up my alerting system so I am aware of what's going on as needed. This will likely consist of getting email alerts sent to my phone again. As it stands, if I can get the email, I can login and respond to whatever issue may be occurring. Last but not least, I need to figure out why the feed is failing and if possible fix it. I started what is now a half finished debugging session almost a week ago. There has been with no movement on my end to finish it. The potential for some better trading should hopefully be motivation enough to take a serious look and overhaul the alerting, failover and reporting systems I'm currently using. The importance of this infrastructure can't be understated. Now to find the time to implement.

1.26.2012

Still watching the euro

Since my last post, the euro has indeed put on an impressive rally back. People are doubling down on there shorts and just getting crushed. This momentum was really easy to feel in the ticks before the event. Still, I like to sit out counter rallies as a matter of safety -- it's way to easy to get caught in reversals and whipsaws. So what is the new trend for the euro this year? That anyone's guess -- as for me I'll just being watching and waiting for new trends. With statements like "low rates through 2014" from the Fed and Bernanke, the euro might not be the worst of the failing currencies in 2012 and could instead see us rally back towards 1.4X.

1.21.2012

Some manual trading down the euro

While the breakout bot has been holding a ~1.33 EUR/USD short for almost a month now, I decided to get in on the action with a little manual trading of my own. I was inspired by my visit to Hungary and being on the ground in Europe again, I felt the urge to get in on the action. My trading coincided with the large downtrend starting right after the new year and ending only a few days ago. Oanda's new trailing stop feature came in very handy, and I must admit it was nice to trade from the UTC+1 timezone. The euro is now counter rallying and we'll see if indeed this short play is over and we'll tread water again, or if the 1.2X's are here to stay this year for the euro. Time will tell.

1.20.2012

Visiting a currency crisis

In my time trading forex, I never really stopped to consider the physicality of it all. We're dealing with real money here. Most of it is paper mind you, but it's physical nonetheless. And it's being exchanged for goods and services. People are collecting it, spending it, or simply wishing for it. In general more people understand and are involved in the stock markets, but honestly the currency markets play a much more vital role in there lives.

Now despite the dollar gloom and doom, we're in luck that our currency is one of many fiat currencies trending to zero. Since the rates change at any time, we're not always winning that race (here's to hoping the dollar comes in last, cheers). We can look to our European friends to find several examples of failed currencies, not only within my lifetime, but also my trading lifetime. The Turkish lira, and the Icelandic krona to name a couple. I remember watching the bid price on kronas blow up live. What a crazy day that was! However, I was not in Iceland at the time, nor invested in the currency. What happened on the ground when the paper became worthless? What did people do?

This past week I got to experience the fragile beginnings of such an event. Visiting Hungary let me see and touch the bills that may one day be worthless or otherwise replace. Hungary has never quite recovered from the 2008 financial crisis and the pain is getting worse. Having accepted one IMF bailout, they find themselves asking for another.

So what did the country look like? The bars certainly seemed full. The streets still busy and the restaurants still serving food. Yet there were rallies and protests in front of the parliament building, and whispers on the streets. Currency was leaving the country and locals talked of moving money to nearby Austria and other foreign banks. The feeling in the air was a nervous laughter, ripe with anticipation of knowing what must come, while still hoping it won't.

How does the collapse of the dollar look? What will history say? I can imagine a similar story when the time comes.

11.17.2011

Trading engine update

Sucess! As of this evening I have a live version of the new strategy engine running a breakout strategy in demo. Porting the old strategies over and refining the engine will likely continue for several weeks. I'm quite happy with how things turned out, but there is always more to do. I'm sure this will not be the last update to the strategy engine.
For the technical minded, let's just say hashes are really neat data structures, and without them this consolidation would not have been possible. ;-)

11.10.2011

Updating the trading framework

It's been some time since I spoke about the engine behind the robots and strategies I trade. I had a wonderful coding marathon last weekend the result of which is many new improvements in the trading framework I am using. Although I solved several issues and cleaned up many things, there remains a piece I haven't quite been able to clean up.

I have the dilemma of writing code that is clean and maintainable, while having client side strategies that are really one-off programs. The server side backend pieces are abstracted away and objectified nicely, but that doesn't help with the client side implementations. Simply stated, I have a template I wish to use for all new strategies. This is easy to do. The trouble comes when I update the template (fixing a bug, adding new cool stuff, etc), the strategies of course don't get this update without me manually merging it across. This is not scalable as the number of strategies grows. The trouble with creating a generic class and having each strategy extend it is that each strategy has unique pieces and I don't believe I can abstract anymore pieces away. This is of course despite the fact each has a common workflow. Creating a generic client class is the answer (unless a programmer out there can shed some light). Regardless this is a wall that is slowing progress on new trading ideas.

11.08.2011

Jesse Livermore, speculation, and people

I just finished re-reading Jesse Livermore's auto-biography,Reminiscences of a Stock Operator. What a wonderful read. In this post besides advocating anyone who hasn't yet read the text do so (you can find it FREELY available here: http://www.archive.org/details/ReminiscencesOfAStockOperator), I wanted to highlight a couple quotes from the book on people:

"I absolutely believe that price movement patterns are being repeated. They are recurring patterns that appear over and over, with slight variations. This is because markets are driven by humans and human nature never changes"

"On the other hand there is profit in studying the human factors, the ease with which human beings believe what it pleases them to believe; and how they allow themselves indeed, urge themselves to be influenced by their cupidity or by the dollar-cost of the average man's carelessness. Fear and hope remain the same; therefore the study of the psychology of speculators is as valuable as it ever was. Weapons change, but strategy remains strategy, on the New York Stock exchange as on the battlefield. I think the clearest summing up of the whole thing was expressed by Thomas F. Woodlock when he declared: "The principles of successful stock speculation are based on the supposition that people will continue in the future to make the mistakes that they have made in the past.""

"The message of the tape is the same. That will be perfectly plain to anyone who will take the trouble to think. He will find if he asks himself questions and considers conditions, that the answers will supply themselves directly. But people never take the trouble to ask questions, leave alone seeking answers. The average American is from Missouri everywhere and at all times except when he goes to the brokers' offices and looks at the tape, whether it is stocks or commodities. The one game of all games that really requires study before making a play is the one he goes into without his usual highly intelligent preliminary and precautionary doubts. He will risk half his fortune in the stock market with less reflection than he devotes to the selection of a medium-priced automobile."

On the surface, Livermore traded in a completely different world. Insider trading was rampant, stock manipulation and tip buy/selling was popular, bank runs were common... Hah, see not so different after all? In truth however, humans are the same. The same emotions that drove and controlled the market in Livermore's time do so today. We simply need to accept and understand this. I'll include a few more highlighting the inherent laziness and gullibility of man.

"The average man doesn't wish to be told that it is a bull or bear market. What he desires is to be told specifically which particular stock to buy or sell. He wants to get something for nothing. He does not wish to work. He doesn't even wish to have to think. It is too much bother to have to count the money that he picks up from the ground."

"At first, when I listened to the accounts of old-time deals and devices I used to think that people were more gullible in the 1860's and 70's than in the 1900's. But I was sure to read in the newspapers that very day or the next something about the latest Ponzi or the bust-up of some bucketing broker and about the millions of sucker money gone to join the silent majority of vanished savings."

How true! There is nothing new under the sun1! Re-reading Livermore's observations brings to mind the recent EVE Online ponzi scheme that rather successfully executed it's mission, netting a cool ~50k USD for its creators2.

All said, I will be continuing to study people. In understanding people, I will understand markets.



1. Ecclesiastes 1:9
2. http://www.evenews24.com/2011/08/14/the-1-trillion-isk-ponzi-phaser-inc-speaks/