Exemple #1
0
 public Indicator.anaBollingerUniversalX anaBollingerUniversalX(double numStdDev, int period, anaBollingerMATypeX selectedMATypeX, bool showChannels, bool showMidband, bool smoothed, int stdDevPeriod, int threshold, bool useCentralSlope)
 {
     return(_indicator.anaBollingerUniversalX(Input, numStdDev, period, selectedMATypeX, showChannels, showMidband, smoothed, stdDevPeriod, threshold, useCentralSlope));
 }
Exemple #2
0
        /// <summary>
        /// Bollinger Bands are plotted at standard deviation levels above and below a moving average. Since standard deviation is a measure of volatility, the bands are self-adjusting: widening during volatile markets and contracting during calmer periods.
        /// </summary>
        /// <returns></returns>
        public Indicator.anaBollingerUniversalX anaBollingerUniversalX(Data.IDataSeries input, double numStdDev, int period, anaBollingerMATypeX selectedMATypeX, bool showChannels, bool showMidband, bool smoothed, int stdDevPeriod, int threshold, bool useCentralSlope)
        {
            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.anaBollingerUniversalX(input, numStdDev, period, selectedMATypeX, showChannels, showMidband, smoothed, stdDevPeriod, threshold, useCentralSlope));
        }
Exemple #3
0
        /// <summary>
        /// Bollinger Bands are plotted at standard deviation levels above and below a moving average. Since standard deviation is a measure of volatility, the bands are self-adjusting: widening during volatile markets and contracting during calmer periods.
        /// </summary>
        /// <returns></returns>
        public anaBollingerUniversalX anaBollingerUniversalX(Data.IDataSeries input, double numStdDev, int period, anaBollingerMATypeX selectedMATypeX, bool showChannels, bool showMidband, bool smoothed, int stdDevPeriod, int threshold, bool useCentralSlope)
        {
            if (cacheanaBollingerUniversalX != null)
            {
                for (int idx = 0; idx < cacheanaBollingerUniversalX.Length; idx++)
                {
                    if (Math.Abs(cacheanaBollingerUniversalX[idx].NumStdDev - numStdDev) <= double.Epsilon && cacheanaBollingerUniversalX[idx].Period == period && cacheanaBollingerUniversalX[idx].SelectedMATypeX == selectedMATypeX && cacheanaBollingerUniversalX[idx].ShowChannels == showChannels && cacheanaBollingerUniversalX[idx].ShowMidband == showMidband && cacheanaBollingerUniversalX[idx].Smoothed == smoothed && cacheanaBollingerUniversalX[idx].StdDevPeriod == stdDevPeriod && cacheanaBollingerUniversalX[idx].Threshold == threshold && cacheanaBollingerUniversalX[idx].UseCentralSlope == useCentralSlope && cacheanaBollingerUniversalX[idx].EqualsInput(input))
                    {
                        return(cacheanaBollingerUniversalX[idx]);
                    }
                }
            }

            lock (checkanaBollingerUniversalX)
            {
                checkanaBollingerUniversalX.NumStdDev = numStdDev;
                numStdDev = checkanaBollingerUniversalX.NumStdDev;
                checkanaBollingerUniversalX.Period = period;
                period = checkanaBollingerUniversalX.Period;
                checkanaBollingerUniversalX.SelectedMATypeX = selectedMATypeX;
                selectedMATypeX = checkanaBollingerUniversalX.SelectedMATypeX;
                checkanaBollingerUniversalX.ShowChannels = showChannels;
                showChannels = checkanaBollingerUniversalX.ShowChannels;
                checkanaBollingerUniversalX.ShowMidband = showMidband;
                showMidband = checkanaBollingerUniversalX.ShowMidband;
                checkanaBollingerUniversalX.Smoothed = smoothed;
                smoothed = checkanaBollingerUniversalX.Smoothed;
                checkanaBollingerUniversalX.StdDevPeriod = stdDevPeriod;
                stdDevPeriod = checkanaBollingerUniversalX.StdDevPeriod;
                checkanaBollingerUniversalX.Threshold = threshold;
                threshold = checkanaBollingerUniversalX.Threshold;
                checkanaBollingerUniversalX.UseCentralSlope = useCentralSlope;
                useCentralSlope = checkanaBollingerUniversalX.UseCentralSlope;

                if (cacheanaBollingerUniversalX != null)
                {
                    for (int idx = 0; idx < cacheanaBollingerUniversalX.Length; idx++)
                    {
                        if (Math.Abs(cacheanaBollingerUniversalX[idx].NumStdDev - numStdDev) <= double.Epsilon && cacheanaBollingerUniversalX[idx].Period == period && cacheanaBollingerUniversalX[idx].SelectedMATypeX == selectedMATypeX && cacheanaBollingerUniversalX[idx].ShowChannels == showChannels && cacheanaBollingerUniversalX[idx].ShowMidband == showMidband && cacheanaBollingerUniversalX[idx].Smoothed == smoothed && cacheanaBollingerUniversalX[idx].StdDevPeriod == stdDevPeriod && cacheanaBollingerUniversalX[idx].Threshold == threshold && cacheanaBollingerUniversalX[idx].UseCentralSlope == useCentralSlope && cacheanaBollingerUniversalX[idx].EqualsInput(input))
                        {
                            return(cacheanaBollingerUniversalX[idx]);
                        }
                    }
                }

                anaBollingerUniversalX indicator = new anaBollingerUniversalX();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input           = input;
                indicator.NumStdDev       = numStdDev;
                indicator.Period          = period;
                indicator.SelectedMATypeX = selectedMATypeX;
                indicator.ShowChannels    = showChannels;
                indicator.ShowMidband     = showMidband;
                indicator.Smoothed        = smoothed;
                indicator.StdDevPeriod    = stdDevPeriod;
                indicator.Threshold       = threshold;
                indicator.UseCentralSlope = useCentralSlope;
                Indicators.Add(indicator);
                indicator.SetUp();

                anaBollingerUniversalX[] tmp = new anaBollingerUniversalX[cacheanaBollingerUniversalX == null ? 1 : cacheanaBollingerUniversalX.Length + 1];
                if (cacheanaBollingerUniversalX != null)
                {
                    cacheanaBollingerUniversalX.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]         = indicator;
                cacheanaBollingerUniversalX = tmp;
                return(indicator);
            }
        }