Good morning, I'm implementing factor investing strategies to choose stocks to insert in a portfolio. I have calculated low volatility factor and now I would to calculate momentum of each stock so then I can confront and choose them. I'm using R Studio. I haven't understood how to implement momentum, if I have to calculate cumulative returns series simply or what. Can someone helps me? Thanks in advance!
-
$\begingroup$ What do you have so far? $\endgroup$ – amdopt Nov 21 '20 at 16:43
-
$\begingroup$ I solved! I've answered below.Thanks for you time! $\endgroup$ – Chariot Black Nov 22 '20 at 17:20
Thanks to @user42108 and @amdopt for yours answers!
I solved in this way:
I've finding functions momentum
and ROC
of TTR
package. In that package there are a lot of function to implement momentum strategies.
I've downloaded time series with tseries
and I've calculated momentum on adjusted prices.
Then I putted the vector of momentum values and the 'zoo' object that contained prices and tickers side by side, and I generated multiple momentum charts, highlighted the zero axis.
Then, to test the results, I created a new vector in which I assigned the value "1" to the momentum values >= 0 and the value "0" otherwise. I counted the 1's for each symbol (using the aggregate
function) and sorted everything in descending order.
Maybe it's a very simplistic way, but not having to use it for trading purposes, I made it enough. I investigate the momentum intended as a market anomaly and not for trading purposes.
Sorry for my english, I'm Italian, I've been improving it :D
There are a number of resources online for momentum strategies in R, e.g. https://rviews.rstudio.com/2019/05/29/momentum-investing-with-r/ or https://alphaarchitect.com/2019/07/11/momentum-quality-and-r-code/. I'd guess R Bloggers probably covered this, too. You might want to start with those and see if they answer your question(s).
-
$\begingroup$ Actually, I have already seen those articles, but thank you anyway! At the end, I solved, I'll write as comment the way in which I've done. $\endgroup$ – Chariot Black Nov 22 '20 at 17:05