TradingView
sclark39
Feb 21, 2018 1:11 AM

Bollinger Band Lathe 

Ether / United States DollarCoinbase

Description

Bollinger Bands shown with a horizontal basis, to make it easier to see how volatility is changing and identify squeeze opportunities.

There is a histogram (purple) which shows how the basis is changing, and a price line (yellow) showing the location of the price within the bollinger bands.

It is tuned to 2 STDEV, but shows the area within 1 STDEV a different color to help visualize when the price is near the extremes of the bands.

By default this uses an exponential moving average to calculate the bollinger basis, but this can be changed in the options.

Release Notes

Made it so the inner bollinger envelope multiple can be modified, and added an optional alternate calculation for stdev which uses the two-pass algorithm which I believe is more accurate than the builtin. Default options are to enable the custom stdev implementation and use EMA for the bollinger basis.

Release Notes

Updating to apply a scale factor while calculating the bollinger mean and deviation to increase precision with tiny cryptocurrency exchange rates.
Comments
Bweyrick
I am trying to accomplish something similar for a different purpose where all the bands are fixed horizontally at 100 , 0 , and -100 any idea how to code this ?
sclark39
p.s. the other indicator in the preview is this one: tradingview.com/script/SX9hYlN0-Bollinger-Bands-2-MA-Exponential/
phohat
Very useful script !!! Thank you very much !!!
sclark39
@phohat, Glad you like it! If you have any requests let me know. :)
sclark39
One extra note about this: if you use EMA to calculate the Bollinger Basis, technically the STDEV is supposed to use EMA as well. I've not been able to figure out how Pine calculates its STDEV yet though (it's not the same as excel), so I'm not sure it is too important. I'm working on reverse engineering it, though.
sclark39
The update to this indicator has fixed this.
Acel
Hey, nice approach! I was thinking of making a few modifications, is there place where i can learn more about this scrypt language?
sclark39
@Acel, Yeah, I'd love to see them!

Function reference: tradingview.com/study-script-reference/
And a wiki with examples: tradingview.com/wiki/Pine_Script_Tutorial

The one thing that tripped me up for a bit is that when you hit version 10 of a script everything breaks and you need to hit Save As... remove from your chart, and add back the new V1.
Acel
@sclark39, cool, thanks for the guidance.

I have noticed that too - breaking on v10 - when i was messing with VFI, very annoying when you need to test the changes. Hopefully i will have something by the weekend.
More