StockFetcher Forums · Filter Exchange · GDX\GLD Pairs Trade (inspired by Kevin and mhome)<< 1 2 >>Post Follow-up
jsheetz
23 posts
msg #104346
Ignore jsheetz
modified
1/10/2012 11:47:57 PM

Hey all,

I just want to start out by saying I am new on the forums, and really like what you guys are doing here. I have been catching up on a lot of threads, and the ideas are racing through my head faster than I have the time to implement them.

One such idea that I tested out only a little bit so far was based on an idea mentioned in another thread (http://forums.stockfetcher.com/sfforums/?q=view&fid=1002&tid=103588&qrid=) by mhome where he cites a strategy posted a ripetrade where you go long GDX when the price of gold miners has become cheap relative to the price of gold. This is used as a timing indicator for when to go long GDX... but what if you get caught in a major gold price correction? I would like to be protected. Also, what is a good way to measure when miners have become relatively "cheap" to the price of gold?

To answer these questions I immediately thought about the trading system from Kevin posted in this thread that seems to be becoming very popular: http://forums.stockfetcher.com/sfforums/?q=view&fid=1002&tid=101013&qrid=

The ideas I am taking from this is, 1) use Kevin's method of calculating the zscore to determine when the price relationship is statistically deviated, and 2) use a pairs trade to create a market neutral trade that will cut out a lot of risk, and thus removing a lot of emotions from the trade.

So to put it all together, I am looking at a filter that will signal when GDX has deviated too far from the price of gold, at which point I will go long GDX, and short GLD. Together I don't care if the price of gold rises or falls, just that the prices become back in line with the historical average price relation.

So here is the filter:

Fetcher[

/* GDX/GLD Pairs Trade Filter */

symlist (gdx)

/*Determine historical ratio of GDX to GLD over the last 16 days*/
SET{PRICERATIO, CLOSE / IND(GLD,CLOSE)}
SET{RATIOMA16, CMA(PRICERATIO,16)}
SET{RATIOSTD16, CSTDDEV(PRICERATIO,16)}
SET{DIFF16, PRICERATIO - RATIOMA16}
SET{ZSCORE16, DIFF16 / RATIOSTD16}

ZSCORE16 BELOW -1

ADD COLUMN ZSCORE16 {Z-score}

]



You will notice a few differences between what I did here, and what Kevin does with stocks in the S&P. First off, I simplified Kevin's criteria by just looking at the zscore being below -1. I didnt see a need for GDX being below the bollinger bands, -94 in Williams %R, or above 200ma because the price correlation between GDX and GLD is much tighter than stocks in the S&P and the index. This was also the reasoning behind only looking for a zscore of -1 or less. This leads into the second change, which is the exit criteria. I only look for the GDX to get back in line with GLD (zscore at or above 0), again due to the same reasoning as before.

I also tried playing with the averaging period a little. Using 30 days, instead of 16, yielded less trades, but I felt they were better quality. I haven't been able to fully backtest one against the other, but maybe some input from everyone would be helpful in this.

As far as results, I did only minor testing since I am a newbie with the backtesting here, and don't have an advanced account. The trades were opened based on the opening price, and the only exit criteria is that the zscore is back above 0 (no stops, no time limit). Also to check the performance of the pairs trade, it needed to be done by hand (unless someone can show me how to do this here). I basically took the difference of the % gain/loss in the GDX trade reported to the % gain/loss in the GLD trade found as my final net win/loss %. It wasnt too bad since each quarter only resulted in a handful of trades executed.

The results synopsis is that trades were profitable on average of about 3-4% net, leaving each quarter profitable. Again I haven't tested it for extended periods of time, as that would take a while doing by hand. I need to look more into stratasearch that you guys mention to be able to get better backtesting results. Maybe some of you can help me out with that here ;)

As mentioned, the strategy only gives a handful of signals at most per quarter, but I figured this could be paired with it's inverse filter (zscore of GDX relative to GLD is above 1, then short GDX and long GLD until zscore back to 0). Between the two you may see more action, resulting in more ROI.

I feel there may be some promise here, and am looking forward to hearing what you guys have to think about it. And by all means, feel free to more extensively backtest this in the same way as Kevin's and share the results and any found performance boosters.


Kevin_in_GA
4,599 posts
msg #104355
Ignore Kevin_in_GA
1/12/2012 9:13:46 AM

Basically your pair trade here can be easily backtested with other software. Example:

http://www.pairtradinglab.com/backtests/Tw7pybX4GpE-VnYR

using the settings you cited, there were 31 trades that netted you 46% over the last four years.

Try this site out to play around with your settings.

Kevin

jsheetz
23 posts
msg #104369
Ignore jsheetz
modified
1/13/2012 12:13:24 AM

Nice site, thanks Kevin! I played around with the parameters, and while it is hard to say which is best, I think I was right in my assumption that the 30 day period average offers higher quality trades. It is just a matter of how long you want to hold each trade. It seemed the shorter your max trade duration, the less volatile your account would get in the long run.

10/2006 - 12/2011:

10 day holding max:
ROI: 161.24 CAGR: 20.08 MaxDD: 24.16
http://www.pairtradinglab.com/backtests/Tw_7iDqJZ-mi4_LU

20 day holding max:
ROI: 158.58 CAGR: 19.85 MaxDD: 27.00
http://www.pairtradinglab.com/backtests/Tw_6d6Kt0DRilo1P

40 day holding max:
ROI: 215.83 CAGR: 24.51 MaxDD: 40.24
http://www.pairtradinglab.com/backtests/Tw_6ydaNNA0F2eXM

And just for an idea of how it did last year:

10 day holding max:
ROI: 16.11 CAGR: 16.30 MaxDD: 15.04
http://www.pairtradinglab.com/backtests/Tw-BVEeQm_8bPtVv

20 day holding max:
ROI: 11.36 CAGR: 11.49 MaxDD: 15.96
http://www.pairtradinglab.com/backtests/Tw_8UzAxAL4KTpJ

40 day holding max:
ROI: 23.78 CAGR: 24.07 MaxDD: 13.84
http://www.pairtradinglab.com/backtests/Tw_8gmUvBZNAGqJM


Not many trades overall per year, but as I mentioned if you paired it up with the inverse strategy it could offer more action.

Is there a way to backtest trading with options that you know of?



Kevin_in_GA
4,599 posts
msg #104371
Ignore Kevin_in_GA
1/13/2012 8:43:58 AM

The pair strategy inherently uses a hedge. No need for an "inverse" strategy since depending on the z-score you simply go long the undervalued ETF and short the overvalued ETF. Doesn't matter which is which, just that you are market neutral.

jsheetz
23 posts
msg #104452
Ignore jsheetz
1/17/2012 12:27:29 PM

Intraday signal to buy GDX (53.75) and sell GLD (161.35)

Kevin_in_GA
4,599 posts
msg #104455
Ignore Kevin_in_GA
1/17/2012 12:35:57 PM

Probably would help to define the pair trade settings - moving average and standard deviations from the mean.

jsheetz
23 posts
msg #104462
Ignore jsheetz
1/17/2012 3:11:36 PM

Ah, my apologies. I decided to go with the 30 day period, entering when the z-score is below -1, and closing when it is back to 0. 20 day max holding period.

Fetcher[

/* GDX/GLD Pairs Trade Filter */

symlist (gdx)

SET{PRICERATIO, CLOSE / IND(GLD,CLOSE)}
SET{RATIOMA30, CMA(PRICERATIO,30)}
SET{RATIOSTD30, CSTDDEV(PRICERATIO,30)}
SET{DIFF30, PRICERATIO - RATIOMA30}
SET{ZSCORE30, DIFF30 / RATIOSTD30}

ZSCORE30 < -1

ADD COLUMN ZSCORE30 {Z-score}

]



The spread between GDX and GLD has widened further since my post earlier today. It would seem that this is a great spot to initiate this trade... I don't beleive they become more than 2 standard deviations away from the 30 day average often.

jsheetz
23 posts
msg #104538
Ignore jsheetz
1/19/2012 10:18:30 PM

In the past few days the zscore has fallen all the way to -2.71! I checked the past 2 years and GDX has only fallen more than 2.5 30 day avg std deviations from GLD 8 times, and in 6 of those times it rallied back to score solid gains. Not to mention GDX is around a Major support area. Friday will be an even better time to enter this trade.

BarTune1
441 posts
msg #104539
Ignore BarTune1
1/19/2012 10:49:30 PM

I have traded this pair with a little success in the past. Another interesting pair, if you wanted to take on a little more risk, is KGC:GLD. It showed up on my pairtrader screen the last couple of days. I am currently long/short GG:ABX which is +2.88% since I entered.

jsheetz
23 posts
msg #104656
Ignore jsheetz
1/27/2012 11:43:55 AM

Intraday sell signal for the pair trade.

GDX @ 57.14 (53.75 entry) = 6.3% gain
GLD @ 168.4 (161.35 entry) = 4.37% loss

==> Just under a 2% net gain

If the trade was entered a few days after the intraday signal there were even better profits, more like 4% net gain.

Not bad overall...



StockFetcher Forums · Filter Exchange · GDX\GLD Pairs Trade (inspired by Kevin and mhome)<< 1 2 >>Post Follow-up

*** Disclaimer *** StockFetcher.com does not endorse or suggest any of the securities which are returned in any of the searches or filters. They are provided purely for informational and research purposes. StockFetcher.com does not recommend particular securities. StockFetcher.com, Vestyl Software, L.L.C. and involved content providers shall not be liable for any errors or delays in the content, or for any actions taken based on the content.


Copyright 2022 - Vestyl Software L.L.C.Terms of Service | License | Questions or comments? Contact Us
EOD Data sources: DDFPlus & CSI Data Quotes delayed during active market hours. Delay times are at least 15 mins for NASDAQ, 20 mins for NYSE and Amex. Delayed intraday data provided by DDFPlus


This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.