Below strategy is used by Raghunath sirji..

Momentum is the speed with which a particular object moves. In the financial world, momentum refers to the speed with which the price of the stock or any other asset moves. A stronger momentum indicates a faster movement in the price of the assets in one particular direction. Momentum is generally measured as the 'rate of change' (ROC) of the price over 'X' periods of time. In this article, we discuss 'Rolling Quantitative Momentum', a quantitative approach to investment & portfolio management using momentum in the stock price and re-balance (rolling) the portfolio at regular frequencies.

The book 'Quantitative Momentum' by Wesley Gray & Jack Vogel is the basis of many of the ideas & analysis presented here. While the book analysis has used US stock market data, I've adapted some of these ideas to Indian stock market data - Nifty 500 stocks.

In our Rolling Quantitative Momentum strategy, we design our investment portfolio using stocks with strong momentum and then further refine it using quality of the momentum of stocks, holding period and portfolio size & investment size.

For the purpose of our study, we will use NSE's Nifty 500 stock universe as they represent 97% of the turnover of the market.

**Measuring Momentum**

How can we measure the momentum of stocks?. Momentum is generally measured as the rate of change (ROC) of the stock price over 'X' periods. In many cases, traders use MACD, moving averages, stochastics, RSI etc. In our study, we will use ROC for measuring the momentum. Now, momentum is usually measured over short periods of few days, intermediate periods of few months or long-term periods of few years.

Wesley Gray & Jack Vogel found that an intermediate period of 6-12 months is ideal for measuring the momentum which gives the stock enough room for further upside price action and has a better signal to noise ratio. Shorter periods of momentum measurement tend to have too much noise to signal ratio while long-term periods of momentum measurement doesn't project further momentum in the future as it tends to taper off after a long period. Therefore, we will use 12 months of historical data to measure the momentum.

**Momentum Score**

Monthly momentum values are calculated as cumulative returns over the past 12 months.

The monthly momentum is calculated in 3 steps

1) We calculate gross monthly returns by adding one to the percent monthly return. For example, from a monthly return of 5% (0.05), we get the gross monthly return value of 1.05 (0.05 + 1) while from a monthly return of -5% (-0.05) we get a gross monthly return of 0.95 (0.05 + 1.0).

2) We multiply all the gross monthly returns of past 12 months.

3) We subtract one from the resultant value from step 2 to get the net 12-month momentum score.

To illustrate this calculation, let's say AUROPHARMA (Aurobindo Pharma) stock has moved by 2%, -5%, 4.3%, 0.5%, 10.1%, -2.2%, 6%, 3.6%, 0.1%, 0.4%, 1.4%, -2.6% over the past 12 months. Then, we add 1 to monthly return, multiply all of them & subtract one from it to get the momentum score.

Momentum Score = (1.02)*(0.95)*(1.043)*(1.05)*(1.101)*(0.978)*(0.94)*(1.036)*(1.001)*(1.004)*(1.014)*(0.974) - 1

This will give a momentum score of 10.45% (0.1045) to the Aurobindo Pharma Stock. We will now use the momentum score to build the portfolio.

**Construction of the Quantitative Momentum Portfolio**

We construct the portfolio with stocks showing strong positive momentum. For this study, we use NSE Nifty 500 stock historical data from the year 2000 to 2017 June.

First, we calculate monthly momentum scores for all the nifty 500 stocks and sort them by score & pick the top 10 stocks.

Is it possible for someone to code it in AFL for the greater good of everyone?