Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
How to dig a hole looking for GLD

This backtest tries to implement (unsuccessfully) an [Overnight Long / Intraday Short GOLD][1] http://www.skoptionstrading.com/updates/2010/8/27/proposing-an-overnight-gold-fund.html , which should [double in over a year][2] http://www.zerohedge.com/news/overnight-longintraday-short-gold-fund-more-doubles-just-over-year-generates-43-annualized-retu , but clearly does not. This shorts GLD for the full amount intra day (not actually executable as margin is not accounted for), and buys GLD for the full amount over night, for a -78.4 return from 2010, and a -98% from 2005. I tried shorting GLD by holding DGZ, but it's not liquid enough. Does anyone know how to actually make the suggested strategy work? Is there a way to buy the "gold AM fix" and the "gold PM fix" ?

Thanks, Paul.

p.s. have you noticed links don't always work here?

4 responses

I think you want to SellShortAtOpen and BuyLongAtClose . Flipping the minus signs in front of the 100's also does it. Comparing to GLD as the benchmark is really the way to go, and this strategy STILL underperforms the benchmark: 26% vs 176%, and would be under water if run for only the last three years. I think this one is pretty dead. Thanks Market Tech for taking a cut at it.

@Perry, ah, yes, sorry about that logic flip. I'll stop, drop and roll a new version that reflects your intended logic. I hate to leave broken algos out in this forum. They're like trash along the roadway.

[Updated to reflect correct side for time of day. In addition converted to order_target_percent ]

Doing some analysis on this, if we use the $65 made during the overnight long position, minus the $7 the short position would have lost, we arrive at a net of $58 profit, per share, for the 10 year duration. if we use the starting price of $43 for the price of GLD at the start of the test, this $58 profit is approx. 134%. The end result for the below back test is 116%. which is probably inline with the expectations given the actual prices achieved for the orders. Additionally, this is the compound P&L for the yahoo daily data:

Excel compound returns for overnight held Long position in GLD

Prior comments:

Fetching the data for GLD from Yahoo and performing a simple Open(0) - Close (-1) and Close(0) - Open(0) tells us that GLD made $65 per share over the last 10 years holding over night. While it made only $7 per share holding intraday. So, it looks like your premise might pan out. (Incidentally, very similar to SPY, although the SPY makes considerably more holding over night and actually loses intraday).

Know that commissions and slippage will cause problems in such a strategy. You should try it first with both set to the Null state -- no affect. Then add them back in to get a more realistic result.

Additionally, you might want to print out the sequence of order handling to ensure that you have the ins and outs correct (and that they actually are honored by Quantopian). When I ran your (modified) strat:

2005-01-04 PRINT SellShortAtTheOpen   .  
2005-01-04 PRINT CoverShortAtTheClose ..  
2005-01-04 PRINT BuyLongAtTheClose    ...  
2005-01-05 PRINT SellLongAtTheOpen    ....  
2005-01-05 PRINT SellShortAtTheOpen   .  
2005-01-05 PRINT CoverShortAtTheClose ..  
2005-01-05 PRINT BuyLongAtTheClose    ...  
2005-01-06 PRINT SellLongAtTheOpen    ....  
2005-01-06 PRINT SellShortAtTheOpen   .  
2005-01-06 PRINT CoverShortAtTheClose ..  
2005-01-06 PRINT BuyLongAtTheClose    ...  
2005-01-07 PRINT SellLongAtTheOpen    ....  

Which looks like we're getting the right sequence and no missing event handlers.

Fwiw, I looked at this strategy also and I think its BS. I couldn't get anywhere close to the returns suggested, either by going short intraday, long overnight, or any combination. I think more intelligence needs to be added for intraday profit taking etc.

Good luck!

@Rob S., I know. These simple strategies are full of stuff and nonsense.

But you know what Willie Wonka said... "A little nonsense now and then is relished by the wisest men."

Gold long nightely, short daily