public Indicator.BollingerBandwidth BollingerBandwidth(BollingerBandwidth_MATypes averageType, int bulgeLength, double numStdDev, int period, int squeezeLength) { return(_indicator.BollingerBandwidth(Input, averageType, bulgeLength, numStdDev, period, squeezeLength)); }
/// <summary> /// The Bollinger Bandwidth study is a technical indicator based upon Bollinger Bands® study, expressing the distance between upper and lower bands as percentage of the middle band value (SMA/EMA around which the bands are plotted). The main plot is accompanied with two additional ones: Bulge and Squeeze. Bulge plot displays the highest bandwidth value reached on the specified period, and, similarly, Squeeze plot shows the lowest bandwidth value. /// </summary> /// <returns></returns> public Indicator.BollingerBandwidth BollingerBandwidth(Data.IDataSeries input, BollingerBandwidth_MATypes averageType, int bulgeLength, double numStdDev, int period, int squeezeLength) { if (InInitialize && input == null) { throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method"); } return(_indicator.BollingerBandwidth(input, averageType, bulgeLength, numStdDev, period, squeezeLength)); }
/// <summary> /// The Bollinger Bandwidth study is a technical indicator based upon Bollinger Bands® study, expressing the distance between upper and lower bands as percentage of the middle band value (SMA/EMA around which the bands are plotted). The main plot is accompanied with two additional ones: Bulge and Squeeze. Bulge plot displays the highest bandwidth value reached on the specified period, and, similarly, Squeeze plot shows the lowest bandwidth value. /// </summary> /// <returns></returns> public BollingerBandwidth BollingerBandwidth(Data.IDataSeries input, BollingerBandwidth_MATypes averageType, int bulgeLength, double numStdDev, int period, int squeezeLength) { if (cacheBollingerBandwidth != null) { for (int idx = 0; idx < cacheBollingerBandwidth.Length; idx++) { if (cacheBollingerBandwidth[idx].AverageType == averageType && cacheBollingerBandwidth[idx].BulgeLength == bulgeLength && Math.Abs(cacheBollingerBandwidth[idx].NumStdDev - numStdDev) <= double.Epsilon && cacheBollingerBandwidth[idx].Period == period && cacheBollingerBandwidth[idx].SqueezeLength == squeezeLength && cacheBollingerBandwidth[idx].EqualsInput(input)) { return(cacheBollingerBandwidth[idx]); } } } lock (checkBollingerBandwidth) { checkBollingerBandwidth.AverageType = averageType; averageType = checkBollingerBandwidth.AverageType; checkBollingerBandwidth.BulgeLength = bulgeLength; bulgeLength = checkBollingerBandwidth.BulgeLength; checkBollingerBandwidth.NumStdDev = numStdDev; numStdDev = checkBollingerBandwidth.NumStdDev; checkBollingerBandwidth.Period = period; period = checkBollingerBandwidth.Period; checkBollingerBandwidth.SqueezeLength = squeezeLength; squeezeLength = checkBollingerBandwidth.SqueezeLength; if (cacheBollingerBandwidth != null) { for (int idx = 0; idx < cacheBollingerBandwidth.Length; idx++) { if (cacheBollingerBandwidth[idx].AverageType == averageType && cacheBollingerBandwidth[idx].BulgeLength == bulgeLength && Math.Abs(cacheBollingerBandwidth[idx].NumStdDev - numStdDev) <= double.Epsilon && cacheBollingerBandwidth[idx].Period == period && cacheBollingerBandwidth[idx].SqueezeLength == squeezeLength && cacheBollingerBandwidth[idx].EqualsInput(input)) { return(cacheBollingerBandwidth[idx]); } } } BollingerBandwidth indicator = new BollingerBandwidth(); indicator.BarsRequired = BarsRequired; indicator.CalculateOnBarClose = CalculateOnBarClose; #if NT7 indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256; indicator.MaximumBarsLookBack = MaximumBarsLookBack; #endif indicator.Input = input; indicator.AverageType = averageType; indicator.BulgeLength = bulgeLength; indicator.NumStdDev = numStdDev; indicator.Period = period; indicator.SqueezeLength = squeezeLength; Indicators.Add(indicator); indicator.SetUp(); BollingerBandwidth[] tmp = new BollingerBandwidth[cacheBollingerBandwidth == null ? 1 : cacheBollingerBandwidth.Length + 1]; if (cacheBollingerBandwidth != null) { cacheBollingerBandwidth.CopyTo(tmp, 0); } tmp[tmp.Length - 1] = indicator; cacheBollingerBandwidth = tmp; return(indicator); } }