Model Lempetje is a forex trading system model packaged into an expert advisor (robot) 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 forex instruments. In the case that there is strong evidence of cointegration the two instruments are traded by the robot as one stationary process. The robot makes entries every time the model spread/deviation (residual time series) crosses a multiple of standard deviation from mean.
To explain this operation further, suppose the model spread crosses the first standard deviation (negative or positive side) away from the mean. Then the robot 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 robot will NOT close the order pair opened earlier when the model spread crossed the first standard deviation. Rather, the robot will open an additional new order pair with same lot sizes as the previous order pair. This means we will have a grid of order pairs spaced by standard deviation and they only be closed (one by one) as the model spread crosses the multiples of standard deviation on its way towards the mean. 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 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. CR is the common ration for adjusting lot sizes (CR >= 1). Recommended as CR = 1 for this model.
3. Lots is the nominal lot size. Minimum usually 0.01.
4. Magic & magik are magic numbers (should never be the same) used to uniquely identify trades opened by this robot. As such every magic number should be uniquely chosen positive integer.
5. TFrame is the time frame in minutes.
6. MaxLots is the maximum lot size that a user doesn’t want a single trade to exceed.
7. PairOne & PairTwo are two 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. Sometimes (not always) it helps to pick the instruments that already known to be correlated (although correlation doesn’t imply cointegration).
8. 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.
9. SaveData is the switching Boolean parameter. It switches from data-consuming (but indestructible) mode and data-saving (but prone to inaccuracies if there are internet cuts and temporary disallowed trading conditions set by broker). Mode.
10. AlertsOn is switching Boolean parameter. When true, recurrent alerts will be shown, otherwise they won’t be shown.
11. The Username and Password will be provided by your direct supplier or agent.
12. RSThreshold is the threshold for R^2 goodness of fit measure (for cointegration model) below which trading will not happen.
13. CCThreshold is the threshold for correlation coefficient measure below which no trading will happen.