Saturday, February 9, 2013

GDX Strategies Revisited


Last fall I spent an exorbitant amount of time writing strategies for trading Market Vector's Gold Miner ETF (GDX) using the ThinkorSwim trading platform. It has become one of those projects that never seems to get finished, at least not to my satisfaction. I would like to get this code entirely written over to my other trading platform (TradeStation) where the opportunity for extensive optimization and back testing should complete the project. 

Anyway, as my present interest seems to be circling around the mining sector, I thought it would be fun to see how the strategies have been doing to date. So, I loaded up each of 9 long strategies one at a time in ThinkorSwim, set the back test results to begin with the first day GDX began trading in May 2006, and let the computer do the rest. Meanwhile, I made a table with various headings to record the results as shown below.

GDX Strategy Name
(LONG STRATEGIES)
Total
Trades
Win %
Largest
Winner
Largest
Loser
$ Profit
Per Trade
$ Profit
May `06 - now
Current
Signal
1.
Gaps
89
83.14%
$405
$366
   $  60
$5,318
Buy
01/25
2.
Linear Regression
44
70.45%
$763
$753
   $  99
$4,378
Buy
01/25
3.
PercentB
32
96.97%
$488
$81
   $134
$4,291
Buy
11/26
4.
Step_MA
48
81.25%
$455
$1070
   $127
$6,075
Sold
01/29
5.
Force Index/TSI
12
75.00%
$1075
$174
   $336
$4,033
Buy
02/01
6.
TSI
27
66.66%
$735
$220
   $225
$6,081
Buy
02/08
7.
Ulcer Index
34
52.94%
$551
$307
   $174
$5,925
Buy
02/05
8.
VZO
19
73.68%
$828
$303
   $295
$5,606
Sold
08/24
9.
Pivot Point
132
78.78%
$463
$784
   $  63
$8,354
Buy
01/25













          GDX                                                                                                      $357

GDX opened for trade on May 23, 2006 at $38.75 and closed last Friday February 8, 2013 at $42.32. The buy and hold for nearly 7 years yielded a gain of $3.57 (9.2%). Assuming an initial purchase of 100 shares (my strategy's data above is for the use of 100 shares only) the buy and hold profit to date is $357.

This post will simply provide a bench mark for the strategy's performance to date that we can look again at some time in the future. 

Also, I was curious to see not only each strategy's winning percentage, but also what kind of signal each was giving right now. It turns out that 2 of the 9 are out of GDX and in cash. The other 7 strategies bought GDX within the past two weeks in the $42 range with the exception of the PercentB strategy which has been holding long since November at $48.50.

Hummm...... what is the chance all 7 strategies are wrong? I guess that will be something to write about next time.


8 comments:

  1. I'm shocked, shocked to find TSI is the next to last in Win%. But better than 50% is still not too shaby.

    ReplyDelete
  2. Anon - your humor is appreciated and I am guessing you have not written
    automated strategies yourself. The win% is not the goal in writing strategies.
    The goal is to rip as much money off the chart during the time period being
    tested, preferably with small losses along the way and as few trades as possible.
    Given these metrics my TSI strategy came in first place. The largest losing trade
    was not bad at $220, the average profit per trade (including losers, of course)
    was about 5% or $225 on 100 shares, and the strategy pocketed $6,081 in just 27 trades.

    ReplyDelete
  3. I am wondering about the actual TSI strategy that produced the profits. You have described the buy signal(s) consisting of the TSI crossing zero into positive territory and when the TSI line penetrates the descending line created by connecting prior descending tops. Were those the signals that you used in writing your automated strategy?
    I might add that I am using the 4,4,7 setting on TSI as one indicator and have noticed that the trigger line usually gives a buy signal at the same time as your extended "previous tops connected" line. Have you found one to be more reliable than the other?
    Loren

    ReplyDelete
  4. Hi Loren - to refresh my memory I just looked at the code I wrote for that TSI strategy and I hate to say this, but it's complicated.

    So complicated that unless I write for a long long time I cannot explain it fully, and even then, it is nothing someone can just read and then do themselves.

    But here are some highlights, assuming you are interested in reading more:

    This TSI strategy for trading GDX daily actively uses the following elements:

    1. TSI (25,13) - double smoothed
    2. A variable that measures the difference of the difference
    between two different TSI bar
    readings
    3. Exponential Moving Average of
    the difference in this variable
    from current and previous bar over
    30 periods magnified 10 times.
    4. Then a double Exponential Moving
    Average of this value over 7 periods
    smoothed 3 times.
    5. A comparison of the values in 3 and
    4 above to determine which value is larger.
    6. A value assigned for the stopPrice
    7. A value assigned for the targetPrice
    8. Traps set for whether the TSI is above/below a certain reading and whether it is falling or rising
    9. Determination if price has changed
    by a certain amount in the previous x number of bars.

    And there is a little more but my eyes are glazing over as I am sure yours are as well. It all made sense to me at the time I crafted the strategy, fwiw. But I'd have to get myself back into "the zone" to remember why I did what.

    I tried out your TSI suggestion and it was interesting because I had never looked at the TSI that way. I can see generally what you are thinking. I will continue to prefer the trend line break method but agree that sometimes there are similarities....as you have observed. Thanks for sharing your idea!

    ReplyDelete
  5. John,
    TSI on monthly gold dropped below 0. Another massive drop is around the corner for gold... Miners have been screaming and warning for a long time. Dollar looks bullish. Good luck to the bulls...they'll need it.

    My biggest question is why 1520's should hold? Market makers know where longs entered in the summer, i think max pain would be to take gold down into 1400's that would eliminate all weak and under capitilized hands before another leg up may begin. Just my thoughts and sorry it goes against your analysis.

    ReplyDelete
  6. Hi John - looks like a divergence setting up today!?

    ReplyDelete
  7. Anon - I do not mind whatsoever that your thoughts do not agree
    with my thinking. You express your differences with thoughtfulness
    and add relevant detail to support your reasoning. I think that is
    great.

    Why should the 1520's hold? Well, for one thing we are a long long
    ways from 1520 and I doubt we see anything lower than 1626 for more
    than a minute or two. 1626 is still roughly only a 61.8% retracement
    of what looks like a gigantic bloated intermediate cycle beginning
    last May 16. Look at the 3 months of trading between 1520 and 1630
    during May - August and that is a veritable land mine that I think
    gold would find impossible to penetrate. That price range is like
    a mosquito infested jungle where snipers lie in wait for a final
    taste of warm blood and one last kill.

    ReplyDelete
  8. Hi Ross - divergence set up? You mean TSI (7,4) and daily gold? Oh, that divergence appears to be long gone. The trend line break snuffed it out and yielded a SELL signal an hour or two ago.

    ReplyDelete