+ Balance of Power

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)

本著真正的TradingView精神,該腳本的作者將其開源發布,以便交易者可以理解和驗證它。為作者喝彩吧!您可以免費使用它,但在出版物中重複使用此代碼受網站規則的約束。 您可以收藏它以在圖表上使用。