Good afternoon everybody,
i’m trying to code an indicator that measure the strength of the trend (or momentum) of a given stock or ETF.
The inspiration for this indicator is from a company who makes trading researches and trading systems based on this measure. I’ve put together some quotes from their website to try to better understand how the indicator is calculated:
1- We use a special calculation of a trend strength that improves on the simple concepts of 6 to 12 month percent change used by IBD and James O’Shaughnessy. The trend strength indicator measures the price momentum over multiple time frames to be more responsive to changes in momentum than a basic percent change measure.
2- Our ETF models use a similar concept to the price change over a given period, however we have added some refinements. The actual trend strength indicator calculation uses proprietarily weighted returns from multiple time frames including six months. These custom weightings end up feeding a lot more data into the calculation then a simple one-period price change and by that measure it can smooth out some of the distortions from other methods of calculation it.
3- The trend strength indicator is also a “diminishing” value, meaning that if an ETF made a big up move and then went sideways for a few months, you would see the initial score rise with the up move and then slowly fade back to zero or go negative if the ETF started moving back down.
4- The trend strength indicator functions differently than oscillators like relative strength. The calculation looks at a series of different return periods with custom weightings for each.
5- The trend strength indicator is an indicator for momentum. It looks at different periods over the last several months and custom weights them to give a momentum score.
6- In term of the persistence of trend, the blend between 3 and 6 months performance (measured with ROC) is probably the best indication of what is most likely to persist.
In the attached PICTURE-1 you can see the trend strength measure represented as a line for the stock ADSK, the picture is taken from their website.
I used that representation to try to model my own calculation. I’ve tryed several combination of timeframes and weightings. The following code is the one which gives the most similar result:
<pre class=”lang:probuilder decode:true crayon-selected” title=”trendstrength”>mw=ROC[5](close)
m1=ROC[28](close)
m3=ROC[68](close)
m6=ROC[131](close)
zer=0
trendstrength= (m6*0.2)+(m3*0.4)+(m1*0.2)+(mw*0.2)
return (trendstrength) coloured (0,70,250) style(line,2), (zer) coloured (0,0,0) style(line,1)
In attached PICTURE-2 you can see the comparison between my indicator and the original one. Even if it’s similar, the difference is evident.
I’ve also tried to use different ways to measure momentum such as the one described in this topic https://www.prorealcode.com/prorealtime-indicators/relative-strength-rank-indicator/ but the results are not similar to the original.
Can someone help me understand how to calculate it correctly?
Thank you and have a nice day!
Fabius