Nicolas

Bollinger Range Bound

Category: Indicators By: Nicolas Created: March 3, 2016, 12:52 PM
March 3, 2016, 12:52 PM
Indicators
2 Comments
Bollinger Range Bound

Here is a smart idea for an indicator to detect range, as it compares 2 bollinger bandwidth spread as an hint for current price contraction.

When the oscillator is set to 1, price is ranging and “NoTrade” would be initiated.

 

a = BollingerUp[40](close)
b = BollingerDown[40](close)
B1Range = a - b

c = BollingerUp[20](close)
d = BollingerDown[20](close)
B2Range = c - d

if B2Range < (B1Range/2) then
  NoTrade = 1
else
  NoTrade = 0
endif

return NoTrade AS "No Trade"

 

Download
Filename: Bollinger-Range-Bound.itf
Downloads: 219
Nicolas
Nicolas Legend
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

robertogozzi
8 years ago
#

I modified it to make parameters customizable and to Draw a Grey candlestick when a range is detected (sorry for the code, but the "Add PRT code" button didn't work): // Bollinger Band range setection // DEFPARAM CalculateOnLastBars = 1000 // BB1 = 40 // BB2 = 20 // RangeDivisor = 2.0 // a = BollingerUp[BB1](close) b = BollingerDown[BB1](close) B1Range = a - b c = BollingerUp[BB2](close) d = BollingerDown[BB2](close) B2Range = c - d if B2Range < (B1Range/RangeDivisor) then DRAWCANDLE(Open,High,Low,Close) COLOURED(230,230,250,255) bordercolor(0,255,255,50) //Cyan border //NoTrade = 1 else //NoTrade = 0 endif return // NoTrade AS "No Trade"

trabucaire
9 years ago
#

Hello, what does it mean the 20 and 40 number on this code ? Thank you !

ProRealCode ProRealCode
Loading...