[python quantification] Short-term reversal + long-term momentum synthesis strategy under the LSTM framework

The sixteenth part of the timing series, sharing a timing strategy using the LSTM model to combine short-term reversal and long-term momentum. Traditional timing strategies are difficult to respond quickly when momentum collapses. The strategy in this paper can effectively improve this point, using momentum to grasp long-term trends, and using reversals to capture short-term changes. The author has attached the code along with the article. To get the original text, please reply " Chose Time 16 " in the background of the official account "Quantitative Frontier Express" .

Strategy Overview : Long-term momentum here is represented by 12-month returns, and short-term reversals are expressed as 1-month returns. The idea of ​​strategy construction is relatively simple. The author uses a change point detection model CPD (ChangePoint Dection). Normally, long-term momentum is used to track the trend. When a change point is detected, it switches to a short-term reversal signal and performs mean regression. CPD is a purely statistical model. The role of LSTM here is that the output of CPD is a score of 0-1. The author uses this score and some other price and volume signals as the input of LSTM, and uses the output of the LSTM model as a strategy signal.

CPD part : The algorithm of CPD is skipped, and the description of ChatPDF is attached, see the report for details.

a762e9d5a1c1779605e72b107566f77f.png

The following figure is an example of CPD for the S&P 500

d1a5caf491ef2d4d8b52ff948bfe6b8a.png

The CPD model finally outputs two values, the position of the change point and the score of the change point. The author found that the performance and stability of the model were improved after adding these two values.

929da58454beed28e41a91da91a866a4.png

Policy statement

The traditional time-series momentum can be expressed as follows

06d4c1a24a95bdfba7e32e409031e3f0.png

Superimpose short-term reversals on top of traditional time-series momentum

ed6d5d793131504e6dd8cfc9419895e2.png

The setting of the policy is mainly to determine the value of w.

LSTM part

model input

2ae20928c8bdf35975ac98902c5c0805.png

Loss function: Sharpe ratio

8983b34fc7ad3f8002f51cdd24aac823.png

strategy performance

The strategies in the red box are under different window periods. Compared with TSMOM and Long Only strategies, the performance of income, Sharpe ratio and retracement has been significantly improved

6d9246e94168816fcd09cf8a3a37338c.png

The author has tested on multiple varieties, all of which are effective

1a0681d33781e82deecf51c2e94f4b4a.png

And it can be seen that the LSTM+CPD version is better than the pure LSTM version

042e2a5334840b7b036374e9b398dbe3.png

The above is the main content of the full text. The code is a bit long, so I won’t attach it. If you are interested, download and understand it yourself.

e8f26f4ec713cceada612ff772ee1279.png

Finally, attach the description of ChatPDF

bad6b6c653fcc9cf50975f61cabe0daf.png

27894e4af31a6318dcbb5f9b18b93854.png

1138f38cc15a51d0c7757ed4b99ed62a.png

b549bc2cb096dc0e0e5e479bf86bdbb0.png

Full text of the above

If you feel good, you can click to watch/like to support it

Guess you like

Origin blog.csdn.net/FrankieHello/article/details/131606633