Pairs Trading Expert
- 专家
- Rasoul Mojtahedzadeh
- 版本: 2.0
- 更新: 20 三月 2024
- 激活: 5
This expert advisor implements the conventional quantitative trading algorithm known as Pairs Trading. It operates by identifying a hedge ratio between two correlated trading symbols, thereby generating a synthetic stationary symbol suitable for trading through a mean-reversion strategy. The expert advisor dynamically computes the optimal hedge ratio for the selected symbols and initiates synthetic BUY/SELL positions when the spread of the synthetic price deviates from the mean level, reaching either negative or positive extremes. The underlying hypothesis posits that the synthetic symbol will revert to its mean value, prompting the closure of the basket and realization of profits.
Two levels of the standard deviation as entry points can be set by the user in the input settings. The EA will then open a basket of positions at these entry levels. The user can also specify at which level of the standard deviation the EA shall close the basket, by default it is set to zero (mean level). The base symbol lot size can be adjusted by the user while the hedge lot size will be automatically calculated by the EA to maximize the probability of mean-reversion.
The EA works with any two symbols of any markets (Forex, Stocks, etc.). However, if you are going to use it on Forex market, it is highly recommended to choose two symbols with one currency in common, for example, attach the EA to USDCAD chart (base symbol) and set the hedge symbol = AUDUSD in the input settings. Note that the base symbol is always the chart's symbol that you attach the EA to.
Input Settings Description
- Hedge Symbol (string): The hedge symbol name that exists in the Market Watch. Default is empty, if you leave it empty the EA will choose AUDUSD by default.
- Exit Std Level [0, inf) (double): The standard deviation level at which the EA will close a basket. Default is zero (mean level).
- Entry Std Level (0, inf) (double): The standard deviation level at which the EA will open the first basket. Default is 1.0.
- Lot Size Scaler (double): The base symbol lot size. Default is 1.0.
Notes:
- The default input settings (that is, Exit Std. Level and Entry Std. Level) need to be optimized for each two symbols of choice.
- For optimizing the Exit and Entry levels, it is recommended to use the range from [0, 3.0] with 0.1 steps.
- Not all combinations of symbols would be profitable as they might not exhibit any correlation/cointegration!
- The EA uses the open price of each candle/bar, so in the strategy tester set Modelling to Open prices only, this is not a requirement, but accelerates the back testing of the EA.