コード例 #1
0
 public Indicator.zMovingAverageBand zMovingAverageBand(double bandArg, int bandSmoothArg, RWT_MA.MAType bandSmoothType, RWT_Bands.BandType bandType, int lengthOfBand, int smoothArg, RWT_MA.MAType smoothType)
 {
     return(_indicator.zMovingAverageBand(Input, bandArg, bandSmoothArg, bandSmoothType, bandType, lengthOfBand, smoothArg, smoothType));
 }
コード例 #2
0
        /// <summary>
        /// a band around an MA
        /// </summary>
        /// <returns></returns>
        public Indicator.zMovingAverageBand zMovingAverageBand(Data.IDataSeries input, double bandArg, int bandSmoothArg, RWT_MA.MAType bandSmoothType, RWT_Bands.BandType bandType, int lengthOfBand, int smoothArg, RWT_MA.MAType smoothType)
        {
            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.zMovingAverageBand(input, bandArg, bandSmoothArg, bandSmoothType, bandType, lengthOfBand, smoothArg, smoothType));
        }
コード例 #3
0
        /// <summary>
        /// a band around an MA
        /// </summary>
        /// <returns></returns>
        public zMovingAverageBand zMovingAverageBand(Data.IDataSeries input, double bandArg, int bandSmoothArg, RWT_MA.MAType bandSmoothType, RWT_Bands.BandType bandType, int lengthOfBand, int smoothArg, RWT_MA.MAType smoothType)
        {
            if (cachezMovingAverageBand != null)
            {
                for (int idx = 0; idx < cachezMovingAverageBand.Length; idx++)
                {
                    if (Math.Abs(cachezMovingAverageBand[idx].BandArg - bandArg) <= double.Epsilon && cachezMovingAverageBand[idx].BandSmoothArg == bandSmoothArg && cachezMovingAverageBand[idx].BandSmoothType == bandSmoothType && cachezMovingAverageBand[idx].BandType == bandType && cachezMovingAverageBand[idx].LengthOfBand == lengthOfBand && cachezMovingAverageBand[idx].SmoothArg == smoothArg && cachezMovingAverageBand[idx].SmoothType == smoothType && cachezMovingAverageBand[idx].EqualsInput(input))
                    {
                        return(cachezMovingAverageBand[idx]);
                    }
                }
            }

            lock (checkzMovingAverageBand)
            {
                checkzMovingAverageBand.BandArg = bandArg;
                bandArg = checkzMovingAverageBand.BandArg;
                checkzMovingAverageBand.BandSmoothArg = bandSmoothArg;
                bandSmoothArg = checkzMovingAverageBand.BandSmoothArg;
                checkzMovingAverageBand.BandSmoothType = bandSmoothType;
                bandSmoothType = checkzMovingAverageBand.BandSmoothType;
                checkzMovingAverageBand.BandType = bandType;
                bandType = checkzMovingAverageBand.BandType;
                checkzMovingAverageBand.LengthOfBand = lengthOfBand;
                lengthOfBand = checkzMovingAverageBand.LengthOfBand;
                checkzMovingAverageBand.SmoothArg = smoothArg;
                smoothArg = checkzMovingAverageBand.SmoothArg;
                checkzMovingAverageBand.SmoothType = smoothType;
                smoothType = checkzMovingAverageBand.SmoothType;

                if (cachezMovingAverageBand != null)
                {
                    for (int idx = 0; idx < cachezMovingAverageBand.Length; idx++)
                    {
                        if (Math.Abs(cachezMovingAverageBand[idx].BandArg - bandArg) <= double.Epsilon && cachezMovingAverageBand[idx].BandSmoothArg == bandSmoothArg && cachezMovingAverageBand[idx].BandSmoothType == bandSmoothType && cachezMovingAverageBand[idx].BandType == bandType && cachezMovingAverageBand[idx].LengthOfBand == lengthOfBand && cachezMovingAverageBand[idx].SmoothArg == smoothArg && cachezMovingAverageBand[idx].SmoothType == smoothType && cachezMovingAverageBand[idx].EqualsInput(input))
                        {
                            return(cachezMovingAverageBand[idx]);
                        }
                    }
                }

                zMovingAverageBand indicator = new zMovingAverageBand();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input          = input;
                indicator.BandArg        = bandArg;
                indicator.BandSmoothArg  = bandSmoothArg;
                indicator.BandSmoothType = bandSmoothType;
                indicator.BandType       = bandType;
                indicator.LengthOfBand   = lengthOfBand;
                indicator.SmoothArg      = smoothArg;
                indicator.SmoothType     = smoothType;
                Indicators.Add(indicator);
                indicator.SetUp();

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