Share the Light

Being one who understands something of economics, the stock market, the arts of war, high cuisine, technology and can dance a pretty mean salsa, it stood to reason that of all people, your humble Lighthouse Keeper should be able to write a decent trading bot.

We have all heard how an ever increasing amount of the day-to-day market activity is dominated by Quants and their bots. With this algorithmic trading, computer programs basically buy and sell securities with lightning speeds, making decisions based on any number of measurable criteria far more quickly than any human could.

Still, the trick is to know what “measurable criteria” should tell a bot to buy, hold or sell what security and how much of it. Physicists, nuclear neurosurgeon rocket scientists and PhDs of unknown types reportedly dominate this Quant world. Never one to be stymied nor overly impressed with titular authorities¹ and academic regalia, I dusted off my one of my old trading strategies I had developed and delved into the Quant world. Apparently, python was a good language to do this with, and though I get by well enough with JavaScript, VBscript, and even php, had never even seen Python.

All the available options were foreign to me, with perhaps the exception of C++ which at least has a very similar syntax to JavaScript. However, I noticed that python seemed to be very easy to read once you take a closer look at it (that is one of its main goals and touted advantages) and figured a higher level programming language was probably a better choice than a lower level one. MatLab was also an interesting choice, but ultimately went with Python. There are surprisingly few platforms for regular users to do backtesting, and they have their limitations.

Quantconnect was the one I used and it is overall a nice platform, not without its drawbacks. So after teaching myself some crude python… here is what I got.


¹ It may very well have been the case during Wallace’s time, that men “don’t follow Titles, they follow Courage”, but today there are either much less men around, or they started following titles. Oddly enough since the Titles have gotten much less impressive. I can easily ignore what a Dr. Rubin, PsyD says, but I would find it rather more difficult to do likewise to the noble commands of a Duke of Norfolk, Earl of Surrey and Baron Mowbray, Earl Marshal of England and Queen’s Lieutenant in the North, and of course also Knight of the Most Noble Order of the Garter². I might just listen to him.

² Apparently, now only called “Order of the Garter”. I would suspect leftists at work.

Facebook Comments

WordPress Comments

4 responses to “Backtesting a Successful Trading Algorithm”

  1. AJ says:

    Hi Erik,
    Came across this site from your youtube video. Congrats on making the top 1%.
    I’ve just started to learn about algos and bot trading. There seems to be multiple ways(platforms) to do the code. Is one platform/programming language better than the other or would the outcome be the same for the same trading strategy?
    Can you provide any tips on where to start with coding and testing the bot?
    Appreciate any feedback.

  2. Main Inbox says:

    Hey Erik,

    impressive Performance but why is your Net Profit negative ?

  3. Rad says:

    hi Erik,
    Thanks for sharing,
    Would you be able to share your knowledge and Python code strategy ?

    The Best Regards,
    Stay Safe,

  4. Felix Slothower says:

    Cool stuff. Did you ever end up implementing this algorithm with your active portfolio?

Leave a Reply

Disqus Comments

Online Marketing at
%d bloggers like this: