TradersEdgeSystems.com

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

March 2014 Stocks and Commodities Traders Tips


Timing The Market With Pairs

AIQ Version:

Original article by Perry Kaufman
AIQ Code by Richard Denning

The code provided will back test only the long trading but not test the hedging portion of the system. For live trading I provided a manual input for the total value of the open positions which would have to be computed separately and then entered daily as an input before the daily report is run once the hedge rule becomes true.

To get a correlated list of stocks that show good correlation to the index of choice (I used the NDX), AIQ has a Match Maker module that will quickly generate a list of stocks that show significant correlation to an index. In Figure 1, I show the matchmaker setup I used to quickly get a list of stocks in the NASDAQ 100 that were highly correlated to the NDX. In Figure 2, I show the results (part of which is hidden). After highlighting the ones desired for a list, we simply click on the “data manager” button and a list is created which is then used to run the tests.

Captions:
Figure 1 – setup of correlating a list of NASDAQ stocks to the NDX index.
Figure 2 – results of running the setup in Figure 1.

EDS Code:
Timing Pairs.EDS
(right click and choose Save As)


 

Traders Studio Version :

Original article by Perry Kaufman
Traders Studio Code by Richard Denning

The following code files are contained in the download in the zip file below:

  • Function PK_STRESS - returns the Kaufman stress value
  • Function COUNTOF – returns the number of times a rule is true in a set look back period
  • System PK_PAIRS – system to go long stocks based on the stress indicator
  • System PK_STRES_HEDGE – system that is to be used with the PK_PAIRS system for hedging
  • TradePlan EqualDollar_HedgeTASC – tradeplan that runs the two systems with equal dollars invested per trade
I set up the above code on the NASDAQ 100 list of stocks and used the NDX index for pairing. I also set up the hedge using the QQQ ETF going short on the hedge signals. If trading an IRA account the hedging system can be switched to use an inverse ETF. I used the QQQ for testing because it has more data than the inverse ETFs. In Figure 1, I show the log equity curve and the underwater percent drawdown curve over the test period of 1/1/2000 to 1/8/2014. Until 2011, the max draw downs were in the 14% area but in 2011 the max drawdown was incurred of 22.7%. The compound annual return over the test period was 14.9%. Please note that the code provided differs from the author’s code in that the tradeplan compounds the results so that the size is adjusted upward as the equity grows and the hedge does not use the volatility adjustment.

Captions:
Figure 1 – The log equity curve and the underwater percent drawdown curve over the test period of 1/1/2000 to 1/8/2014 using the NASDAQ 100 list of stocks, the NDX index for pairing, and the QQQ ETF going short for hedging.

Traders Studio Code:
PK_STRSS_PAIRS_TSZ.zip
(right click and choose Save As)

 

 

 

 

 

 

 

 

 

 

 

 

 

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