- ago
I'm not sure how to add this to the Wishlist, so I'd appreciate if it could be added. I assume this is very simple, but I don't know how to C# code. It's pretty standard in most trading platforms, so it would be really nice to be added. I ask because I have strategies that apply other indicators to the BBW, so it would be very handy to have as a standard indicator.

Formula is very simple, based on Bollinger Bands (with user inputs being Bollinger Period and Standard Deviations)

{(BollingerUpper - BollingerLower) / BollingerMid} x 100

Thank you!!!
0
576
Solved
13 Replies

Reply

Bookmark

Sort
- ago
#1
I saw BBWidth in standard lib:
CODE:
BBWidth(TimeSeries source, int period, double stdDevs);
1
Best Answer
- ago
#2
Boy, I don't know how I missed that. Now I've got it! Thank you!
0
- ago
#3
Apparently, Post #1 is right. I ran a comparison below. Notice how the blue (BBWidth) and orange (Built BBWidth) plots superimpose very nicely below within 2.5 decimal places. You taught me something.


CODE:
using WealthLab.Backtest; using WealthLab.Core; using WealthLab.Indicators; namespace WealthScript3 {    public class MyStrategy : UserStrategyBase    {       public override void Initialize(BarHistory bars)       {          IndicatorBase bbWidth = BBWidth.Series(bars.Close, 15, 2.0);                    IndicatorBase bbLower = new BBLower(bars.Close, 15, 2.0);          IndicatorBase bbUpper = new BBUpper(bars.Close, 15, 2.0);          TimeSeries bbWidth2 = (bbUpper - bbLower) / new WilderMA(bars.Close, 15) * 100.0;          PlotTimeSeriesLine(bbWidth2,"Built BBWidth",bbWidth.PaneTag,WLColor.Orange,6);                    PlotIndicator(bbWidth,WLColor.Blue);       }       public override void Execute(BarHistory bars, int idx) { }    } }
Just understand that any indicator based on the standard deviation is going to blowup if it hits an outlier. Basing the width on a "robust" indicator such as the median, percentile rank, or even ATR would be much safer.

If you're interested, WL has KeltnerLower and KeltnerUpper bands available that are based on an ATR multiple. You can substitute those into the above code to compute a KeltnerBandWidth if you want to try that out. It should be more robust in the presence of outliers.

Just understand the KeltnerLower and KeltnerUpper bands employ the SMA (rather than the WilderMA) as their center line follower. I personally like the WilderMA a little better. If you prefer to employ the WilderMA as your center line, then WL has ATRBandLower and ATRBandUpper indicators that let you define your own center line (such as the WilderMA) you can use instead of KeltnerLower and KeltnerUpper.
1
- ago
#4
It occurred to me that anyone interest in the BBWidth indicator would also be interested in John Carter's "squeeze strategy", which employs this approach. Check it out. And the link below has a working WL8 example of it.
https://www.wealth-lab.com/Discussion/Bollinger-Band-fans-Squeeze-strategy-10298

John also has a website and YouTube video describing his method.
0
- ago
#5
Results might be different if you have the pro version (aka the latest) which gives you three different levels to look at.

I had it coded up in C# as a custom indicator but there need to be a couple of derivations to be able to use all the outputs JC uses in the strategy. I have NOT run down that road.

0
- ago
#6
QUOTE:
Results might be different if you have the pro version (aka the latest) [of the Squeeze Strategy], which gives you three different levels to look at.

Can you cite a reference for the pro version? I might try coding it (or maybe someone of the WL development team can). And what are the levels about?

One problem with the squeeze strategy is that the setup doesn't occur that frequently. But when it does, there is opportunity to make money if you guess the post-squeeze direction correctly.
0
Glitch8
 ( 10.85% )
- ago
#7
If anyone has the rules i could code it up for WL.
1
- ago
#8
I have everything, Will send it to you Glitch.
1
- ago
#9
One of the strategies I uses several of the ruled from John Carter's TTM Squeeze. Would be nice to have coded with several user inputs for customization :)
0
Cone8
 ( 24.31% )
- ago
#10
It's not in indicator form, but this is it, right?
https://www.wealth-lab.com/Discussion/Add-Squeeze-Vortex-indicator-9859#post5
0
- ago
#11
@cone I sent all of the John Carter indicator documentation and code to @glitch yesterday.

I am 100% good if you share the dev work you did for me with him, or put differently I am 100% of if we take this work add to it so it can be released to the general community as indicators.

My one wish would be that we code all of the indicators and expose all of the results needed.
0
Cone8
 ( 24.31% )
- ago
#12
Thanks, but that TTM Squeeze code was printed long before you found WealthLab.
You had another squeeze indicator that was similar, but it wasn't the TTM Squeeze. Anyway, it's all up to Glitch now.
0
- ago
#13
You're 100% correct -- there has not been an update to this code in years, what I have is current from when Eric (not me) wrote it.
0

Reply

Bookmark

Sort