I have been fooling around with Python as a possible tool for technical analysis. I coded a few of my favorite indicators. The GitHub link is here.
- Bollinger Bands
- Keltner Channels
I don’t think I am going to switch from C# and Multicharts, but Python is good for doing crazy stuff like the correlation indicator I wrote about last time (which, by the way, has been pegged below 50 all year – I’d love to know why). Also, Bokeh shows great promise as a versatile charting program.
Indicators may look different from Stockcharts.com unless you attend to your scaling. Stockcharts enforces a 0-100 for oscillators, Bokeh does not.
So, it’s another tool in the toolbox. In fact, I noticed that most indicators are built with an iterative mindset that obviously reflects the programming languages of the day. This is a great example of creativity being constrained by the tool set.
Ironically, the ones that are hard to do in a scalar language, like MACD, are easy in Python – and vice versa. Wilder’s clever smoothing technique seems designed for a scalar language. I used a little math and converted it to its equivalent EMA.
Coding lookback windows and rolling averages in Python feels like pounding a square peg into a round hole. I suspect that the next wave of great indicators will be vector-based, reflecting modern ways of thinking about data.