Coding automated strategies is iterative

Programming an automated strategy is an iterative process, like any other kind of programming. The first attempt in writing code that trades your strategy will likely not be successful. Ideally, the goal of your first pass at writing your strategy is to create the absolute simplest possible version of your strategy. If you usually trade with 3 indicators, try to code it using only the main one. If you have 4 criteria for entering a trade manually, try to code it using only one or two.

In your next version, you can add in your additional filters, trade criteria, and special cases, but on this first iteration, keep it really simple. You might discover that your strategy is pretty good, even without all the additional indicators and special cases. If you can get this simple version to be profitable in back-testing, the additional indicators and entry or exit criteria will just make it that much better. Be patient. Get the simple version really, really excellent before you make it more complex.

Each iteration should become closer and closer to your goal. And after every version of the software, do crazy amounts of back testing–optimize different parameters, test on long time periods, short time periods, recent months, and time periods from several years ago. Then try your best set of parameters on data you didn’t optimize with (for those in the know, we’re doing walk-forward testing…)


Did you enjoy this article?
"Get my free programmer's checklist"
The checklist gives you step-by-step instructions on how to create the perfect automated trading system.

Leave a Reply

Your email address will not be published. Required fields are marked *