Back to Community
YAVolS: Yet Another Volatility Strategy - XIV Sniper Using RSI2

Howdy,

Been working with Cesar Alvarez on this recently. Finally got it coded on Quantopian thanks to Jacob Lower's help. This algorithm plays both momentum and mean-reversion in XIV on the daily interval using the RSI2 indicator. The algorithm takes a long position in XIV when its 2-day RSI reading crosses above 75 (momentum) and when its 7-day RSI crosses above 25 (mean-reversion). If the 2-day RSI crosses below 75, it sells XIV. Profit target and stop loss are set at +5% and -2%, respectively. When not holding XIV, the algorithm "hides" out in TLT.

Please note that the recent underperformance was due to TLT tanking post election. The version I'm trading in MultiCharts has been making new highs because it does not hide in TLT when not in XIV; it simply goes to cash.

Original strategy in MultiCharts (this version does not hide in TLT):
- http://imgur.com/a/Ydm0y
- http://imgur.com/a/eiCEQ

Clone Algorithm
313
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 58ae3a7ac0ce7c5e29a4a0e8
There was a runtime error.
22 responses

Your backtest is from XIV inception until present, was there any out of sample testing done on this algo?

Return is 716
2017-02-21 13:00 pvr:181 INFO PvR 0.4637 %/day cagr 0.6 Portfolio value 173536
2017-02-21 13:00 pvr:182 INFO Profited 163536 on 22841 activated/transacted for PvR of 716.0%
2017-02-21 13:00 pvr:183 INFO QRet 1635.36 PvR 715.98 CshLw -12841 MxLv 2.01 RskHi 22841 MxShrt 0
2017-02-21 13:00 pvr:268 INFO 2011-01-03 to 2017-02-21 $10000 2017-02-22 21:10 US/Eastern
Runtime 0 hr 4.1 min

@Dustin, I never back tested this OOS. I do not believe in backtesting these securities OOS in higher time intervals due to limited historical data. However, I have been live trading this with MultiCharts since last summer and I also presented it at an NWTTA meetup around that time. It has been making new highs since, thankfully. Consider that as 6 months of live OOS testing if you'd like.

Thanks for the reply Kory, great looking algorithm!

Kory, if you don't mind me asking, how has the algo performed in live trading vs the same time period in a Q backtest? I have a couple algos that I'd like to trade live but the difference between Q backtest and IB paper trading is significant and discouraging.

It has been doing great. I'm up about 10% on this algo since last summer and it's been making new highs with the market. My multi-strategy portfolio of 6 volatility algos is also up 34% since then. However, I am using InteractiveBrokers via MultiCharts, not Quantopian, and the version I am using does not incorporate TLT (just cash). My buddy Jake started using this algo with Quantopian and Robinhhood 2 months ago and he told me he's been making money with it too. I mostly use Quantopian for research only.

March 2017 update with non-TLT version (only cash when not in XIV):

Clone Algorithm
201
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 58d9a9dc6547cc1799a3a186
There was a runtime error.

Sorry if this is a silly question, but what are the thoughts on buying the next day vs. current? It seems that you are deciding at the end of the day (without that day's data) whether to buy the following day.

Sorry if this is a silly question, but what are the thoughts on
buying the next day vs. current? It seems that you are deciding at the
end of the day (without that day's data) whether to buy the following
day.

Bump

Nice algorithm, thanks for sharing. From the description (first post) I thought this algo was only taking long positions when BOTH crossovers were occurring, but now I see that a long position is taken in either case. With that in mind, following up on the above question, why does it buy at market close if RSI7 crosses 25, and at next day open if RSI2 crosses over 75? Why the difference in when to buy? (also, sell is set for next day).

For every algorithm I build, I basically data mine them all through these following combos and pick the one that produces the best results.

  • buy next bar at open + sell next bar at open
  • buy this bar at close + sell this bar at close
  • buy this bar at close + sell next bar at open
  • buy next bar at open + sell this bar at close

*bar = time interval (in this case, daily)

Hi Kory. It's a nice algorithm and thanks for sharing that. I'm a newbie with few insights in the RSI model. Could you share some of your insights on why this algorithm generates good result for XIV? Is it simply due to XIV's high volatility or there is hidden connection between RSI and XIV? Please forgive me if this is a silly question. I appreciate your patient reply.

Hi Vince,

There are 2 ways that the price of an asset/stock/security can behave: momentum or mean-reversion.

  • Momentum = what goes up will continue to go up, what goes down will continue to go down.
  • Mean-Reversion = what goes up will come down, what goes down will come back up.

Like Ying & Yang, these two are mathematically the inverse of each other.

Some assets are more momentum and some assets are more mean-reverting than others. Assets that are neither momentum nor mean-reverting are said to be "random walk." These are un-tradable assets because they have no "edge" or predictability. You want to trade only the most momentum or most mean-reverting assets because they naturally exhibit an edge.

Additionally, momentum and mean-reversion properties are non-constant over time and they also change based on the time interval you are looking at. For XIV on the daily interval, it exhibits a healthy dose of momentum properties and a lesser dose of mean-reversion properties but still good enough to be traded.

When an asset on a specific time interval exhibits momentum properties, you trade it using RSI2 by buying when it's overbought and selling when it's oversold. When an asset on a specific time interval exhibits mean-reversion properties, you trade it using RSI2 by buying when it's oversold and selling when it's overbought.

If you look at XIV from the 10-minute to 2-hour intervals, you can see it exhibits just mostly momentum properties. On these intervals, you would want to use momentum techniques to trade XIV.

~Kory

Hi Kory,

Thank you so much for your detailed explanation! It really helped me a lot. From my understanding of what you said, since XIV is an index on volatility, which can be measured by RSI2 to some extent, XIV would easily fall into one of the two patterns, instead of acting as "random walk". This is the characteristic that makes XIV a good security to trade using RSI2 model. Although RSI2 strategy also works for other securities, XIV generates more profits due to its innate connection with RSI2 (a bold guess, please correct me if I'm wrong).

Is this strategy based on some research paper? If so could refer me to it?

Best,
Jingwen

I've actually tried implementing the original algo of XIV and TLT, but I ran into an issue of rejected orders. If there was a line of code that would only use 95% of funds or a set amount by user's choice; I believe would fix the issue.

In case anybody is wondering, below is a pre-2008 backtest of this strategy on my MultiCharts platform using synthetic XIV data found here. Read this for the caveats of using synthetic XIV/VXX data. As you can see, trading volatility can be quite volatile.

Hi Kory,

Awesome post and idea! Thanks for sharing. I am trying to get into the Technical Analysis territory. Any suggestions for good reads/tutorials/videos?

Thanks a lot!

@Kory, will there be any timing issue in real time trading since you have consequent orders in place, say you supposed to sell TLT and then buy XIV, however the sell TLT order may not have been executed before buy XIV order is made, which could cause a rejected order. Will that happen and if so is there way to avoid timing conflict?

@Wenbo, personally that's never an issue for me because I have a margin account with 4x buying power so it doesn't matter to me what gets executed first; I have buying power to cover my trades if they do overlap. Plus they typically execute together almost instantly (market orders). In terms of liquidity, both XIV and TLT are extremely liquid with about $2B+ in combined average daily volume so your orders should execute quickly with those 2 securities.

I am happy to announce that this algo, along with all my other volatility algos, has survived Black Monday 2018!

Clone Algorithm
56
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 5a7fcd93b96cb445a9209286
There was a runtime error.

Here's a screenshot of all my volatility algos taken after the market closed on February 5, 2018. They are set up on MultiCharts. Note the +50% VXX trade on the top right chart.