Wednesday 30 September 2015

Python code for the two trading rules in "Systematic Trading"

This is a brief post aimed at those who have already bought a copy of "Systematic Trading" (by the way thanks!)

As you've probably noticed I've included excel sheets here explaining the two trading rules I describe in the book - exponentially weighted moving average crossover ("EWMAC") and Carry ("Carry").

Since I also have the python code for these rules, I thought I might as well share it. You can find it here:


I've added these links to the 'info' page on the book's website.

If there is any other code you'd like to see let me know. I've already been asked about bootstrapping, so don't worry, that is coming.


  1. Very inspirational! Congrats on the book, I just bought the kindle-version.
    You might receive some questions from me in the near future....
    All the best,

  2. Hi,

    Nice blog. Just a Quick one.
    What's your trading frequency?
    And when/how do you decide how/when to close your position?

    1. My average holding period is a few weeks. I don't 'close' positions, instead I have a continous forecast of what the optimal position should be; I then trade if that changes.


Comments are moderated. So there will be a delay before they are published. Don't bother with spam, it wastes your time and mine.