Ventures of an ex indie game developer

A final DLNN attempt

I should have done this ages ago, but finally I'm going to get around to it (as long as our new company business allows for it, I'm officially a used car salesman). DLNN, or AI as we say in the common tongue.

Here's what I'm thinking. I'd like to train the network similar to how Alpha Zero did their stuff. For features I'd like to use BTC and perhaps some other currency and also Bollinger Band % over a couple of thousand candles and/or SMA over some tens of thousands of candles. Then perhaps use a time frame of a couple of hundred candles or so as a training window. The additional instruments with a long time frame should contain information that is neither present nor deducible in the training window. Or so goes my thinking at least.

The network output could be buy or sell and possible neither. Or maybe how much. I'll use pytorch, which I haven't really used before (I've only ever understood and used tensorflow a bit). I'll also focus on leveraged trading, as that should be most profitable if the neural net can predict with a whiff of accurately.

The Alpha Zero has a game distinction which is harder in trading: either you win or you lose a game. It's never as clear-cut in the real world, but perhaps I could do something like take the lowest and highest "score" of a bunch of training windows and softmax the thing. Possibly.

Important is also to pick a time resolution which is high enough to avoid bumping into over-fitting. Or keeping the network small enough. One thing that is a lot easier than Alpha Zero is that I can do away with the Monte Carlo tree search.

Some of the hard things for me will be:

  1. Sizing and setting up the pytorch network;
  2. Saving+loading models;
  3. Trying out different input features;
  4. Transforming the output to trading activities;
  5. Quickly evaluating the profit of a training batch;
  6. Transforming profit into an error — and find a way to punish inactivity;
  7. Determining what is good evaluation data (do I even need it?);
  8. Trying out different constants such as maximum margin, or even concluding that those things might be better off as network output variables;
  9. Keeping track of everything, such as what output belongs to what time frame, etc.
  10. Speeding up training.
  11. Knowing when to stop training and ensuring the model doesn't over-fit.

A simple off-by-one error anywhere will be really bad. But if everything is done properly it should be well equipped to handle pumps, dumps and trading ranges, which is super difficult with plain math. I also think it should train and converge quickly, as trend-following works great, and during trading ranges it should hopefully transition to scalping tactics.

Anyhootch, a sink-hole of ignorance, bugs and optimization. Simply trial and error. Will let you know how it goes.

About the author

Mitt foto
Gothenburg, Sweden