A year ago I embarked on a project to learn Common Lisp by building a trading system, to execute with the Interactive Brokers API.<p>I modeled the woodiescciclub.com trading strategies, primarily because the math is simple and the patterns are well defined. However since then I've seen other parties on the web talk about how the Woodies patterns actually don't make money consistently, although I didn't corroborate this.<p>I actually found CL to be a fantastic language for this. I was writing up the Woodies patterns using a DSL I had created:<p><pre><code> (defpattern zlr "Zero Line Reject" :with-trend
((count 1) (within 100 250) (trend :up :or-opposite-invert))
((count 1) (within 100 200) (trend :up :or-opposite-invert))
((count 0 10) (within -50 99) (trend :up :or-opposite-invert))
((count 1) (within -50 50) (trend :up :or-opposite-warn) (angle :down))
((count 1) (within 0 115) (trend :up) (angle :up) (away 8)))
(defpattern hfe "Hook From Extreme" :counter-trend
((count 1) (within 200 300) (trend :up))
((count 1) (within 0 199) (trend :up) (angle :down) (away 3)))
...etc
</code></pre>
The defpattern macro was creating, for example, #'is-zlr, #'is-zlr-up, #'is-zlr-down, which were then used by a trading engine that monitored 5-minute bars on a given futures contract and launched trades.<p>Another CL feature, restarts in the condition system, helped too. When the data feed broke or got corrupt, an exception thrown which could reload the data feed and restart back in the listening loop without forgetting any context was helpful.<p>Also just running in a Lisp image was great because I could swap functions during a live feed without stopping the program.<p>In the end, the programming worked great, but the trading system lost money. I had it working in backtesting over a few months and then papertrade mode for weeks, and then when I took it live, the volatility rose and it started hitting the stop all the time. I adjusted things like stops based on ATR, but I really just ran out of my little budget to play with it.<p>It did however teach me CL. ;-)<p>Modern trading platforms have built-in tools and programming languages and writing things from scratch in CL is really just an academic exercise.<p>I believe it's possible to do algorithmic daytrading, but quite a bit more difficult than it seems. There are way more market behavior modes than you can appreciate at first, and the keys to success lie more in counterintuitive aspects of your system like position sizing rather than intuitive aspects like entry strategy.<p>The best talk I heard from someone on the subject indicated that it takes years and the end result is a fairly sophisticated algorithm-switching engine, because the hard part is just to survive.