March2014




Customer reviews
PoshJULIA
you guessed it ...
BeLaYaRoGaZy
all need those good old Bole
ilussion
Congratulations, you have just visited a great idea
blancca
Debate is endless, so I just thank the author. Thank you!
Frezee
Such is life. Nothing can be done.
Violette
Find out what the contemporary medicine has to offer for your erectile dysfunction!
SUMMER-SUN
Studies suggest that depression caused by health disorders occurs as often in men as in women.
Melkaya-
Wonderful!

March2014March 2014

For this months Traders Tips, the focus is Perry Kaufmans article in this issue, “Timing The Market With Pairs Logic.” Here we present the March 2014 Traders Tips code with possible implementations in various software.

Code for TradeStation is already provided in Kaufmans article. Subscribers will find that code at the Subscriber Area of our website. Presented here is an overview of possible implementations for other software.

Traders Tips code is provided to help the reader implement a selected technique from an article in this issue. The entries are contributed by various software developers or programmers for software that is capable of customization.

TRADESTATION: MARCH 2014

In “Timing The Market With Pairs Logic” in this issue, author Perry Kaufman discusses a trading system that buys and sells stocks when they are oversold and overbought relative to an index. The author has supplied the TradeStation EasyLanguage strategy code as well as the required custom function mentioned in the article. We have additionally created an indicator named PJK_TSMStress based on the authors function, to display the stress level as shown in Figure 1 of Kaufmans article. In addition to backtesting the strategy in a TradeStation chart, remember that you can use TradeStations Portfolio Maestro product to quickly backtest on a portfolio of symbols of your choice.

Following is the EasyLanguage code for the PJK_TSMStress indicator:

To download the EasyLanguage code, please visit our TradeStation EasyLanguage support forum. The code can be found at tradestation/TASC-2014. The ELD filename is “_TASC_PJK_PAIRS. ELD.”

For more information about EasyLanguage in general please see tradestation/EL-FAQ.

A sample chart showing the PJK_TSMStress indicator is shown in Figure 1.

FIGURE 1: TRADESTATION. Here is a daily chart of Hess (HES) with the indicator and strategy applied.

This article is for informational purposes. No type of trading or investment recommendation, advice, or strategy is being made, given, or in any manner provided by TradeStation Securities or its affiliates.

—Doug McCrary

TradeStation Securities, Inc.

CQG: MARCH 2014

For this months Traders Tip, were providing CQG code for the stress function based on Perry Kaufmans article in this issue, “Timing The Market With Pairs Logic.”

CQG code for the study:

The study has one parameter, period . which may be configured in the “modify study parameters” window after the study has been applied to a chart in CQG. An example of the study applied to Hess (HES) is depicted in the chart shown in Figure 2.

FIGURE 2: CQG. Here is an example of the study using Hess Corp. (HES).

To discuss this study or download a component PAC that includes complete formula code, please visit CQG Forums and CQG Workspaces. Our team of expert product specialists can advise you on the usage, application, and code for the study.

Trading and investment carry a high level of risk, and CQG, Inc. does not make any recommendations for buying or selling any financial instruments. We offer educational information on ways to use CQG trading tools, but it is up to our customers and other readers to make their own trading and investment decisions or to consult with a registered investment advisor.

—CQG, Inc.

METASTOCK: MARCH 2014

Perry Kaufmans article in this issue, “Timing The Market With Pairs Logic,” describes his stress indicator and how to use it in pair trading. The MetaStock code for this indicator based on his article is shown here:

THINKORSWIM: MARCH 2014

In “Timing The Market With Pairs Logic” in this issue, author Perry Kaufman explains how to backtest the idea of hedging with an index-based ETF. Based on his article, we have created two new strategies and a new study for thinkorswim users in our proprietary scripting language, thinkScript. One strategy is for the equity and the other strategy is for the ETF.

A sample chart is shown in Figure 3.

FIGURE 3: THINKORSWIM

For the Equity Strategy click here or:

From our TOS Charts, Select Studies → Edit Studies .

Select the Strategy tab in the upper left hand corner.

Select New in the lower left hand corner.

Name the strategy (i. e. Stress)

Click in the script editor window, remove “addOrder(OrderType. BUY_AUTO, no);” and paste the following:

For the ETF Strategy click here or:

From our TOS Charts, Select Studies → Edit Studies .

Select the Strategy tab in the upper left hand corner.

Select New in the lower left hand corner.

Name the strategy (i. e. StressHedge)

Click in the script editor window, remove “addOrder(OrderType. BUY_AUTO, no);” and paste the following:

From our TOS Charts, Select Studies → Edit Studies .

Select the Studies tab in the upper left hand corner.

Select New in the lower left hand corner.

Name the strategy (i. e. StressIndicator)

Click in the script editor window, remove “plot Data = close;” and paste the following:

—thinkorswim

A division of TD Ameritrade, Inc.

WEALTH-LAB: MARCH 2014

In this issue, Perry Kaufmans article “Timing The Market With Pairs Logic” promises an interesting new take on pair trading. As discussed in the article, combining Kaufmans stochastic-derived intermarket stress indicator with a few clear position-sizing and risk-management rules lays the foundation for a long-only market timing system.

To execute the trading system that we are presenting here in Wealth-Lab strategy code, Wealth-Lab users need to install (or update to) the latest version of our TASCIndicators library from the extensions section of our website if they havent already done so, and restart Wealth-Lab.

FIGURE 4: WEALTH-LAB. Here is a sample Wealth-Lab 6 chart illustrating application of the systems rules on a daily chart of HES (middle pane). An SPY chart is shown in the upper pane, and the stress indicator is plotted in the bottom pane.

—Eugene, Wealth-Lab team

MS123, LLC

AMIBROKER: MARCH 2014

In “Timing The Market With Pairs Logic” in this issue, author Perry Kaufman presents a pair-trading technique based on his new stress indicator. A ready-to-use AmiBroker formula for implementing the stress indicator is presented here. To display the indicator, input the formula into the formula editor and press “apply indicator.”

—Tomasz Janeczko, AmiBroker

NEUROSHELL TRADER: MARCH 2014

The stress indicator described by Perry Kaufman in his article in this issue (“Timing The Market With Pairs Logic”) can be easily implemented with a few of NeuroShell Traders 800+ indicators. Simply select new indicator from the Insert menu and use the indicator wizard to set up the following indicator:

To implement the stock-trading side of the pair, simply select new trading strategy from the Insert menu and enter the following in the appropriate locations of the trading strategy wizard:

To implement the hedge signal and calculate the size of the hedge, simply select new indicator from the Insert menu and use the indicator wizard to create the following indicators:

Users of NeuroShell Trader can go to the Stocks Commodities section of the NeuroShell Trader free technical support website to download a copy of this or any previous Traders Tips.

A sample chart is shown in Figure 6.

FIGURE 6: NEUROSHELL TRADER. This NeuroShell Trader chart displays the stress Indicator and corresponding stock trades.

—Marge Sherald, Ward Systems Group, Inc.

AIQ: MARCH 2014

The AIQ code based on Perry Kaufmans article in this issue, “Timing The Market With Pairs Logic,” is provided at TradersEdgeSystems/traderstips. htm .

The code I am providing will backtest only the long trading and will 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 matchmaker module that will quickly generate a list of stocks that show significant correlation to an index. In Figure 7, 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 8, I show the results (part of which are hidden). After highlighting the ones desired for a list, simply click on the “data manager” button and a list is created, which is then used to run the tests.

FIGURE 7: AIQ, MATCHMAKER SETUP. Here is the setup used to get a list of stocks in the NASDAQ 100 that are highly correlated to the NDX.

FIGURE 8: AIQ, RESULTING LIST. Here are sample results of running the setup shown in Figure 7.

for AIQ Systems

TRADERSSTUDIO: MARCH 2014

The TradersStudio code based on Perry Kaufmans article in this issue, “Timing The Market With Pairs Logic,” is provided at the following websites:

The following code file are provided in the download:

Function PK_STRESS — returns the Kaufman stress value

Function COUNTOF — returns the number of times a rule is true in a set lookback 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 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 9, I show the log equity curve and the underwater percent drawdown curve over the test period 1/1/2000 to 1/8/2014. Until 2011, the max drawdowns were in the 14% area but in 2011 the max drawdown incurred was 22.7%. The compound annual return over the test period was 14.9%.

FIGURE 9: TRADERSSTUDIO. This shows 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.

Please note that the code I have provided differs from the authors 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.

The code is also shown here:

—Richard Denning

for TradersStudio

NINJATRADER: MARCH 2014

We have implemented a strategy for NinjaTrader users based on “Timing The Market With Pairs Logic” by Perry Kaufman in this issue. The strategy is available for download from ninjatrader/SC/March2014SC. zip .

Once it has been downloaded, from within the NinjaTrader Control Center window, select the menu File → Utilities → Import NinjaScript and select the downloaded file. This file is for NinjaTrader version 7 or greater.

You can review the strategy source code by selecting the menu Tools → Edit NinjaScript → Strategy from within the NinjaTrader Control Center window and selecting the “Timing With Pairs” file.

NinjaScript uses compiled DLLs that run native, not interpreted, which provides the user with the highest performance possible.

A sample chart implementing the strategy is shown in Figure 10.

FIGURE 10: NINJATRADER. This screenshot shows the TimingWithParis strategy applied to a daily chart of the stock HES (while SPY is the second symbol internal to create the pair).

—Raymond Deux Patrick Hodges

NinjaTrader, LLC

UPDATA: MARCH 2014

This months Traders Tip is based on “Timing The Market With Pairs Logic” by Perry Kaufman. In his article, Kaufman develops a correlated pair-trading system for use across fundamentally different markets to better mitigate risk across a portfolio. The key indicator in this system seeks to identify when both spread legs are at maximum divergence, and enters reversion trades at these points.

The Updata code for this article is in the Updata library and may be downloaded by clicking the custom menu and system library . Those who cannot access the library due to a firewall may paste the code shown here into the Updata custom editor and save it.

FIGURE 11: UPDATA. Here is a sample pair-trading strategy for the SPY index/USB UN equity. The stress indicator is shown in the middle pane.