indiTraders - Forum for the Active Indian Trader  

Go Back   indiTraders - Forum for the Active Indian Trader > Technical > Indicators & Systems

Indicators & Systems Compendium of Code

FXPrimus
Reply
 
Bookmark and Share LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-11-2017, 08:18 PM
patterntrading patterntrading is offline
Newbie
 
Join Date: Nov 2017
Posts: 1
Thanks: 0
Thanked 6 Times in 1 Post
patterntrading is on a distinguished road
Default ROLLING QUANTITATIVE MOMENTUM STRATEGY - NIFTY 500 STOCKS

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.
We will construct the investment portfolio with 3 different variations

Holding period - 1 month, 3 months, 6 months and 12 months
Portfolio Size - 10 stocks, 20 stocks & 30 stocks
Position Size - fixed investment vs cumulative investment.
Overlapping & Rolling Quantitative Momentum Portfolios

In this strategy, we invest in the momentum portfolios in an overlapping fashion and then rebalance (or rollover) the portfolio after the holding period is over. The overlapping investment in portfolios is best illustrated in Figure 1.

We divide our investment into 3 tranches & invest in the portfolios one at a time with a time gap. For example, in a 3 month holding period strategy, the first tranche is invested in January, second trance in February & the third tranche in March.

By the time we reach April, the holding period of first tranche investment is over and freed up for investing in April. And so on & so forth. As a result, we are able to capture the momentum of various stocks at various times and always stay invested.

This article was originally posted by Raghunath sir of traders lounge.

Can someone please wirte afl for this .. it is very promising strategy.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 6 Users Say Thank You to patterntrading For This Useful Post:
  #2 (permalink)  
Old 06-11-2017, 08:54 PM
asnavale asnavale is offline
indiTraders VIP
 
Join Date: Jun 2014
Posts: 425
Thanks: 873
Thanked 1,239 Times in 418 Posts
asnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to all
Default

Where is the figure 1 ?

-Anant
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 3 Users Say Thank You to asnavale For This Useful Post:
  #3 (permalink)  
Old 06-11-2017, 10:37 PM
novicetrader's Avatar
novicetrader novicetrader is offline
Regulars
 
Join Date: Aug 2015
Posts: 956
Thanks: 1,338
Thanked 1,320 Times in 730 Posts
novicetrader is a splendid one to beholdnovicetrader is a splendid one to beholdnovicetrader is a splendid one to beholdnovicetrader is a splendid one to beholdnovicetrader is a splendid one to beholdnovicetrader is a splendid one to beholdnovicetrader is a splendid one to beholdnovicetrader is a splendid one to beholdnovicetrader is a splendid one to beholdnovicetrader is a splendid one to beholdnovicetrader is a splendid one to behold
Default

Originally Posted by asnavale View Post
Where is the figure 1 ?

-Anant



whole link is here http://www.traderslounge.in/rolling-...ntum-strategy/
__________________
WILD

Last edited by novicetrader; 06-11-2017 at 10:40 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 2 Users Say Thank You to novicetrader For This Useful Post:
  #4 (permalink)  
Old 07-11-2017, 03:20 PM
asnavale asnavale is offline
indiTraders VIP
 
Join Date: Jun 2014
Posts: 425
Thanks: 873
Thanked 1,239 Times in 418 Posts
asnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to all
Default

Originally Posted by novicetrader View Post


whole link is here http://www.traderslounge.in/rolling-...ntum-strategy/

Yes I have already read it.

-Anant
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 2 Users Say Thank You to asnavale For This Useful Post:
  #5 (permalink)  
Old 07-11-2017, 03:30 PM
kkseal kkseal is offline
Hip-py
 
Join Date: Apr 2009
Posts: 4,978
Thanks: 6,571
Thanked 9,571 Times in 4,123 Posts
kkseal has a reputation beyond reputekkseal has a reputation beyond repute
kkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond repute
Default

Pretty much Jagdeesh & Titman 1993 Nothing to ascertain quality of momentum Also stocks usualy reverse after a 3yrs cycle So those showing extreme 1yr momentum + ranked high in 3yr momentum need to be excluded. (Actualy buying 3yr losers - ranked by momentum- may be a better strategy than 3yr winners https://alphaarchitect.com/2015/01/0...turn-reversal/)

Also drawdowns can be huge with mechanical momentum startegies (look at the drawdown stats here with concentrated portfolio 3months holding Retail portfolios likely to be even more concentrated & greater churn) unless some timing mechanism can be incorporated.
__________________
'Growth & Value are joined at the hip' - Warren buffet

Last edited by kkseal; 07-11-2017 at 03:52 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 2 Users Say Thank You to kkseal For This Useful Post:
  #6 (permalink)  
Old 07-11-2017, 04:35 PM
kkseal kkseal is offline
Hip-py
 
Join Date: Apr 2009
Posts: 4,978
Thanks: 6,571
Thanked 9,571 Times in 4,123 Posts
kkseal has a reputation beyond reputekkseal has a reputation beyond repute
kkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond repute
Default

Upon closer look the qlty of momentum issue is dealt with in the way the momentum score is calculated while the drawdown issue (due to short term reversals) sought to be alleviated thru the SIP mechanism of investing.
__________________
'Growth & Value are joined at the hip' - Warren buffet
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to kkseal For This Useful Post:
  #7 (permalink)  
Old 07-11-2017, 04:39 PM
asnavale asnavale is offline
indiTraders VIP
 
Join Date: Jun 2014
Posts: 425
Thanks: 873
Thanked 1,239 Times in 418 Posts
asnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to allasnavale is a name known to all
Default

Originally Posted by novicetrader View Post

whole link is here http://www.traderslounge.in/rolling-...ntum-strategy/

The article in the above link uses calculations which are just like going from Mumbai to Pune via Delhi, Luknow, Kolkata, Chennai, Bangalore etc. The final result obtained by multiplying monthly ROC for past 12 months is very simple to calculate. Take the last month's Close, divide by Close of 12 months back, subtract 1 from it and multiply by 100 (I can prove it very easily and if some one wants to know it I will post it here). For such a simple calculation the author is making it complicated and showing it as if some great mathematical calculations are involved. And as kkseal said above there are lot of other factors to be considered. Just imagine a stock which has completed its upmove and starting to decline. It ranks high in the score but in next three months (or whatever holding time) it is declining regularly, we end up making huge losses.

-Anant

Last edited by asnavale; 07-11-2017 at 11:44 PM. Reason: Had typed ROC onstead of Close. Now corrected
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 3 Users Say Thank You to asnavale For This Useful Post:
  #8 (permalink)  
Old 07-11-2017, 08:33 PM
novicetrader's Avatar
novicetrader novicetrader is offline
Regulars
 
Join Date: Aug 2015
Posts: 956
Thanks: 1,338
Thanked 1,320 Times in 730 Posts
novicetrader is a splendid one to beholdnovicetrader is a splendid one to beholdnovicetrader is a splendid one to beholdnovicetrader is a splendid one to beholdnovicetrader is a splendid one to beholdnovicetrader is a splendid one to beholdnovicetrader is a splendid one to beholdnovicetrader is a splendid one to beholdnovicetrader is a splendid one to beholdnovicetrader is a splendid one to beholdnovicetrader is a splendid one to behold
Default

Originally Posted by asnavale View Post
The article in the above link uses calculations which are just like going from Mumbai to Pune via Delhi, Luknow, Kolkata, Chennai, Bangalore etc. The final result obtained by multiplying monthly ROC for past 12 months is very simple to calculate. Take the last month's ROC, divide by ROC of 12 months back, subtract 1 from it and multiply by 100 (I can prove it very easily and if some one wants to know it I will post it here). For such a simple calculation the author is making it complicated and showing it as if some great mathematical calculations are involved. And as kkseal said above there are lot of other factors to be considered. Just imagine a stock which has completed its upmove and starting to decline. It ranks high in the score but in next three months (or whatever holding time) it is declining regularly, we end up making huge losses.

-Anant

Am a big zero in all these stuffs, just gave the link , thats all
__________________
WILD
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 3 Users Say Thank You to novicetrader For This Useful Post:
  #9 (permalink)  
Old 07-11-2017, 10:47 PM
kkseal kkseal is offline
Hip-py
 
Join Date: Apr 2009
Posts: 4,978
Thanks: 6,571
Thanked 9,571 Times in 4,123 Posts
kkseal has a reputation beyond reputekkseal has a reputation beyond repute
kkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond repute
Default

Originally Posted by asnavale View Post
The article in the above link uses calculations which are just like going from Mumbai to Pune via Delhi, Luknow, Kolkata, Chennai, Bangalore etc. The final result obtained by multiplying monthly ROC for past 12 months is very simple to calculate. Take the last month's ROC, divide by ROC of 12 months back, subtract 1 from it and multiply by 100 (I can prove it very easily and if some one wants to know it I will post it here). For such a simple calculation the author is making it complicated and showing it as if some great mathematical calculations are involved. And as kkseal said above there are lot of other factors to be considered. Just imagine a stock which has completed its upmove and starting to decline. It ranks high in the score but in next three months (or whatever holding time) it is declining regularly, we end up making huge losses.

-Anant

Is that so? Would greatly simplify the calculation I have wanted to do it more or less the same way (geometric mean of returns is what I had in mind) but would necessitate use of loop in my already slow to execute code. Idea is to ascribe a lower rank to stocks that say give small/negative returns most of the months and make biggish jumps for 1-2 mths.
You can use the Auro pharma values to illustrate. Be careful of curve fitting for single stock though Formula should universally subsume what author has suggested or at least serve the same purpose consistently.
__________________
'Growth & Value are joined at the hip' - Warren buffet
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 3 Users Say Thank You to kkseal For This Useful Post:
  #10 (permalink)  
Old 07-11-2017, 11:15 PM
kkseal kkseal is offline
Hip-py
 
Join Date: Apr 2009
Posts: 4,978
Thanks: 6,571
Thanked 9,571 Times in 4,123 Posts
kkseal has a reputation beyond reputekkseal has a reputation beyond repute
kkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond repute
Default

100*(last mth ROC - 1st mth ROC)/1st mth ROC seems like acceleration for the period Far from what is intended.
__________________
'Growth & Value are joined at the hip' - Warren buffet
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 3 Users Say Thank You to kkseal For This Useful Post:
Reply

indiTraders - Forum for the Active Indian Trader > Technical > Indicators & Systems


Tags
afl coding, amibroker

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


FXPrimus

All times are GMT +5.5. The time now is 07:05 PM.


vBulletin Copyright by vBulletin

Content Relevant URLs by vBSEO 3.3.2