TradingView
LuxAlgo
Jun 20, 2022 1:59 PM

Bollinger Bands Breakout Oscillator [LuxAlgo] 

Bitcoin / U.S. dollarBitstamp

描述

The Bollinger Bands Breakout Oscillator is an oscillator returning two series quantifying the significance of breakouts between the price and the extremities of the Bollinger Bands indicator.

Settings

  • Length: Period of the Bollinger Bands indicator
  • Mult: Controls the width of the Bollinger Bands
  • Src: Input source of the indicator


Usage



Each series is calculated by summing the distance between price and a respective Bollinger Bands extremity in the case price is outside this extremity and divided by the sum of the absolute distance between price and a respective extremity. This sum is done over the most recent Length bars.

Bullish breakouts are represented by the green areas of the indicator, while bearish breakouts are represented by the red areas of the indicator.

The oscillator can determine the presence of an uptrend when the bullish area is superior to the bearish area, while a downtrend is indicated by a bearish area being superior to the bullish one. The significance of the breakout is determined by the amplitude of each area, with higher amplitudes indicating more significant breakouts or strong trends.

Using higher Mult values would naturally return wider bands, which would induce less frequent breakouts, this would be highlighted by the oscillator.



In the chart above we can see the oscillator using a multiplicative factor of 2.

版本注释

Minor changes.
评论
MoreCrazy
Awesome, optimized code
//------------------------------------------------------------------------------
//Calculation
//------------------------------------------------------------------------------
stdev = ta.stdev(src, length) * mult
ema = ta.ema(src, length)

upper = ema + stdev
lower = ema - stdev

bullish = math.sum(math.max(src - upper, 0), length)
bearish = math.sum(math.max(lower - src, 0), length)
bull_den = math.sum(math.abs(src - upper), length)
bear_den = math.sum(math.abs(lower - src), length)

bull = bullish/bull_den*100
bear = bearish/bear_den*100
tomatoemartini
Hey @MoreCrazy what does this optimization introduce, benefits?
tomatoemartini
Great work @LuxAlgo - One question, there are green/red clouds with red outlines to them, what does it mean when there is a cloud with no outline ?
Within the settings this is turned on/off under the name/variable 'Plot'
thank you
Pratik_4Clover
Thanks!
allanster
Looks very nice and always appreciate how you present your ideas, thank you for sharing and keep up the great work!
LuxAlgo
@allanster, Thank you sir!
ricjason
Hey, love this indicator!. Anyway to add Alert on bar close when Plot color (red or Green) first appears(first bar of color sequence)? How do I go about that? not crossover
更多