Month: August 2012

VXX Directional Trading Strategy Part 2: Signals based on Oscillators

Previously, at VXX Directional Trading Strategy Part 1, I  posted research on a VXX Directional Trading System based on constant values. This post will be about a trading system on VXX using 3 oscillators William’s %R, RSI, and Stochastic.

My commissions are set at 7$ per trade with a capital base of 10,000$. All signals are based on the opening price of the day after the signal was generated. The software used is AmiBroker. The objective function used in optimization and walk-forward analysis is RAR/MDD. The data is from 1/30/2009 – 7/30/2012. The RAR/MDD of short & hold (the benchmark we are trying to beat) is 1.17.

Chart with all 3 oscillators on it This is chart of VXX, William’s % R(First), RSI (Second), and Stochastic %D (Third). All of these 3 indicators have been visually optimized (meaning that I adjusted the parameters to what seems to me the best fit). My system will generally be:

  • Short VXX if Oscillator < Constant Value
  • Long VXX if Oscillator > Same Constant Value

William’s % R:

  • Short VXX if William’s % R < Constant Value
  • Long VXX if William’s % R > Same Constant Value
// William's %R VXX System
function PercentR( periods )
{
 return -100 * ( HHV( H, periods ) - C )/( HHV( H, periods ) - LLV( L, periods ) );
}

SetTradeDelays(1,1,1,1);
BuyPrice = SellPrice = CoverPrice = ShortPrice = O;
WilliamLength = Optimize("WLength",80,1,100,1);
William = PercentR(WilliamLength);
Constant = Optimize("Constant",-70,-100,0,1);
Buy = Cover = Cross(William,Constant);
Sell = Short = Cross(Constant,William);
Optimization of William's %R System

This is an optimization of William’s %R Period vs the Constant Value. There are two stable regions: when William’s %R Period is approximately 55-90 and Constant is approximately 60-75, and also when William’s %R Period is approximately 20-40 and Constant is approximately 20-40. The water line represents the RAR/MDD of Short & Hold

Here is a detailed backtest report for when William’s %R Period is 80 and the Constant 70. I chose these two values because they seem to be in the middle of the stable region.

Statistics of the 70-80 Williams System

The RAR/MDD of Short Only (4.36) is much better than the RAR/MDD of Short & Long (1.42Chart Report for the 70-80 Williams System

Comparative Chart for the 70-80 Williams System
This compares the return of buy & hold, short & hold, and the 70-80 Williams System

Even though there are only 21 total trades in the 70-80 system, because of the hilly region near the beginning, it warrants further exploration of this system.

Here is a detailed backtest report for when William’s %R Period is 30 and the Constant 30. I chose these two values because they seem to be in the middle of the second (and more profitable) stable region.

Statistics Report for the 30-30 Williams System

The results of this system are much more impressive than the previous system.Chart Report for the 30-30 Williams System

Comparative Chart of the 30-30 William's %R System
This chart compares buy & hold, short & hold, and the results of the 30-30 William’s %R System.

The results of this system are much more impressive than the previous system. The CAR & the RAR/MDD are higher. Also, this system has almost double the amount of trades (41 vs 21) meaning that these results are also more statistically significant, definitely warranting further exploration.

RSI:

  • Short VXX if RSI < Constant Value
  • Long VXX if RSI > Same Constant Value
// RSI VXX
SetTradeDelays(1,1,1,1);
BuyPrice = SellPrice = CoverPrice = ShortPrice = O;
// Optimization
RSILength = Optimize("RSILength",20,1,100,1);
Constant = Optimize("Constant",55,1,100,1);
Indicator = RSI(RSILength);
// Entry/Exit Signals
Buy = Cover = Cross(Indicator,Constant);
Short = Sell = Cross(Constant,Indicator);
Optimization of RSI and Constant

This is an optimization of RSI Period vs the Constant Value. There is a stable hilly region approximately when RSI Length is 10-30 and Constant is 45-60. There are also random spikes that will be disregarded. The water line represents the RAR/MDD of Short & Hold

Here is a detailed backtest report for when RSI Length is 20 and the Constant is 55. I chose these two values because they seem to be in the middle of the stable region.

Statistics of RSI Trading System

In this system the long only system has a RAR/MDD of 2.78, short only has a RAR/MDD of 1.85, and long & short has a RAR/MDD of 1.74.                                 Long > Short > Long & Short

Report Chart for the RSI Trading System

Comparative Chart of RSI Trading System

This compares the return of buy & hold, short & hold, and the RSI System

Even though there are only 33 total trades in the RSI system, because of the hilly region near the beginning, it warrants further exploration of this system.

Stochastic

  • Short VXX if Stochastic < Constant Value
  • Long VXX if Stochastic > Constant Value

I am going to choose 3 and 3 for the D and K lengths so that there are only 2 variables left for optimization. I want D and K both to be low to produce a decent amount of trades so that the results of the backtest are statistically significant, and I chose these particular values because these values are the most commonly used.

2 Var Optimization of the Stochastic Trading System

Optimization of Stochastic Length vs Constant buy/sell value. The water line represents the RAR/MDD of Short & Hold. There seems to be 2 stable/hilly regions.

Different view of the picture above
This gives a better view of the 2 regions.

The 2 regions are approximately:

  • Constant of 30-45, Stochastic Length of 55-90
  • Constant of 55-70, Stochastic Length of 15-30

Here is a detailed backtest report for when Stochastic Length is 75 and the Constant is 38. I chose these two values because they seem to be in the middle of the stable region.

Statistics for the 38-75 Stochastic System

The short only system is much better than the long & short version.

38-75 Report chart Stochastic Trading System

38-75 Comparative Chart Stochastic Trading System

Compares buy & hold, short & hold, and the results of this system

Here is a detailed backtest report for when Stochastic Length is 18 and the Constant is 62. I chose these two values because they seem to be in the middle of the stable region.

Statistics Report for the 62-18 Stochastic system

62-18 Report Chart Stochastic Trading System62-18 Comparative Chart Stochastic Trading System

In conclusion, it seems that all 3 oscillator systems are more profitable (by means of RAR/MDD and CAR) than short & hold. The best performing system seems to be the William’s %R.