TradersEdgeSystems.com

Consulting | Custom Trading Systems
Built-In Indicators | Custom Indicators

February 2013 Stocks and Commodities Traders Tips


The Volatility (Regime) Switch Indicator

AIQ Version:

Original article by Ron McEwan
AIQ Code by Richard Denning

To test the author’s Volatility Switch indicator, I used the NASDAQ 100 list of stocks and AIQ’s Portfolio Manager. A long-only trading simulation was run with the following capitalization, cost and exit settings:

  • Maximum of 10 open positions
  • Size each position at 10 % of mark-to-market total capital
  • Take no more than 3 new positions per day
  • Compute the mark-to-market capital each day
  • Three cents per share was deducted for each round turn trade
  • Select trades based on the lowest 3 bar RSI reading
  • Exit trades only with a system exit-no loss stop or profit target stop used

I coded four similar test systems. All systems enter & exit next bar at open after respective entry or exit rule becomes true at the close of the bar:

System 1: a basic trend-following system that buys when the close of a stock is above its moving average and the moving average is higher than it was 10 bars ago. Exit when the close is below the moving average.

System 2: the same as System 1 with the Volatility Switch Filter added to the entry and exit rules for the stock.

System 3: the same as System 2 with System 2 rules also added to the market using the NASDAQ 100 Index (NDX) to represent the market conditions.

System 4: the same as System 1 but with the Volatility Switch Filter and the trend following rules added to the market index (NDX).

I used the author’s parameters of 21 days for the volatility length and 50 for the Volatility Switch level. Note that my coding of the indicator is multiplied by 100. To determine the trend, I used a 50 bar moving average. For the period 12/30/94 to 12/12/2012, the systems returned the following:

Statistics

System 1

System 2

System 3

System 4

Annualized Return

23.7%

23.8%

10.0%

11.9%

Peak/Valley Drawdown (DD)

-49.3%

-57.4%

-18.9%

-19.5%

Sharpe Ratio

0.84

0.92

0.80

0.97

In Figure 1 I show the equity curves for all four systems with the largest graph showing the equity curve for System 4 which is the one I prefer due to the relatively low drawdown and the highest sharp ratio. Adding the Volatility Switch filter only to the stocks (System 2) did not reduce the drawdown but the return increased very slightly and the Sharpe Ratio was one of the highest. Adding the filter to both the stock and the market (System 3) dramatically reduced the drawdown but the return and Sharpe Ratio also were significantly reduced. Adding the filter only to the market index thus seems the best compromise. The tests tend to show that the filter can be used to reduce drawdown and increase reward to risk ratios.

Captions:
Figure 1 – Long-only equity curves (blue) compared to the S&P 500 (red) for the test period 12/30/94 to 12/12/12 trading the NASDAQ 100 list of stocks.

EDS Code:
Vola Switch.EDS
(right click and choose Save As)


 

Traders Studio Version :

Original article by Ron McEwan
Traders Studio Code by Richard Denning

The TradersStudio code for Ron McEwan’s article , “The Volatility (Regime) Switch Indicator”, is provided at the web sites noted below. The following code files are provided in the download from the websites:

  • Function: “VOLA_SWITCH” a function that returns the Volatility Switch of the price inputs
  • Indicator plot: “DMI_OSC_IND” indicator code that plots the Vola Switch oscillator with a line at the 50 level
  • System: “VOLA_SWITCH_SYS” a system of my design to test the author’s indicator

Parameters:

  • volaLen = the length used for volatility calculation
  • maLen = length of the moving average used to determine trend direction
  • vsLvl = the maximum level for a trending market
  • exitBuyLvl = level on the RSI when in non-trending mode for an exit

The rules of the test system are simple-long only is coded:

Go long when

  • The close is greater than the moving average and
  • When the moving average is higher than it was 10 bars ago and
  • When the Volatility Switch Indicator is below the critical level (“vsLvl”)
  • Exit longs when
    • Volatility Switch is greater than critical level and the close is below the moving average or
    • Volatility Switch is greater than the critical level and the 3 bar RSI is above the critical level (“exitBuyLvl”).
I set up a test session using the ETF QQQQ (Pinnacle data). I then optimized the parameters and found that the RSI exit level of 75 to be in a good zone. Note that I did not optimize the length of the moving average. In Figure 1, I show the parameter optimization map for trading just the long side with the system on the QQQQ from 1/2/1990 through 12/10/2012. The buy level parameters between 55 and 65 together with the volatility length between 120 and 180 look good without any spikes in the map. There is a spike at the 200 length but that was my maximum value tested so more optimization with longer values is recommended. I then ran a back test trading 100 shares for the same period with parameter set (160, 50, 50, 75) trading long only. The resulting equity curve and underwater equity curve are shown in Figure 2. Trading just 100 shares of the QQQ, the system returned a profit of $6,221 with a maximum drawdown of $2,094 on 7/18/2002 with a profit factor of 3.55.

Captions:
Figure 1 – Three-dimensional parameter optimization graph for the system trading the QQQQ ETF for the period 1990 through 2012.

Figure 2 – Equity & underwater equity curves for the system using one of the better parameter sets from the optimization tests (volatility length = 160, moving average length = 50, volatility trend level = 50, exit buy level = 75).

Traders Studio Code:
Vola Switch Feb 2013.zip
(right click and choose Save As)

 

 

 

 

 

 

 

 

 

 

 

 

 

Disclaimer | Privacy Policy | Contact Us | Spam Blocker | ©2013 Traders Edge Systems