Select Page

# Reply To: Where does the last bar close within the bollinger bands?

Optuma Forums Optuma Scripting Where does the last bar close within the bollinger bands? Reply To: Where does the last bar close within the bollinger bands?

#51907

Thanks Matthew – that looks good..

I do have a few odd results though so I’m trying to figure out where the problem is.

I have applied bollinger bands to a CADCHF daily chart. (bands are 21 period, geometric, applied to close)

I have also applied the following script to my chart using showview:

V1 = BB(BARS=21, STYLE=Exponential).UpperLine ;
V2 = BB(BARS=21, STYLE=Exponential).LowerLine ;

( (CLOSE() – V2) / (V1 -V2)) * 100

Image attached.

If you look at the bar of March 28, 2018, to the naked eye the close looks to be above 80% of the distance from the lower bollinger band to the upper bollinger band.

And doing the sums:

Upper band = 0.74223

Lower band = 0.72312

Close = 0.7402

Distance from lower to upper band = 0.74223-0.72312 = 0.01911

80% of this distance = 0.8 * 0.01911 = 0.015288

Add 80% of the distance from the lower bollinger band to the lower bollinger band = 0.7402 + 0.015288 = 0.738408

As the close (0.7402) is higher than 80% of the distance from the lower to the upper bollinger band (0.738408), the script should return a result of > 80. As you can see from the horizontal line set at 80, the script returns a result of < 80.

Hoping somebody can see what it is that I’m missing.

Regards
Steve