+ Breadth & Volume

ClassicScott Mis à jour   
note* If you've used my "+ Rate of Change Indicator", I am updating that without the OBV, which has been moved here. Just an FYI.

This "indicator" is basically a variety of indicators that measure volume, or accumulation/distribution. There's a bit of a story about how this came about but
it's not that interesting, so I'll spare you.

Indicators from which you may choose here are On Balance Volume (OBV), Money Flow Index (MFI), Chaikin Money Flow (CMF), Chaikin Oscillator, and Positive & Negative Net Volume.

I'll give a brief overview of these below, and if you want to educate yourself further on them you may. There are many web resources for that.

Most people are probably familiar with OBV. It's one of the more commonly used volume indicators, especially in the crypto crowd (at least amongst those traders I follow). It's basically a cumulative (doesn't oscillate around a midpoint) momentum indicator that measures volume of the current period versus volume of the previous period and adds it if price closed higher, but subtracts it if price closes lower. It's another way of using volume to confirm trend.

The MFI is a momentum indicator that measures the flow of money into and out of an asset over some period of time (user input). It's calculated using the RSI, so it can be used similarly to RSI (divergences, overbought, oversold, etc.), but of course unlike the RSI it's calculated primarily using volume and comparing the most recent candle close to the previous one (similar to OBV).

CMF is a volume-weighted average of accumulation and distribution over a some period of time (typically 21). It's a way of measuring accumulation versus
distribution in an asset, and oscillates around a zero line. You would use it similarly to any other oscillator, in that you can look for divergences, and general positive or negative momentum.

Chaikin Oscillator is basically a MACD (without signal line) of the accumulation and distribution index (or line--which is somehow different than simply accumulation and distribution). I haven't looked into these differences deeply, but if you look below at the calculations, and substituted 'ad' for 'accdist' you get very different readings. I actually did that, and what it looks like it would do is turn the actual Oscillator into a MACD signal line. So, by substituting 'ad' for 'accdist' (or the accumulation/distribution index) you produce a signal line of the Chaikin Oscillator.
Anyway, all that confusion out of the way, as I said, it's a MACD on the accumulation and distribution index, therefore it is another zero line oscillator, and similarly to CMF, it's a way of measuring price movements in the chart versus a/d. The zero line isn't just any old zero line, however, it is actually the accumulation distribution line. I've made an OBV version of this by substituting the OBV for AD, so if you prefer OBV maybe you will like that.

Pos. & Neg Net Volume is actually an indicator I had seen made by RafaelZioni. It basically takes net volume, calculates a cumulative of that, then subtracts a moving average of some period from the cumulative net volume in order to create a volume oscillator. Use it like the other oscillators!

Added Donchian Channels, moving averages, Bollinger Bands, colored everything, and alerts.


Below I will post images with the different indicators, everything on default settings (except for lookback period, which I have adjusted to my personal preferences).

Above is an image with the MFI being compared to the RSI since they are very similar (MFI being basically a volume derivative of the RSI).

Chaikin Money Flow set to lookback of 13. You could probably extend that a bit if you wanted to smooth the line more.

Chaikin Oscillator and Chaikin Oscillator of OBV, with a zoomed in look below, to see the differences more clearly.

CO and COBV closer look.

Positive & Negative Net Volume.
Notes de version:
I just changed 'power' to a float from an integer so that you can fine tune the moving average more. It was something that someone pointed out to me in a comment of another indicator I released.
Notes de version:
Been adding auto-plotting divergences to my indicators of late.

I have to say this was kind of a bad spot to take a screenshot, in terms of divergences. Probably the worst spot I could have chosen, tbh. Every indicator on the planet was showing divergences on this grind up from 30k to 50k on bitcoin. And then of course the typical pop all the way at the top that destroys an divergences (except for CMF, apparently? (though it's close)) and traps bulls.
Notes de version:
changing the bandwidth of the donchian bands to a float in half steps, so you can adjust it a bit more minutely. Thought I had changed this across all indicators, but obviously missed it here.
Notes de version:
added alerts for divergences and clarified alert messages
Notes de version:
-converted to pinescript 5
-fixed formula for OBV - previous formula using rate of change instead of just change, was so it could be smoothed, but smoothing obv doesn't work out that great (at least by using rate of change). Consequently it screwed up the Chaikin Osc. OBV because it was double smoothing that. Chaikin OBV works much better now, and changing lookback periods produces results that make much more visual sense.
-added colors for center line cross, so the oscillator and candles are highlighted only if they are above or below the center line
-improved the reading of some menu items
--added a couple moving averages
Notes de version:
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.

Specific to + Breadth and Volume I've added Accumulation-Distribution, Price Volume Trend, and the Chaikin Oscillator of PVT as indicators to choose from.

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)

Script open-source

Dans le véritable esprit de TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par le règlement. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.

Vous voulez utiliser ce script sur un graphique ?