ClassicScott

+ Rate of Change

NOTE!* If you were using my previous + Rate of Change (and OBV) indicator, I will not be updating that. OBV was moved to my + Breadth & Volume indicator.
This indicator here is basically and updated version of the old indicator, without OBV.

The Rate of Change , or RoC , is a momentum indicator that measures the percentage change in price between the current period and the price n periods ago.
It oscillates above and below a zeroline, basically showing positive or negative momentum.
I applied the OBV's calculation to it, but without the inclusion of volume (also added a lookback period) to see what would happen. I rather liked the result.
I call this the "Cumulative Rate of Change ." I only recently realized that this is actually just the OBV without volume , however the OBV does not have a lookback period, and this indicator does.

Doing some more fiddling, I realized that removing both the signum and the volume from the calculation gets you basically a price chart, but calculated as the change in price over n periods. I'm leaving this in because maybe someone discovers they really like having a line chart with moving averages or some other indicator on it to leave their main chart indicator free (giving a more clear look at price action). Can't hurt, right?

Default lookback is set to 1, but play with longer settings (especially if using the traditional RoC , which is by default in TV set to 10, and is nigh on useless at 1--I like 13).

Default source is set to each candle close, but give ohlc4 a look. It smooths out the indicator a bit, and because it's an average of the open, high, low, and close it should give a better idea of what price in general is doing.

Moving averages, Bollinger Bands , Donchian Channels , candle coloring and alerts are my usual additions.

Below are some comparison images of the different indicators wrapped up in here.

Comparison of Cumulative Rate of Change with two different sources. Lookback set to 1.

Cumulative Rate of Change as a price chart, essentially.

And, lastly, the traditional Rate of Change indicator.
Release Notes: added auto-plotting divergences

In the above image the top indicator is the cumulative version of the Rate of Change, and below that is the Rate of Change indicator, with normal divergences plotted.
Release Notes: added alerts for divergences
Release Notes: I have to say I've done a lot here. Just by changing a couple of things in the calculation I've basically changed all but the Rate of Change portion of this indicator completely. But this is a good thing!

I've updated this in the indicator notes for any new people who might stumble upon this, but I will also obviously outline below.

I hope, also, that this doesn't cause any trouble for anyone currently using the cumulatively calculated forms of this indicator. Send me a message if you have any questions, please.

As quoted in the notes:
"The two additions to this have been changed somewhat since the initial release, both of which incorporate 'true range' in the calculation. The first is essentially the OBV without including volume, then multiplying by the true range. The previous release did not include the true range into the calculation, making it a difficult to use indicator (it was mostly experimental). The second is essentially the same, but excludes the signum, a mathematical function that is incorporated in the OBV as well.

How did this work previously, and how does adding true range improve upon this and create a very nice bias indicator? Also, what the heck is a 'signum'?

The previous iteration was an accumulation of the change in price from one bar to the next, then taking the signum of that number. So what does the signum do?

Signum is a mathematical function that looks at a specific number and adds 1 if the number is > 0, subtracts 1 if it is < 0, and essentially does nothing if the number is = 0. It doesn't add or subtract 1 to or from the number (price, in this case); the total output is 1, -1, or 0 only. This is used in the OBV, as I stated, as well as in this cumulative change in price. In even simpler terms, the indicator moves up 1 if a candle closes up, down 1 if it closes down, and on the off chance that there is no change in price does nothing. This means that no matter how big the candle is (or, in the case of the OBV, how much volume is also included) the indicator will always only make one equal movement up or down. This can give strange readings because a chart could produce five small-bodied candles in a row and then one large candle that closes below all of them, but the indicator will show five equal moves up, and one down (as I said, signum only looks at if the number is positive or negative, not how big that number is). However, multiplying this 1 or -1 by the true range gives one a properly useful indicator in which the true range of each candle is accounted for in addition to if it closed up or down. If you don't know what the true range is, it is the maximum of one of three numbers: the high minus the low, the high minus the previous close, or the previous close minus the current low.

The other addition to this little suite used to be what essentially was a line chart of price (cumulative change, but without the signum function). This seemed to me somewhat useless, but again, by calculating with the true range we achieve a more useful indicator. This produces something a little bit different from what I call the Cumulative True Change. Well, I call them both that, but one calculates with signum, the other not. They are both excellent momentum and trend-based indicators that suffer somewhat in sideways, choppy markets. Even so, I think they can be useful in determining when to short highs or buy lows in these market conditions when used in conjunction with price levels, moving averages, or some other indicator that is designed as a signal indicator."

Below are two charts with both indicators, and candle color turned on one and then the other as a helpful way to see the differences between the two using the default moving averages (candle color is related to the indicators relation to both moving averages).
First, the one calculated with the signum. You'll notice it's a bit more choppy, but easier to read.
 
And the second, calculated without the signum, which in my mind gives a more accurate portrayal (at least here) of momentum, but is more difficult to read.
 
Lastly, I added some little symbols for moving average crosses, and RMA and VWMA moving averages. Annnndddd, updated to version 5 of pinescript.
Release Notes: - literally changed a default moving average setting just so I could try again to post those damn images. So frustrating that those didn't show. Using the app and not the web version to post images doesn't work so smoothly it seems, or I just don't know what I'm doing. Sorry for what seems to be a typical dumb update of mine.

Lets try this again.
Below is the version calculated with signum and candle coloring turned on.

And below is the version calculated without signum and candle coloring turned on.

I hope to God this works.
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?