What should be the optimal look back period for Mean reversion strategy?
You need to optimize the lookback period using a brute force approach. That is, trying out various values which give you the best results. But strictly speaking, this has to be done in-sample. Once you determine the optimal lookback period in-sample you need to validate the strategy performance out-of-sample. If everything works out well you can use that paper trading or live trading.
Another way is to set the lookback period equal to a small multiple of half-life. The half-life gives you the estimation of the time it takes for a time-series to mean revert
Thanks.
Thanks Ishan. I was working on Multivariate Pair Trading. Like trading 1 stocks against 2 stocks in the same sector. I am using linear regression to create this model. Since I will have 2 slopes for X1 and X2 (stocks) in what ratio I need to trade on X1 and X2 AGAINST Y.
The equation of the spread will be = y - m1x1 - m2x2. Here y, x1 and x2 are three different stocks. For example, HDFC, HDFC Bank and Kotak Bank.
To go long on the spread, you will buy 1 share of y, and sell m1 shares of x1 and sell m2 shares of x2. Similarly, for short you will take exact opposite positions, you will sell 1 share of y, and buy m1 shares of x1 and buy m2 shares of x2.
Thanks
Hi Ishan, An after thought,w the ratio not be m1x1:m2x2?
Thanks,
Arun
Yes, we will be trading in that ratio only. You can check out the code implementation of the triplet here: https://quantra.quantinsti.com/startCourseDetails?cid=55§ion_no=3&unit_no=18
Thanks
Thanks a lot Ishan. When I back test this model for Forex, I am getting an issue of values of X, Y being small. Is there an alternate model to be deployed in this case? Please clarify.
If you are getting an error while checking for cointegration using ADF test then you can use Johansen test instead. However, it is recommended that you pass sufficient data points say 90 to 100 days to determine if the spread is stationary. If you are getting an error somewhere else then please share the screenshot, code and the data files to help you. Thanks
Let me try this out and come back. Thanks
Hi Ishan, what should be the stop loss for triplet trading. Can you let me know.
thanks,
Arun
???
The stop-loss for these strategies can be set in two ways as shown below
- Based on standard deviation: for example, if the entry price is X standard deviation away from the mean the stop-loss can be set to 1.5X standard deviation away from the mean.
- Based on actual $ loss: for example, at 5% or $1000
Hi Ishan,
When we do Johanson test, if I have 3 stocks X1,X2,X3 and it is stationary I will go ahead and enter trade basis my parameters. Combination X2,X1 and X3 will also throw similar values but for the Eighen value which is varying for these 2 triplet. How can I enter trade for the same combination of stocks again? Is it right?
Also, will the amount of SHort and Long is close to equal if not, then this will not be a case of trade neutral. Am I right?
When we do Johanson test, if I have 3 stocks X1,X2,X3 and it is stationary I will go ahead and enter
The eigen values shows how strong the timeseries is mean-reverting. Yes, there are multiple combinations possible but you should trade the combination whose eigen value is highest.
Also, will the amount of SHort and Long is close to equal if not, then this will not be a case of trade neutral. Am I right?
The dollar amount of long and short might not be equal in all the cases. We are trying to capture the relationship between two instruments.
For example, imagine you have paired a small cap stock with a large cap stock. The small cap stock by nature is more volatile. If you equate the amount of long and short, say $100 to both of them, most likely the performance of the spread strategy will be determined by the movement of the small cap stock. We don't want this therefore we will do linear regression to find the ratio of amount of short and long.
If you are trading two instruments which have similar properties such as HDFCF and HDFC Bank then most likely the amount of long and short will be close to equal.