Friday, July 20, 2007

trading, programming, and math

I've been out of the spot forex market for a while now, but have finally finished modelling a trading system that, while not as "fish in a barrel" profitable as my previous dip-buying system, doesn't hemorrhage when the market turns sideways (reversals were just fine). The downside is that this system, unlike the last one, requires very active participation to work, more active than I can do while I keep my day job, and much more active than I can manage while asleep, so I need to automate the darn thing. Given the particularities of the bucket shopmarket maker I use, though, this means learning C#. The language doesn't bother me, and, in fact there are a few aspects of it that I like, like namespaces and partial-class declarations. But it also means learning an entirely new vast set of libraries.... ugh!

And I can't get back in the market without it.... But I did learn something nifty though: if you're simulating random walks of equal probability, which is what time-independent price-movements do when there's nothing significant going on, an easy way to add up the various path-dependent outcomes is simply to compute out the nth level of Pascal's Triangle! It gives you the summed-up potentials for free, rather than having to write a monte-carlo simulator just to do 50/50 probabilities. Pretty neat, and very labor-saving.

6 comments:

Anonymous said...

I saw C# and all I remember that huge long set of manuals spread across your desk back at the "I"

However I think I understand just enough of what you're saying math wise. But do you really have to automate it? What about changing the confidence interval on your model that allows for longer time frames that you can handle, or is forex that fluid? I guess I'm inquiring if your model is good enough to provide you with an acceptable level of uncertainty/risk that if you invest in say, Rupees, on Monday you'll have enough time by Friday to make a follow up decision that won't cost you dearly.

JimDesu said...

If I were investing or speculating, sure, but trading is an entirely different animal. By Friday I could be bankrupt.

Anonymous said...

Oh I see - I read what you wrote but it didn't sink in. When I saw "trade" I was thinking investing or speculating.

So - how predictive is your model? Could it tell you when you need to spend more of your time trading and when you should spend your time on something else?

JimDesu said...

Nope, it's not predictive at all. Anyone who thinks they can predict the market would be better off spending their money on lottery tickets -- it's a fool's game. The only way to "predict" a market with any reasonable chance of success is with insider information. The things that move markets simply aren't available in the rear-view mirror that is a price chart. My system (which I won't go into details on) is purely reactive, not predictive.

Anonymous said...

Okay, now I understand, danke.

Still - I wonder if someday we'll see aspects of statistical thermodynamics (probability and possibility) which can be computed with brute force methods be used to provide a reasonably good predictive model for all sorts of things.

JimDesu said...

No, but what you can do is come up with a general model of what could happen. So you may not be able to say "up" or "down", but "we know that market movements follow a power-law distribution, so if we assume the decay exponent of the curve is between 1 and 3 (reasonable), we can assume that the value of our portfolio will model out to be between -x and +y". That takes a lot of sophisticated modeling to do, but banks and other large treasury operations will do just that so they can, for example, keep their mortgage portfolios from blowing up on them. And it's exactly that Long-Term Capital Management didn't do in ,um, 1998 or so, when the Feds bailed them out when Russia defaulted on all its bonds.

Blog Archive