Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
RSI UPRO Algorithm

Hello everyone! I have been testing this algorithm and I think I want to go live with it. It buys UPRO when rsi is 32 and sells when rsi is 70. I will use Robinhood, and I tried to add the t+3 trading guards. Are there any bugs with this algorithm? Is it safe to go live with it for robinhood?

13 responses

Absolutely not! You only tested during a recent bull market. Try testing it with a constantly-rebalancing 300% position in SPY (which is equivalent), and you can backtest it to 2001. You'll see you get completely wiped out during 2008.

Um, quite. Herewith a test on SPY with 2x leverage.

Not "wiped out" I guess, if it's continuously rebalancing, but a 93% drawdown would be tough to stomach.

Yes I tested it with SSO (2x leveraged SPY) and saw very high drawdown. However I think this can still beat any strategy that I use manually. Generally I believe that SP 500 will continue to go up. Is it possible to create a stop loss if max draw down > 0.6?

Max draw down stops are possible to make, but pretty annoying. You need to keep track of your own account equity history in context, calculate your own current drawdown metric, and then compare that to 0.6. It's possible, I've done it, but I gave up because I don't like algos which depend on storing vital state in context anymore, given how frequently one must restart them and lose all of context (e.g. Q2).

Ok is it possible to make a 50% trailing stop loss? I want to record the price i bought it at, and set a stop loss if current price is 50% less than the price i bought it at.
I don't need to use 50% exactly, I just want to know where I can find code for a trailing stop loss. I'm not a programmer ,it would be hard for me to make it.

Here is an alternative approach using code nicked from elsewhere. At the end of the day, the signals may not protect you and the leverage may well kill you.

Aren't these other strategies essentially completely different, and variations on the same-old moving average crossover TLT/SPY stuff?

Thank you so much everyone!! You've helped me alot!

The real questions are:

  • does market timing work (or is it something we create with back
    testing); and
  • will long bonds continue to provide protection in the
    future.

Any answer to the first question is guesswork, the second question is perhaps more interesting.

Take a look at bond futures prices: 1) unadjusted and 2) back adjusted. Take a look at a bond index: 1) price only 2) with coupons reinvested. Take a look at a bond mutual fund: 1) price only and 2) with coupons reinvested.

This will tell you where bond returns come from when you operate a constant maturity scheme.

Ask yourself: where do bond returns come from given the operation of a constant maturity scheme?

Do bond returns come mostly from price movement? Do bond returns come mostly from coupon? If the former then investment in a bond fund is a disaster in an era of rising rates. If the latter then you may come to a different conclusion.

The overwhelming majority of the return from bonds is from the coupon, therefore my own thoughts are that while there will inevitably be a downwards price movement in bonds funds as interest rates rise this should be outweighed by rising coupons.

Hey,
Have your gone with this algo at last? is it recommended?

Is it finely suited for Interactive Brokers?

anyone ever actually go live with this?

You can clone the algos and run a back-test on the out-of-sample time since they were posted. The OP's original algo has continued to work. Beware though that it offers no hedging or protection during a crash. I also checked one of the "improved" versions and it failed miserably on the out-of-sample timeframe.