Daily Archives: January 27, 2014

General trading strategy

I am not trying to predict the future price, at least not directly. Instead my goal is to implement a strategy which "buys low and sells high". The problem of course is to determine whether the current price is low or high and compared to what?

My strategy handles this problem by calculating how much weight of the portfolio should be in EUR. That is, if all the money is in BTC, the weight is zero. If the value of the holdings in BTC is exactly as large as the holdings in EUR, then the weight is 1/2. By comparing the current weight with the "target weight" and inferring how many coins need to be traded in order to get from the former to the latter, we can make sure to keep close to the calculated target weight.

To determine this target weight, two prices are defined: pmin and pmax. If the bitcoin price is below pmin, then the target weight is set to zero. If it is is larger than pmax, the target weight is one. In between the target weight is calculated on the linear curve between those points:

weightThis is generally a sensible strategy if we believe that bitcoins fluctuate a lot but do not have any large trend. If the price goes to zero, we are stuck with holding a whole bunch of worthless coins. If the price skyrockets we are missing out on the rise completely since we are 100% in EUR. I do not think this is a weakness though. If BTC will go to the moon, nothing will beat a buy & hold strategy anyway. Should the price tank on the other hand, it is hard to think of any trading strategy which will do well, considering there's no way to short bitcoin.

Of course, this still leaves the problem of determining pmin and pmax. We could of course set pmin = 0 and pmax = 99999 or any other sufficiently high number. This would ensure that we sell a little bit every time the price goes up and buy a little bit every time the price goes down, but that is not a very profitable strategy. In practice this pretty much amounts to a buy and hold strategy where only a small fraction of the portfolio is invested in bitcoins.

The other extreme would be setting pmin = pmax. This would mean that as soon as the price crosses the threshold given by this price, we buy or sell everything, depending on the direction of the move. If we can come up with a way to define this threshold well (and update the definition constantly to take account of the drift in the price), this would be a nice strategy indeed.

My definition of pmin and pmax is somewhere between these extremes. While the exact definition is part of my special sauce, I make sure that the values depend on the historical prices and are updated constantly. If the price moves up (or down) a lot, we must continue trading at this new level. Fine tuning of the parameters was done by backtesting them against the last month's worth of data. Out of sample tests were  performed against the bitcoin price history going all the way back to 2010.