Language: ▾
• • Log-Residual model

Model description

LOGRESIDUAL model is based on Time-series Cointegration. It is based on a fact that mutually correlated stocks pairs have mathematically similar course of its price. In other words:

(1)          PriceA = X * PriceB + Y

This equation can be modified as follows:

(2)          Residuum = PriceA - (X * PriceB + Y)

Note: Parameters X, Y are determined by the least squares method (linear regression) using EOD time series of prices A and B. Length of the series, for which the regression is implemented, is given by a parameter “Period”.

In ideal case (ideal correlated prices) the equation (1) would be exact, which means that Residuum in the equation (2) would equal to zero. In the real markets environment are all prices correlated imperfectly, which means that the residuum is not equal to zero.

When the stocks are correlated strongly, the residuum will behave as “white-noise”, which means that there will be random data with normal distribution. In ideal case the residuum will be permanently oscillating around zero with a constant amplitude and with a distribution as per the Gaussian curve of normal distribution.

Anticipation of normal distribution of the residuum enable us to apply standard statistical apparatus, which can evaluate optimal time for entrance to the position.

Procedure of RESIDUAL model calculation

1. Close prices of stocks A and B are replaced by their logarithm
2. Based on the procedure described above a regression parameters are estimated for today
3. Residuum is calculated - difference between real and estimated price B
4. Standard deviation is calculated from values of Residuum at “Period” days back - StDev
5. Relative standard deviation RelDev is calculated = Res / StDev
6. If the RelDev will exceed the specified limit, the trade will be entered
Item Description
Log(CloseA) Logarithm from EOD Close stock A
Log(CloseB) Logarithm from EOD Close stock B
Residuum = LinRegEst(LogCloseA) - LogCloseB A difference between CloseB price estimated based on a linear regression and real price CloseB
ResiduumMA = MovingAverage(Period, Residuum) Moving average of Residuum values within Period of previous business days.
StDev = StDev(Period, Residuum) Standard deviation of Residuum values within Period of previous business days.
RelStDev = (Residuum - ResiduumMA) / StDev Relative standard deviation - comparison of current Residuum value with historical course within Period of previous business days.

Entry to a position

Entry to a position is indicated, when relative standard deviation will exceed previously specified limit. Default entry level is 2.0, which corresponds to 95% quantile of values.

Exit a position

Position is finished (exit), when relative standard deviation will exceed previously specified limit. Initial value of the exit level is 0.0, ie. long-term average of the Residuum. It means that speculations are made on return of short-term bias of the value back to the average.

If the prices ratio will not return to average value in the specified time, the position is closed by so called “Time Stop Loss”. Initial value for the time stop loss is 15 business days.

Graphic display of LOGRESIDUAL model

Item Description
Residuum (black) Residue of liner combination of Stock A and B prices calculated by linear regression with specified Period
Entry levels (silver) Upper level (=entry level to Short position) = Entry level * Standard error of linear regression

Lower level (=entry level to Long position) = -Entry level * Standard error of linear regression

Pair equity (black) Resulting pair equity