+ Balance of Power

ClassicScott Обновлено   
The Balance of Power is an indicator that measures the strength of buyers versus that of sellers in the market, and needs to be smoothed by a moving average to be of much practical use (come to think of it, most indicators are smoothed by a moving average; this is why the RSI lookback mostly commonly used is 14, and not 1, but I digress...). I suppose it is possible to use it without smoothing, but that would be very difficult I think.
The oscillator pivots around a center line, and as with most indicators like this, above 0 is generally considered bullish in a bullish trend, and vice versa in a downtrend.
It can be good for spotting divergences (moreso with smaller lookback periods than I like).

To wit, you might be wondering why I have the default lookback period set at such a large number. My only answer I can give is that I prefer it that way.
The indicator is quite choppy, even when smoothed. The long period helps me to make beter sense of the data (smooth it with a Hull or Jurik MA and you get a different story, though).

In my version of this indicator I provide a pretty broad selection of moving averages with which one may choose to smooth out the BOP, as well as an EMA provided to use as a sort of signal line for trade entries and/or exits, taking partial profits, scaling into a position, etc.

I've also added the option for a second BOP, which is on by default. I think you might find the results interesting by pairing differently smoothed BOPs together.
Of course, you don't have to use both. In the case of the default settings you might look at the EMA-BOP crossing the JMA-BOP as an opportunity to look into exiting or entering trades.

Candle coloring is, as usual, included. I'd say I kind of overdid it here, but that seems to be my style. I just couldn't deal with the fact that with the indicator set to cumulative modes there is no zero line, therefor the color of the indicator plot and the candle coloring would not match the color swatches for bullish/bearish colors. So, there are selections for cumulative indicator/candle colors, and standard indicator/candle colors. Donchian Channels obviously doesn't matter because the colors of things are based on the channel only.

I've added Donchian channel bands (which I've begun adding to many of my indicators), and all necessary alerts as well.
The Donchian Channels can be a really effective tool for entering and exiting trades. I haven't mentioned it in my other indicators that have it, so I will here:
The outermost edge of the band is that which references the indicator for where it is plotted, and the inner channel is sort of dragged along, creating the band
It's a simple mathematical calculation that TradingView actually provided themselves in their manual for pinescript.
When the BOP (or any other indicator using this) enters the band and then exits that could be an indication that price may be reversing, this the bands themselves act, or rather, show a current area of support/resistance for the BOP plot.
One thing that I did with it that they did not, is give the user the ability to change the width of the band. It can only go so narrow, obviously, but anywhere from three (quite wide) to eight is probably sufficient.

I've also provided the option of plotting the BOP as a cumulative line (like OBV), making it no longer an indicator which oscillates around a central pivot.
Because the balance of power is plotted as an accumulation, you may actually want to set the lookback to 1 (it works because it's not an oscillator then).
If you wish to smooth the noise, I suspect a low number would be acceptable here, but it's not necessary.

Oh, and lastly (almost forgot, as this was a late addition), I've added options for the BOPs calculated with volume as well. Gives a different bit of a perspective on the market, versus the traditional version which does not include volume. Screenshots below.

The above image is the balance of power calculated with volume. You can see the obvious difference versus the traditional indicator, where price is in a downtrend and you'd want to sell the orange.

Cumulative version. Looks a lot like OBV.

Cumulative version with volume.
Информация о релизе:
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.
Информация о релизе:
added auto-plotting divergences

Image above shows the Balance of Power (top) versus the Cumulative Balance of Power. By default hidden divergences are not on (yellow and fuchsia lines), but I thought I'd post this image comparing the two types of BoPs with all divergences ticked.
Информация о релизе:
added UMA as a way of smoothing the BOP.
added alerts for divergences
Информация о релизе:
- updated to pinescript version 5
- changed some wording
- added T3, RMA, and VWMA moving averages
- added some tooltips (info at certain indicator inputs)
Информация о релизе:
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)

Скрипт с открытым кодом

В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения. Вы можете добавить этот скрипт в избранное и использовать его на графике.

Отказ от ответственности

Все виды контента, которые вы можете увидеть на TradingView, не являются финансовыми, инвестиционными, торговыми или любыми другими рекомендациями. Мы не предоставляем советы по покупке и продаже активов. Подробнее — в Условиях использования TradingView.

Хотите использовать этот скрипт на графике?