indiTraders - Forum for the Active Indian Trader  

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

Indicators & Systems Compendium of Code

NordFX
Reply
 
Bookmark and Share LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old 07-11-2017, 11: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 kkseal View Post
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.

It is too late night now for me. Will post it tomorrow.

-Anant
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to asnavale For This Useful Post:
  #12 (permalink)  
Old 08-11-2017, 10:09 AM
smeaglegolum smeaglegolum is offline
Newbie
 
Join Date: Jan 2015
Posts: 3
Thanks: 0
Thanked 7 Times in 3 Posts
smeaglegolum is on a distinguished road
Default

I'm the author of the article. There was no intention of showing the calculations to be complicated. I was merely following the formula given in the book by Wesley Gray.

I did realize & some others pointed as well that the momentum score can be obtained by 12 month ROC.

The main intention of circuitous way of calculating the momentum score was to have the option of calculating the quality of momentum (the path taken by the stock price). I've never got to that part. In future, I will do an article comparing the momentum portfolios with & without the quality filter.



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 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

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 smeaglegolum For This Useful Post:
  #13 (permalink)  
Old 08-11-2017, 10:09 AM
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 asnavale View Post
It is too late night now for me. Will post it tomorrow.

-Anant

Originally Posted by kkseal View Post
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.

Originally Posted by kkseal View Post
100*(last mth ROC - 1st mth ROC)/1st mth ROC seems like acceleration for the period Far from what is intended.



Let us look into the detailed calculation of momentum score as defined in the article quoted earlier.

Rate of Change (ROC) is expressed as a percentage. It is calculated by dividing the total cange in price by initial price and then multiplying with 100. If we denote initial price as C2 and the latest price as C1 then ROC is given by 100 * [(C1-C2) / C2]. This on simplification gives ROC = 100 * (C1/C2 - C2/C2) = 100 * (C1/C2 - 1)

In the article referred earlier the ROC is calculated each month for the past 12 months. If we denote Close price one month back as C1, two months back as C2 and so on, the close 12 months back is C12 and 13 months back C13. Using these Close prices calculate monthly ROC using the relation given above. So, ROC 12 months back is 100 * (C12/C13 -1), 11 months back it is 100 * (C11/C12 - 1) and so on and the ROC one month back is 100 * (C1/C2 - 1)

Now, for Momentum Score calculation these are the steps:

1) For each month divide ROC by 100 and add 1 to it. Thus for previous month we calculate ROC/100 + 1 = 100*(C1/C2 - 1)/100 + 1 = C1/C2 - 1 + 1 = C1/C2
Similarly, two months back it is C2/C3 and so on. Then 12 months back it is C12/C13.
2) Now multiply these 12 monthly values and subtract 1 from the result and multiply the result with 100 to get the Momentum Score for last 12 months.

M_Score = [(C1/C2) * (C2/C3) * (C3/C4) * ... * (C12/C13) - 1] * 100

From the above equation we see that except C1 and C13 all others appear once in numerator and once in denominator and therefore, cancel out. This gives us the simplified relation M_Score = 100 * (C1/C13 - 1). This can be written as M_Score = 100 * (C1-C13)/C13. This is nothing but the ROC for the whole year(past 12 months) as defined in the beginning of this post.

Thus calculation of M_Score is a simple one step process unlike the long winding calculations given in the article.


-Anant
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 4 Users Say Thank You to asnavale 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


NordFX

All times are GMT +5.5. The time now is 06:59 PM.


vBulletin Copyright by vBulletin

Content Relevant URLs by vBSEO 3.3.2