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!!!
Formula is very simple, based on Bollinger Bands (with user inputs being Bollinger Period and Standard Deviations)
{(BollingerUpper - BollingerLower) / BollingerMid} x 100
Thank you!!!
Rename
I saw BBWidth in standard lib:
CODE:
BBWidth(TimeSeries source, int period, double stdDevs);
Boy, I don't know how I missed that. Now I've got it! Thank you!
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.

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.
CODE: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.
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) { } } }
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.
Your Response
Post
Edit Post
Login is required