Daytrading Stock Pairs (TASC May 2002)

In this issue, Mark Conway and Aaron Behle discuss using volatility and correlation to create a daytrading strategy for pairs trading. To implement a daytrading pairs system using volatility bands in NeuroShell DayTrader, you could use two charts, just as Conway and Behle do. However, we’ll show how to do it here in one chart to make the system integrated and more general.

First, create a chart that contains the two stocks you wish to trade, each on a different chart page. To create a chart with two chart pages, select “New Chart…” from the File menu and choose the two stocks of interest on the appropriate wizard screen.

The next step is to create the volatility band and spread indicators. To create the indicators, select “New Indicator…” from the Insert menu and use the Indicator Wizard to create each of the following:

PAIRS TRADING SPREAD:

Sub(Divide(STOCKA, DayClose(Date,STOCKA,1)), Divide(STOCKB, DayClose(Date, STOCKB, 1)))

HV – HISTORICAL VOLATILITY:

Mult2(SelectiveStndDev(Ln(Divide(DayClose(Date, Close, 1), DayClose(Date, Close, 2))), Time=X(Date, 3:30PM), 30), Sqrt(252))

VB – VOLATILITY BAND:

Mult4(1.5, Add2(HVSTOCKA, HVSTOCKB), Sqrt(252), Sub(1, LinXYRegr(STOCKA, STOCKB, 390)))

Note that in the above indicators, 3:30 pm is the time of the last bar of each trading day (in this case, we were assuming half-hour bars); 252 represents the number of trading days in a year; and 390 is the number of bars in a 30-day period (in this case, we once again used half-hour bars). Also note that StockA and StockB represent the closing prices of StockA and StockB, but inserted as other instrument data. To insert another instrument into an indicator, press the “Other Instrument Data…” button on the parameter dialogue, select the stock’s ticker symbol, and select close.

To create the daytrading pairs system, select “New Trading Strategy…” from the Insert menu and enter the following long and short entry conditions in the appropriate locations of the Trading Strategy Wizard:

Generate a buy long MARKET order if ONE of the following are true:
AND2 ( A=B(Close, STOCKA ), CrossAbove ( SPREAD, -VB ) )
AND2 ( A=B(Close, STOCKB ), CrossBelow ( SPREAD, VB ) )

Generate a sell long MARKET order if ONE of the following are true:
AND2 ( A=B(Close, STOCKA ), CrossAbove ( SPREAD, 0 ) )
AND2 ( A=B(Close, STOCKA ), A>B(Spread, Mult2(VB, 1.5) ) )
AND2 ( A=B(Close, STOCKB), CrossBelow ( SPREAD, 0 ) )
AND2 ( A=B(Close, STOCKB ), A<B(Spread, Mult2(-VB, 1.5) ) )

Generate a sell short MARKET order if ONE of the following are true:
AND2 ( A=B(Close, STOCKA ), CrossBelow ( SPREAD, VB )
AND2 ( A=B(Close, STOCKB), CrossAbove ( SPREAD, -VB )

Generate a cover short MARKET order if ONE of the following are true:
AND2 ( A=B(Close, STOCKA ), CrossBelow ( SPREAD, 0 ) )
AND2 ( A=B(Close, STOCKA ), A<B(Spread, Mult2(-VB, 1.5) ) )
AND2 ( A=B(Close, STOCKB ), CrossAbove ( SPREAD, 0 ) )
AND2 ( A=B(Close, STOCKB ), A>B(Spread, Mult2(VB, 1.5) ) )

Note that -VB is the same as VB except with a negative standard deviation multiplier. After backtesting the trading strategy, use the ‘Detailed Analysis …’ button to view the backtest and trade by trade statistics for the Day Trading Pairs system. You can choose to view the statistics for each stock or view the average statistics for both stocks.

File Download

tip0502pairs.exe

Was this article helpful?

Related Articles