+ Rate of Change

ClassicScott Güncellendi   
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.
Sürüm Notları:
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.
Sürüm Notları:
added alerts for divergences
Sürüm Notları:
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.
Sürüm Notları:
- 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.
Sürüm Notları:
I'm publishing updates to all of my indicators, so I'm just going to comment on everything here since most of the updates are common across most of my indicators.

User Non-Visible Updates (basically backend stuff that makes:
- changes in code legibility and consistency across all indicators (basically standardizing the coding across as many indicators as possible)
- implementation of libraries into my indicators; which helps significantly in doing what I typed above; which in turn will make creating any new indicators, if they are of the type to use these libraries, much simpler
- updated descriptions for all indicators, which should (it's possible I've forgotten things) reflect changes I've made recently and any I may have made in the past after first publication (this is very minor, but as I was changing so much I thought I may as well--I don't intend to update these much, if at all, in the future)

User Visible Updates:
- as I mentioned everything now uses my moving averages library and volatility bands library--this cuts down the total amount of code significantly, and has made it easier for me to add moving averages, or volatility bands to these indicators because I only had to/have to add it one time (to the library) rather than multiple times across all indicators*
- since creating these libraries I've added several new moving averages (Kaufman Adaptive, Laguerre Filter, McGinley Dynamic (doesn't work for all), and Zero-lag) to them while retaining all the previous with the exception of the UMA, which wasn't implemented consistently across all indicators anyway
- eliminated having two Bollinger Bands with different standard deviations and a fill between them in exchange for one with the band fill implementation that I use on my Donchian Channels Bands
- part of my code consistency across all indicators resulted in a much needed organization of the 'style' tab

*(affects all but the Wavetrend Oscillator, Wavetrend Oscillator Overlay, Jurik KDJ, Average Candle Bodies Range, Bollinger Bands Width, ALMA Trend Detector, Ultimate Moving Average, Donchian Channels, and Dynamic Donchian Channels)

Açık kaynak kodlu komut dosyası

Gerçek TradingView ruhuyla, bu betiğin yazarı, yatırımcının anlayabilmesi ve doğrulayabilmesi için onu açık kaynak olarak yayınladı. Yazarın eline sağlık! Bunu ücretsiz olarak kullanabilirsiniz, ancak bu kodun bir yayında yeniden kullanımı Kullanım Koşulları ile yönetilir. Bir grafikte kullanmak için favorilere ekleyebilirsiniz.


Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.

Bu komut dosyasını bir grafikte kullanmak ister misiniz?