Triangular Statistical Arbitrage Indicator
Model Lelora is a forex trading system model packaged into an indicator executable on a PC running Metatrader 4. The model exploits the mean-reversion property of stationary processes. Stationarity is determined or confirmed by performing cointegration tests between three forex instruments that form a triangle (i.e have a product relationship like EURUSD = EURGBP * GBPUSD). In the case that there is strong evidence of cointegration the two instruments can be traded as one stationary process. The trader can make entries every time the model spread/deviation (residual time series) crosses a new multiple of standard deviation from on its way from the mean. The indicator plots four multiples of standard deviation (-4 Std, -3 Std, -2 Std, -1 Std, 1 Std, 2 Std, 3 Std, 4 Std) in the indicator window below the main chart window. The indicator also displays some useful information (i.e. cointegration model parameters, lot size ratio, standard deviation, model deviation, levels, etc) in the main chart window.
To explain this operation further, suppose the model spread crosses the first standard deviation (negative or positive side) away from the mean. Then the trader will open two orders which together act as one order pair for model spread as a synthetic instrument (a stationary one). If the model spread goes further away to cross the second standard deviation from the mean, the trader can pen a new order pair with same lot sizes. The trader should wait until the model spread reverts back to the mean (i.e. level 0) and close all trades and start afresh. The end result is always that when the model mean finally reverts back to the mean there will be net profit in so far as the cointegration model is still valid.
There is a good reason why it is safe to keep opening order pairs as the model spread keeps moving away from the mean. That reason is that, since the model spread is a tested stationary process then it has a tendency of mean reversion and binning this process result in Gaussian histogram profile and this tells us that the probability of model spread moving further and further away from the mean decreases exponentially. It is for this reason that always betting that model spread is bound to revert back to the mean value results in an investment system with a positive expectation value which can be calculated explicitly given the mean and variance of the Gaussian histogram profile.
The lot size ratio is given by the coefficients of the instruments displayed in the main chart window (i.e. if the model is EURUD = 1.14*EURGBP + 0.82*GBPUSD + 1.86 for example, then the lot size ratio should be EURUSD : EURGBP : GBPUSD = 1.00 : 1.14 : 0.82. Here are some few rules regarding what to buy/sell and when. Suppose the cointegration model example is given by EURUSD = M*EURGBP + L*GBPUSD + C. Then the rules are as follows (Remember we only make entries when the model spread crosses multiples of standard deviation when it moves away from the mean):
1. If Model deviation is negative do the following: (a) buy EURUSD, sell both EURGBP & GBPUSD and (b) set the lot size ratio of EURSD : EURGBP : GBPUSD = 1 : M : L.
2. If Model deviation is positive do the following: (a) sell EURUSD, buy both EURGBP & GBPUSD and (b) set the lot size ratio of EURSD : EURGBP : GBPUSD = 1 : M : L.
The robot has various input parameters (set at default settings) some of which are described below:
1. N is the data size for building cointegration model.
2. TFrame is the time frame in minutes.
3. PairOne, PairTwo & PairTri are three triangular trading instruments which are to tested for cointegration and traded if the test succeeds. The robot will report back if the chosen instruments have weak or no significant cointegration and the user should react by choosing a different combination.
4. ModeDemo is the switching Boolean parameter. When true the model will work on Demo accounts but if false it will work on real (or live) accounts.