# how to implement momentum strategy for stocks in R

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!

• What do you have so far? – amdopt Nov 21 '20 at 16:43
• I solved! I've answered below.Thanks for you time! – 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.