コード例 #1
0
ファイル: zMaMacd.cs プロジェクト: Sandy4321/NinjaIndicators
        /// <summary>
        /// MACD of independent MA types
        /// </summary>
        /// <returns></returns>
        public Indicator.zMaMacd zMaMacd(Data.IDataSeries input, RWT_MA.MAType aType1, RWT_MA.MAType aType2, double len1, double len2)
        {
            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.zMaMacd(input, aType1, aType2, len1, len2);
        }
コード例 #2
0
        /// <summary>
        /// better adx
        /// </summary>
        /// <returns></returns>
        public Indicator.ZADX ZADX(Data.IDataSeries input, int aDXLength, RWT_MA.MAType aDXType, double barSmoothArg, RWT_HA.SecondaryOHLC barSmoothType, RWT_HA.PrimaryOHLC barsType, int dMLength, RWT_MA.MAType dMType)
        {
            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.ZADX(input, aDXLength, aDXType, barSmoothArg, barSmoothType, barsType, dMLength, dMType));
        }
コード例 #3
0
        /// <summary>
        /// Guppy Stuff
        /// </summary>
        /// <returns></returns>
        public Indicator.zGuppyMA zGuppyMA(Data.IDataSeries input, RWT_MA.MAType aType, double fastBegin, double fastEnd, double slowBegin, double slowEnd)
        {
            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.zGuppyMA(input, aType, fastBegin, fastEnd, slowBegin, slowEnd));
        }
コード例 #4
0
        /// <summary>
        /// adx vma
        /// </summary>
        /// <returns></returns>
        public Indicator.zADXVMA zADXVMA(Data.IDataSeries input, int aDXLen, RWT_MA.MAType aDXType, RWT_MA.MAType dMType, double fastSpeed, double slowestSpeed, bool useJustInputs, int windowLength)
        {
            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.zADXVMA(input, aDXLen, aDXType, dMType, fastSpeed, slowestSpeed, useJustInputs, windowLength));
        }
コード例 #5
0
        /// <summary>
        /// A moving average
        /// </summary>
        /// <returns></returns>
        public zMovingAverage zMovingAverage(Data.IDataSeries input, double length, RWT_MA.MAType type)
        {
            if (cachezMovingAverage != null)
            {
                for (int idx = 0; idx < cachezMovingAverage.Length; idx++)
                {
                    if (Math.Abs(cachezMovingAverage[idx].Length - length) <= double.Epsilon && cachezMovingAverage[idx].Type == type && cachezMovingAverage[idx].EqualsInput(input))
                    {
                        return(cachezMovingAverage[idx]);
                    }
                }
            }

            lock (checkzMovingAverage)
            {
                checkzMovingAverage.Length = length;
                length = checkzMovingAverage.Length;
                checkzMovingAverage.Type = type;
                type = checkzMovingAverage.Type;

                if (cachezMovingAverage != null)
                {
                    for (int idx = 0; idx < cachezMovingAverage.Length; idx++)
                    {
                        if (Math.Abs(cachezMovingAverage[idx].Length - length) <= double.Epsilon && cachezMovingAverage[idx].Type == type && cachezMovingAverage[idx].EqualsInput(input))
                        {
                            return(cachezMovingAverage[idx]);
                        }
                    }
                }

                zMovingAverage indicator = new zMovingAverage();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input  = input;
                indicator.Length = length;
                indicator.Type   = type;
                Indicators.Add(indicator);
                indicator.SetUp();

                zMovingAverage[] tmp = new zMovingAverage[cachezMovingAverage == null ? 1 : cachezMovingAverage.Length + 1];
                if (cachezMovingAverage != null)
                {
                    cachezMovingAverage.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cachezMovingAverage = tmp;
                return(indicator);
            }
        }
コード例 #6
0
        /// <summary>
        /// hull-flavor ma
        /// </summary>
        /// <returns></returns>
        public zHullStyleMA zHullStyleMA(Data.IDataSeries input, int length, RWT_MA.MAType type)
        {
            if (cachezHullStyleMA != null)
            {
                for (int idx = 0; idx < cachezHullStyleMA.Length; idx++)
                {
                    if (cachezHullStyleMA[idx].Length == length && cachezHullStyleMA[idx].Type == type && cachezHullStyleMA[idx].EqualsInput(input))
                    {
                        return(cachezHullStyleMA[idx]);
                    }
                }
            }

            lock (checkzHullStyleMA)
            {
                checkzHullStyleMA.Length = length;
                length = checkzHullStyleMA.Length;
                checkzHullStyleMA.Type = type;
                type = checkzHullStyleMA.Type;

                if (cachezHullStyleMA != null)
                {
                    for (int idx = 0; idx < cachezHullStyleMA.Length; idx++)
                    {
                        if (cachezHullStyleMA[idx].Length == length && cachezHullStyleMA[idx].Type == type && cachezHullStyleMA[idx].EqualsInput(input))
                        {
                            return(cachezHullStyleMA[idx]);
                        }
                    }
                }

                zHullStyleMA indicator = new zHullStyleMA();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input  = input;
                indicator.Length = length;
                indicator.Type   = type;
                Indicators.Add(indicator);
                indicator.SetUp();

                zHullStyleMA[] tmp = new zHullStyleMA[cachezHullStyleMA == null ? 1 : cachezHullStyleMA.Length + 1];
                if (cachezHullStyleMA != null)
                {
                    cachezHullStyleMA.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cachezHullStyleMA   = tmp;
                return(indicator);
            }
        }
コード例 #7
0
 public SmoothedBars(OHLC parent, RWT_MA.MAType type, double len)
 {
     input = parent;
     oma   = RWT_MA.MAFactory.create(type, len);
     hma   = RWT_MA.MAFactory.create(type, len);
     lma   = RWT_MA.MAFactory.create(type, len);
     cma   = RWT_MA.MAFactory.create(type, len);
     oma.init(input.Open);
     hma.init(input.High);
     lma.init(input.Low);
     cma.init(input.Close);
     opens  = input.Open;
     highs  = input.High;
     lows   = input.Low;
     closes = input.Close;
 }
コード例 #8
0
ファイル: zMaMacd.cs プロジェクト: Sandy4321/NinjaIndicators
        /// <summary>
        /// MACD of independent MA types
        /// </summary>
        /// <returns></returns>
        public zMaMacd zMaMacd(Data.IDataSeries input, RWT_MA.MAType aType1, RWT_MA.MAType aType2, double len1, double len2)
        {
            if (cachezMaMacd != null)
                for (int idx = 0; idx < cachezMaMacd.Length; idx++)
                    if (cachezMaMacd[idx].AType1 == aType1 && cachezMaMacd[idx].AType2 == aType2 && Math.Abs(cachezMaMacd[idx].Len1 - len1) <= double.Epsilon && Math.Abs(cachezMaMacd[idx].Len2 - len2) <= double.Epsilon && cachezMaMacd[idx].EqualsInput(input))
                        return cachezMaMacd[idx];

            lock (checkzMaMacd)
            {
                checkzMaMacd.AType1 = aType1;
                aType1 = checkzMaMacd.AType1;
                checkzMaMacd.AType2 = aType2;
                aType2 = checkzMaMacd.AType2;
                checkzMaMacd.Len1 = len1;
                len1 = checkzMaMacd.Len1;
                checkzMaMacd.Len2 = len2;
                len2 = checkzMaMacd.Len2;

                if (cachezMaMacd != null)
                    for (int idx = 0; idx < cachezMaMacd.Length; idx++)
                        if (cachezMaMacd[idx].AType1 == aType1 && cachezMaMacd[idx].AType2 == aType2 && Math.Abs(cachezMaMacd[idx].Len1 - len1) <= double.Epsilon && Math.Abs(cachezMaMacd[idx].Len2 - len2) <= double.Epsilon && cachezMaMacd[idx].EqualsInput(input))
                            return cachezMaMacd[idx];

                zMaMacd indicator = new zMaMacd();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.AType1 = aType1;
                indicator.AType2 = aType2;
                indicator.Len1 = len1;
                indicator.Len2 = len2;
                Indicators.Add(indicator);
                indicator.SetUp();

                zMaMacd[] tmp = new zMaMacd[cachezMaMacd == null ? 1 : cachezMaMacd.Length + 1];
                if (cachezMaMacd != null)
                    cachezMaMacd.CopyTo(tmp, 0);
                tmp[tmp.Length - 1] = indicator;
                cachezMaMacd = tmp;
                return indicator;
            }
        }
コード例 #9
0
ファイル: zMaMacd.cs プロジェクト: Sandy4321/NinjaIndicators
 public Indicator.zMaMacd zMaMacd(RWT_MA.MAType aType1, RWT_MA.MAType aType2, double len1, double len2)
 {
     return _indicator.zMaMacd(Input, aType1, aType2, len1, len2);
 }
コード例 #10
0
 public Indicator.zMovingAverage zMovingAverage(double length, RWT_MA.MAType type)
 {
     return(_indicator.zMovingAverage(Input, length, type));
 }
コード例 #11
0
 /// <summary>
 /// hull-flavor ma
 /// </summary>
 /// <returns></returns>
 public zHullStyleMA zHullStyleMA(int length, RWT_MA.MAType type)
 {
     return(zHullStyleMA(Input, length, type));
 }
コード例 #12
0
 public Indicator.zPriceProxy2 zPriceProxy2(double filterArg, RWT_MA.MAType filterType, int lookback, RWT_HA.PrimaryOHLC primaryType, double smoothArg, RWT_HA.SecondaryOHLC smoothType, double tolerance)
 {
     return(_indicator.zPriceProxy2(Input, filterArg, filterType, lookback, primaryType, smoothArg, smoothType, tolerance));
 }
コード例 #13
0
 /// <summary>
 /// A moving average
 /// </summary>
 /// <returns></returns>
 public Indicator.zMovingAverage zMovingAverage(Data.IDataSeries input, double length, RWT_MA.MAType type)
 {
     return(_indicator.zMovingAverage(input, length, type));
 }
コード例 #14
0
        /// <summary>
        /// hull-flavor ma
        /// </summary>
        /// <returns></returns>
        public Indicator.zHullStyleMA zHullStyleMA(Data.IDataSeries input, int length, RWT_MA.MAType type)
        {
            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.zHullStyleMA(input, length, type));
        }
コード例 #15
0
 public Indicator.zADXVMA zADXVMA(int aDXLen, RWT_MA.MAType aDXType, RWT_MA.MAType dMType, double fastSpeed, double slowestSpeed, bool useJustInputs, int windowLength)
 {
     return(_indicator.zADXVMA(Input, aDXLen, aDXType, dMType, fastSpeed, slowestSpeed, useJustInputs, windowLength));
 }
コード例 #16
0
ファイル: zMaMacd.cs プロジェクト: Sandy4321/NinjaIndicators
 /// <summary>
 /// MACD of independent MA types
 /// </summary>
 /// <returns></returns>
 public Indicator.zMaMacd zMaMacd(Data.IDataSeries input, RWT_MA.MAType aType1, RWT_MA.MAType aType2, double len1, double len2)
 {
     return _indicator.zMaMacd(input, aType1, aType2, len1, len2);
 }
コード例 #17
0
 public Indicator.ZADX ZADX(int aDXLength, RWT_MA.MAType aDXType, double barSmoothArg, RWT_HA.SecondaryOHLC barSmoothType, RWT_HA.PrimaryOHLC barsType, int dMLength, RWT_MA.MAType dMType)
 {
     return(_indicator.ZADX(Input, aDXLength, aDXType, barSmoothArg, barSmoothType, barsType, dMLength, dMType));
 }
コード例 #18
0
 public Indicator.zGuppyMA zGuppyMA(RWT_MA.MAType aType, double fastBegin, double fastEnd, double slowBegin, double slowEnd)
 {
     return(_indicator.zGuppyMA(Input, aType, fastBegin, fastEnd, slowBegin, slowEnd));
 }
コード例 #19
0
        /// <summary>
        /// an average of swings
        /// </summary>
        /// <returns></returns>
        public Indicator.zSwingAverage zSwingAverage(Data.IDataSeries input, RWT_HA.PrimaryOHLC inputType, int mALength, RWT_MA.MAType mAType, int swingStrength)
        {
            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.zSwingAverage(input, inputType, mALength, mAType, swingStrength));
        }
コード例 #20
0
 /// <summary>
 /// Guppy Stuff
 /// </summary>
 /// <returns></returns>
 public Indicator.zGuppyMA zGuppyMA(Data.IDataSeries input, RWT_MA.MAType aType, double fastBegin, double fastEnd, double slowBegin, double slowEnd)
 {
     return(_indicator.zGuppyMA(input, aType, fastBegin, fastEnd, slowBegin, slowEnd));
 }
コード例 #21
0
        /// <summary>
        /// Guppy Stuff
        /// </summary>
        /// <returns></returns>
        public zGuppyMA zGuppyMA(Data.IDataSeries input, RWT_MA.MAType aType, double fastBegin, double fastEnd, double slowBegin, double slowEnd)
        {
            if (cachezGuppyMA != null)
            {
                for (int idx = 0; idx < cachezGuppyMA.Length; idx++)
                {
                    if (cachezGuppyMA[idx].AType == aType && Math.Abs(cachezGuppyMA[idx].FastBegin - fastBegin) <= double.Epsilon && Math.Abs(cachezGuppyMA[idx].FastEnd - fastEnd) <= double.Epsilon && Math.Abs(cachezGuppyMA[idx].SlowBegin - slowBegin) <= double.Epsilon && Math.Abs(cachezGuppyMA[idx].SlowEnd - slowEnd) <= double.Epsilon && cachezGuppyMA[idx].EqualsInput(input))
                    {
                        return(cachezGuppyMA[idx]);
                    }
                }
            }

            lock (checkzGuppyMA)
            {
                checkzGuppyMA.AType = aType;
                aType = checkzGuppyMA.AType;
                checkzGuppyMA.FastBegin = fastBegin;
                fastBegin             = checkzGuppyMA.FastBegin;
                checkzGuppyMA.FastEnd = fastEnd;
                fastEnd = checkzGuppyMA.FastEnd;
                checkzGuppyMA.SlowBegin = slowBegin;
                slowBegin             = checkzGuppyMA.SlowBegin;
                checkzGuppyMA.SlowEnd = slowEnd;
                slowEnd = checkzGuppyMA.SlowEnd;

                if (cachezGuppyMA != null)
                {
                    for (int idx = 0; idx < cachezGuppyMA.Length; idx++)
                    {
                        if (cachezGuppyMA[idx].AType == aType && Math.Abs(cachezGuppyMA[idx].FastBegin - fastBegin) <= double.Epsilon && Math.Abs(cachezGuppyMA[idx].FastEnd - fastEnd) <= double.Epsilon && Math.Abs(cachezGuppyMA[idx].SlowBegin - slowBegin) <= double.Epsilon && Math.Abs(cachezGuppyMA[idx].SlowEnd - slowEnd) <= double.Epsilon && cachezGuppyMA[idx].EqualsInput(input))
                        {
                            return(cachezGuppyMA[idx]);
                        }
                    }
                }

                zGuppyMA indicator = new zGuppyMA();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input     = input;
                indicator.AType     = aType;
                indicator.FastBegin = fastBegin;
                indicator.FastEnd   = fastEnd;
                indicator.SlowBegin = slowBegin;
                indicator.SlowEnd   = slowEnd;
                Indicators.Add(indicator);
                indicator.SetUp();

                zGuppyMA[] tmp = new zGuppyMA[cachezGuppyMA == null ? 1 : cachezGuppyMA.Length + 1];
                if (cachezGuppyMA != null)
                {
                    cachezGuppyMA.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cachezGuppyMA       = tmp;
                return(indicator);
            }
        }
コード例 #22
0
        /// <summary>
        /// price proxy
        /// </summary>
        /// <returns></returns>
        public Indicator.zPriceProxy2 zPriceProxy2(Data.IDataSeries input, double filterArg, RWT_MA.MAType filterType, int lookback, RWT_HA.PrimaryOHLC primaryType, double smoothArg, RWT_HA.SecondaryOHLC smoothType, double tolerance)
        {
            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.zPriceProxy2(input, filterArg, filterType, lookback, primaryType, smoothArg, smoothType, tolerance));
        }
コード例 #23
0
 /// <summary>
 /// hull-flavor ma
 /// </summary>
 /// <returns></returns>
 public Indicator.zHullStyleMA zHullStyleMA(Data.IDataSeries input, int length, RWT_MA.MAType type)
 {
     return(_indicator.zHullStyleMA(input, length, type));
 }
コード例 #24
0
 public Indicator.zSwingAverage zSwingAverage(RWT_HA.PrimaryOHLC inputType, int mALength, RWT_MA.MAType mAType, int swingStrength)
 {
     return(_indicator.zSwingAverage(Input, inputType, mALength, mAType, swingStrength));
 }
コード例 #25
0
 public Indicator.zHullStyleMA zHullStyleMA(int length, RWT_MA.MAType type)
 {
     return(_indicator.zHullStyleMA(Input, length, type));
 }
コード例 #26
0
 /// <summary>
 /// A moving average
 /// </summary>
 /// <returns></returns>
 public zMovingAverage zMovingAverage(double length, RWT_MA.MAType type)
 {
     return(zMovingAverage(Input, length, type));
 }
コード例 #27
0
        /// <summary>
        /// adx vma
        /// </summary>
        /// <returns></returns>
        public zADXVMA zADXVMA(Data.IDataSeries input, int aDXLen, RWT_MA.MAType aDXType, RWT_MA.MAType dMType, double fastSpeed, double slowestSpeed, bool useJustInputs, int windowLength)
        {
            if (cachezADXVMA != null)
            {
                for (int idx = 0; idx < cachezADXVMA.Length; idx++)
                {
                    if (cachezADXVMA[idx].ADXLen == aDXLen && cachezADXVMA[idx].ADXType == aDXType && cachezADXVMA[idx].DMType == dMType && Math.Abs(cachezADXVMA[idx].FastSpeed - fastSpeed) <= double.Epsilon && Math.Abs(cachezADXVMA[idx].SlowestSpeed - slowestSpeed) <= double.Epsilon && cachezADXVMA[idx].UseJustInputs == useJustInputs && cachezADXVMA[idx].WindowLength == windowLength && cachezADXVMA[idx].EqualsInput(input))
                    {
                        return(cachezADXVMA[idx]);
                    }
                }
            }

            lock (checkzADXVMA)
            {
                checkzADXVMA.ADXLen = aDXLen;
                aDXLen = checkzADXVMA.ADXLen;
                checkzADXVMA.ADXType = aDXType;
                aDXType             = checkzADXVMA.ADXType;
                checkzADXVMA.DMType = dMType;
                dMType = checkzADXVMA.DMType;
                checkzADXVMA.FastSpeed = fastSpeed;
                fastSpeed = checkzADXVMA.FastSpeed;
                checkzADXVMA.SlowestSpeed = slowestSpeed;
                slowestSpeed = checkzADXVMA.SlowestSpeed;
                checkzADXVMA.UseJustInputs = useJustInputs;
                useJustInputs             = checkzADXVMA.UseJustInputs;
                checkzADXVMA.WindowLength = windowLength;
                windowLength = checkzADXVMA.WindowLength;

                if (cachezADXVMA != null)
                {
                    for (int idx = 0; idx < cachezADXVMA.Length; idx++)
                    {
                        if (cachezADXVMA[idx].ADXLen == aDXLen && cachezADXVMA[idx].ADXType == aDXType && cachezADXVMA[idx].DMType == dMType && Math.Abs(cachezADXVMA[idx].FastSpeed - fastSpeed) <= double.Epsilon && Math.Abs(cachezADXVMA[idx].SlowestSpeed - slowestSpeed) <= double.Epsilon && cachezADXVMA[idx].UseJustInputs == useJustInputs && cachezADXVMA[idx].WindowLength == windowLength && cachezADXVMA[idx].EqualsInput(input))
                        {
                            return(cachezADXVMA[idx]);
                        }
                    }
                }

                zADXVMA indicator = new zADXVMA();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input         = input;
                indicator.ADXLen        = aDXLen;
                indicator.ADXType       = aDXType;
                indicator.DMType        = dMType;
                indicator.FastSpeed     = fastSpeed;
                indicator.SlowestSpeed  = slowestSpeed;
                indicator.UseJustInputs = useJustInputs;
                indicator.WindowLength  = windowLength;
                Indicators.Add(indicator);
                indicator.SetUp();

                zADXVMA[] tmp = new zADXVMA[cachezADXVMA == null ? 1 : cachezADXVMA.Length + 1];
                if (cachezADXVMA != null)
                {
                    cachezADXVMA.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cachezADXVMA        = tmp;
                return(indicator);
            }
        }
コード例 #28
0
        /// <summary>
        /// an average of swings
        /// </summary>
        /// <returns></returns>
        public zSwingAverage zSwingAverage(Data.IDataSeries input, RWT_HA.PrimaryOHLC inputType, int mALength, RWT_MA.MAType mAType, int swingStrength)
        {
            if (cachezSwingAverage != null)
            {
                for (int idx = 0; idx < cachezSwingAverage.Length; idx++)
                {
                    if (cachezSwingAverage[idx].InputType == inputType && cachezSwingAverage[idx].MALength == mALength && cachezSwingAverage[idx].MAType == mAType && cachezSwingAverage[idx].SwingStrength == swingStrength && cachezSwingAverage[idx].EqualsInput(input))
                    {
                        return(cachezSwingAverage[idx]);
                    }
                }
            }

            lock (checkzSwingAverage)
            {
                checkzSwingAverage.InputType = inputType;
                inputType = checkzSwingAverage.InputType;
                checkzSwingAverage.MALength = mALength;
                mALength = checkzSwingAverage.MALength;
                checkzSwingAverage.MAType = mAType;
                mAType = checkzSwingAverage.MAType;
                checkzSwingAverage.SwingStrength = swingStrength;
                swingStrength = checkzSwingAverage.SwingStrength;

                if (cachezSwingAverage != null)
                {
                    for (int idx = 0; idx < cachezSwingAverage.Length; idx++)
                    {
                        if (cachezSwingAverage[idx].InputType == inputType && cachezSwingAverage[idx].MALength == mALength && cachezSwingAverage[idx].MAType == mAType && cachezSwingAverage[idx].SwingStrength == swingStrength && cachezSwingAverage[idx].EqualsInput(input))
                        {
                            return(cachezSwingAverage[idx]);
                        }
                    }
                }

                zSwingAverage indicator = new zSwingAverage();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input         = input;
                indicator.InputType     = inputType;
                indicator.MALength      = mALength;
                indicator.MAType        = mAType;
                indicator.SwingStrength = swingStrength;
                Indicators.Add(indicator);
                indicator.SetUp();

                zSwingAverage[] tmp = new zSwingAverage[cachezSwingAverage == null ? 1 : cachezSwingAverage.Length + 1];
                if (cachezSwingAverage != null)
                {
                    cachezSwingAverage.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cachezSwingAverage  = tmp;
                return(indicator);
            }
        }
コード例 #29
0
        /// <summary>
        /// better adx
        /// </summary>
        /// <returns></returns>
        public ZADX ZADX(Data.IDataSeries input, int aDXLength, RWT_MA.MAType aDXType, double barSmoothArg, RWT_HA.SecondaryOHLC barSmoothType, RWT_HA.PrimaryOHLC barsType, int dMLength, RWT_MA.MAType dMType)
        {
            if (cacheZADX != null)
            {
                for (int idx = 0; idx < cacheZADX.Length; idx++)
                {
                    if (cacheZADX[idx].ADXLength == aDXLength && cacheZADX[idx].ADXType == aDXType && Math.Abs(cacheZADX[idx].BarSmoothArg - barSmoothArg) <= double.Epsilon && cacheZADX[idx].BarSmoothType == barSmoothType && cacheZADX[idx].BarsType == barsType && cacheZADX[idx].DMLength == dMLength && cacheZADX[idx].DMType == dMType && cacheZADX[idx].EqualsInput(input))
                    {
                        return(cacheZADX[idx]);
                    }
                }
            }

            lock (checkZADX)
            {
                checkZADX.ADXLength     = aDXLength;
                aDXLength               = checkZADX.ADXLength;
                checkZADX.ADXType       = aDXType;
                aDXType                 = checkZADX.ADXType;
                checkZADX.BarSmoothArg  = barSmoothArg;
                barSmoothArg            = checkZADX.BarSmoothArg;
                checkZADX.BarSmoothType = barSmoothType;
                barSmoothType           = checkZADX.BarSmoothType;
                checkZADX.BarsType      = barsType;
                barsType                = checkZADX.BarsType;
                checkZADX.DMLength      = dMLength;
                dMLength                = checkZADX.DMLength;
                checkZADX.DMType        = dMType;
                dMType = checkZADX.DMType;

                if (cacheZADX != null)
                {
                    for (int idx = 0; idx < cacheZADX.Length; idx++)
                    {
                        if (cacheZADX[idx].ADXLength == aDXLength && cacheZADX[idx].ADXType == aDXType && Math.Abs(cacheZADX[idx].BarSmoothArg - barSmoothArg) <= double.Epsilon && cacheZADX[idx].BarSmoothType == barSmoothType && cacheZADX[idx].BarsType == barsType && cacheZADX[idx].DMLength == dMLength && cacheZADX[idx].DMType == dMType && cacheZADX[idx].EqualsInput(input))
                        {
                            return(cacheZADX[idx]);
                        }
                    }
                }

                ZADX indicator = new ZADX();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input         = input;
                indicator.ADXLength     = aDXLength;
                indicator.ADXType       = aDXType;
                indicator.BarSmoothArg  = barSmoothArg;
                indicator.BarSmoothType = barSmoothType;
                indicator.BarsType      = barsType;
                indicator.DMLength      = dMLength;
                indicator.DMType        = dMType;
                Indicators.Add(indicator);
                indicator.SetUp();

                ZADX[] tmp = new ZADX[cacheZADX == null ? 1 : cacheZADX.Length + 1];
                if (cacheZADX != null)
                {
                    cacheZADX.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheZADX           = tmp;
                return(indicator);
            }
        }
コード例 #30
0
        /// <summary>
        /// price proxy
        /// </summary>
        /// <returns></returns>
        public zPriceProxy2 zPriceProxy2(Data.IDataSeries input, double filterArg, RWT_MA.MAType filterType, int lookback, RWT_HA.PrimaryOHLC primaryType, double smoothArg, RWT_HA.SecondaryOHLC smoothType, double tolerance)
        {
            if (cachezPriceProxy2 != null)
            {
                for (int idx = 0; idx < cachezPriceProxy2.Length; idx++)
                {
                    if (Math.Abs(cachezPriceProxy2[idx].FilterArg - filterArg) <= double.Epsilon && cachezPriceProxy2[idx].FilterType == filterType && cachezPriceProxy2[idx].Lookback == lookback && cachezPriceProxy2[idx].PrimaryType == primaryType && Math.Abs(cachezPriceProxy2[idx].SmoothArg - smoothArg) <= double.Epsilon && cachezPriceProxy2[idx].SmoothType == smoothType && Math.Abs(cachezPriceProxy2[idx].Tolerance - tolerance) <= double.Epsilon && cachezPriceProxy2[idx].EqualsInput(input))
                    {
                        return(cachezPriceProxy2[idx]);
                    }
                }
            }

            lock (checkzPriceProxy2)
            {
                checkzPriceProxy2.FilterArg = filterArg;
                filterArg = checkzPriceProxy2.FilterArg;
                checkzPriceProxy2.FilterType = filterType;
                filterType = checkzPriceProxy2.FilterType;
                checkzPriceProxy2.Lookback = lookback;
                lookback = checkzPriceProxy2.Lookback;
                checkzPriceProxy2.PrimaryType = primaryType;
                primaryType = checkzPriceProxy2.PrimaryType;
                checkzPriceProxy2.SmoothArg = smoothArg;
                smoothArg = checkzPriceProxy2.SmoothArg;
                checkzPriceProxy2.SmoothType = smoothType;
                smoothType = checkzPriceProxy2.SmoothType;
                checkzPriceProxy2.Tolerance = tolerance;
                tolerance = checkzPriceProxy2.Tolerance;

                if (cachezPriceProxy2 != null)
                {
                    for (int idx = 0; idx < cachezPriceProxy2.Length; idx++)
                    {
                        if (Math.Abs(cachezPriceProxy2[idx].FilterArg - filterArg) <= double.Epsilon && cachezPriceProxy2[idx].FilterType == filterType && cachezPriceProxy2[idx].Lookback == lookback && cachezPriceProxy2[idx].PrimaryType == primaryType && Math.Abs(cachezPriceProxy2[idx].SmoothArg - smoothArg) <= double.Epsilon && cachezPriceProxy2[idx].SmoothType == smoothType && Math.Abs(cachezPriceProxy2[idx].Tolerance - tolerance) <= double.Epsilon && cachezPriceProxy2[idx].EqualsInput(input))
                        {
                            return(cachezPriceProxy2[idx]);
                        }
                    }
                }

                zPriceProxy2 indicator = new zPriceProxy2();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input       = input;
                indicator.FilterArg   = filterArg;
                indicator.FilterType  = filterType;
                indicator.Lookback    = lookback;
                indicator.PrimaryType = primaryType;
                indicator.SmoothArg   = smoothArg;
                indicator.SmoothType  = smoothType;
                indicator.Tolerance   = tolerance;
                Indicators.Add(indicator);
                indicator.SetUp();

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