A week ago I took an interest in the technical analysis of stock price movement trends. On Wednesday I started thinking I should take the profits from the gold and uranium mining shares bought a few weeks earlier, but I did not and ended up losing a nice chunk of profit during the later part of the week (and even more in the first 30-minutes of trading on Tuesday this week). I had been scouring commentary all week (including some I pay a subscription fee for) for any indication of whether I should sell or hold, but couldn’t find anyone reputable saying anything that could be called definitive either way. My instinct was to sell, but I didn’t because I couldn’t find an analysis to confirm that instinct and my gut instincts on short term trades were more often wrong then right. So since I can’t find an analyst to provide the technical analysis when I want it, I now have to provide it for myself.
TD Ameritrade’s StrategyDesk
That brings me to TD Ameritrade and their StrategyDesk trading platform. A couple of months ago I had moved funds from my Fidelity brokerage account, which had because that’s where my MSFT stock awards were deposited, to what used to be my Datek account, but is now TD Ameritrade. I had done this as I remembered Datek having a more responsive trading platform then Fidelity’s, and since I re-funded the TD Ameritrade account I had only been using their Command Center 2.0, which was the successor to what I had used with Datek. I had noticed they also had something called StrategyDesk, which was a native client (vs. a Java client) that had support for developing strategies and backtesting them over years of data. So first things first, I downloaded StrategyDesk and started examining the various price indicators it provides for ones that actually seemed most predictive for the shares of interest to me.
The first thing I did was develop a strategy for the gold mining ETF GDX, and I came up with one that provided an approximate after tax return of 137% over about two years. So I took that one tried to apply it to a few other stocks. No go there. All I had done was fit some curves together, which makes the strategy less likely to actually be accurate going forward. So I started over from scratch with the uranium miner DNN, which I had gotten trailing stopped out of on Friday. For DNN I developed a strategy yielding a 133.77% annualized return not accounting for reinvesting or taxes. For GDX I had to dump the trades into Excel to calculate a more accurate number, since StrategyDesk assume the same quantity for each trade. Fortunately the return went up rather then down, so I just assumed that would generally hold true. The next task was to try getting the DNN strategy working for GDX as well. I ultimately got it working again nearly as well for GDX as my first GDX strategy without impacting the DNN returns at all. So next up it was time to try it on GG, a gold miner. After giving it a solid try, I gave up as it was pretty clear I was just trying to fit multiple curves with one function. So I tried again this time starting fresh with GG. This time I couldn’t get a strategy developed that didn’t have several points that sold to early in a good run up.
StrategyDesk’s language has no variables, no functions, and no control flow. You just write one long express with basic mathematical operators, boolean operators, and standard library of indicator functions. Additionally, in some cursory reading about technical analysis I came across more well known indicators then were supported by StrategyDesk and combined with the fact that programming language for developing strategies and indicators (or studies as they frequently called) was less capable then BASIC or even what was on a TI-80 graphing calculator it was time find another trading platform to develop on.
TD Ameritrade lists its partner tools here.
QuoteTracker is an ad supported free tool with registration that removes the ads, and since registration is free for TD Ameritrade client’s, I gave it a shot first. This tool has more built-in in indicators (studies) then StrategyDesk; however, it does not allow development of new indicators or strategies and thus has no back testing support either. It also lacks a data box that will tell you the values of indicators for the bar you’ve currently got the mouse over, so the indicators are purely graphs. No go on QuoteTracker.
NinjaTrader is a free tool devoid of ads with registration that allows it to be used for automated trading. It also comes with more indicators then StrategyDesk, although I did note that it did not have all of the indicators that QuoteTracker had. However, NinjaTrader does provide for the development of indicators and strategies in NinjaScript, which is actually just C#, and it also provides backtesting, optimization, and live simulation. Additionally, there does not appear to be any technical reason why any properly written and deployed .Net assembly couldn’t be loaded, so if NinjaTrader proves to be the way to go I may have to look into IronPython or possibly creating a C++/CLI assembly that embeds the Python interpreter or passes messages to a different process. I’d rather do my development in Python and/or C++ then C#, as it is my experience that Python is on one end of the productivity/performance scale and C++ is on the other, while C# is somewhere in the middle (i.e. its neither really good at productivity or performance).
I ran across opentick before installing StrategyDesk. It is a free way to get delayed stock data (and a cheap way to get non-delayed data) with an API for a number of languages. Python is not officially supported yet, but one library has already been developed with another underway. NinjaTrader can also use opentick as a data feed. This could prove useful for as data into a process external to NinjaTrader, if its difficult to get data passed from NinjaTrader to the external process.