[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

S&C Mag Pairs indicator code - help w/ CoefficientR



PureBytes Links

Trading Reference Links

I have the code for CoeffR in TS2K but I think the code named "CoefficientR"
as used in the formula from S&C May issue on Pairs Spread trading must be a
derivative of CoeffR.  There are too many inputs in their formula to use
CoeffR.

Below is the indicator for Pair trading taken directly from S&C Magazine.
Please review and tell me what you think they are using for CoefficientR
code.  THANKS!


{S&C mag May 2002 - Pair Trading by Mark Conway &* Aaron Behle combine the
spread, historical volatility & coefficient of R to identify entry & exit
points for stock pairs, Need 4 data with 2 stocks - EX: Data1-ATVI 10 min,
Data2-THQI 10 min, Data3-ATVI Daily(hidden), Data4-THQI Daily (hidden)}

Inputs:  SDev(1.5), Length(30);
Variables: Spread(0), HV1(0), HV2(0), R(0), VB(0);

If Close Data3 <> 0 AND Close Data4 <> 0 Then
 Spread = (Close Data1 / Close Data3) - (Close Data2 / Close Data4);

If Date <> D[1] Then Begin
 HV1 = StdDev(Log(Close/Close[1]), Length) Data3 * SquareRoot(252/1);
 HV2 = StdDev(Log(Close/Close[1]), Length) Data4 * SquareRoot(252/1);
 R = CoeffR(Close Data3, Close Data4, Length);
 VB = SDev * ((HV1 + HV2) * SquareRoot(1/252) * (1 - R));
End;

Plot1(Spread, "Spread");
Plot2(VB, "UpperVB");
Plot3(-VB, "LowerVB");
Plot4(0, "Zero");



Thanks,
Brian Oliver
sunfiles@xxxxxxx