예제 #1
0
        /// <summary>
        /// The ZZZigZagDebug indicator shows trend lines filtering out changes below a defined level.
        /// </summary>
        /// <returns></returns>
        public ZZZigZagDebug ZZZigZagDebug(Data.IDataSeries input, DeviationType deviationType, double deviationValue, bool useHighLow)
        {
            if (cacheZZZigZagDebug != null)
            {
                for (int idx = 0; idx < cacheZZZigZagDebug.Length; idx++)
                {
                    if (cacheZZZigZagDebug[idx].DeviationType == deviationType && Math.Abs(cacheZZZigZagDebug[idx].DeviationValue - deviationValue) <= double.Epsilon && cacheZZZigZagDebug[idx].UseHighLow == useHighLow && cacheZZZigZagDebug[idx].EqualsInput(input))
                    {
                        return(cacheZZZigZagDebug[idx]);
                    }
                }
            }

            lock (checkZZZigZagDebug)
            {
                checkZZZigZagDebug.DeviationType = deviationType;
                deviationType = checkZZZigZagDebug.DeviationType;
                checkZZZigZagDebug.DeviationValue = deviationValue;
                deviationValue = checkZZZigZagDebug.DeviationValue;
                checkZZZigZagDebug.UseHighLow = useHighLow;
                useHighLow = checkZZZigZagDebug.UseHighLow;

                if (cacheZZZigZagDebug != null)
                {
                    for (int idx = 0; idx < cacheZZZigZagDebug.Length; idx++)
                    {
                        if (cacheZZZigZagDebug[idx].DeviationType == deviationType && Math.Abs(cacheZZZigZagDebug[idx].DeviationValue - deviationValue) <= double.Epsilon && cacheZZZigZagDebug[idx].UseHighLow == useHighLow && cacheZZZigZagDebug[idx].EqualsInput(input))
                        {
                            return(cacheZZZigZagDebug[idx]);
                        }
                    }
                }

                ZZZigZagDebug indicator = new ZZZigZagDebug();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input          = input;
                indicator.DeviationType  = deviationType;
                indicator.DeviationValue = deviationValue;
                indicator.UseHighLow     = useHighLow;
                Indicators.Add(indicator);
                indicator.SetUp();

                ZZZigZagDebug[] tmp = new ZZZigZagDebug[cacheZZZigZagDebug == null ? 1 : cacheZZZigZagDebug.Length + 1];
                if (cacheZZZigZagDebug != null)
                {
                    cacheZZZigZagDebug.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheZZZigZagDebug  = tmp;
                return(indicator);
            }
        }
예제 #2
0
        /// <summary>
        /// The ZZZigZagDebug indicator shows trend lines filtering out changes below a defined level. 
        /// </summary>
        /// <returns></returns>
        public ZZZigZagDebug ZZZigZagDebug(Data.IDataSeries input, DeviationType deviationType, double deviationValue, bool useHighLow)
        {
            if (cacheZZZigZagDebug != null)
                for (int idx = 0; idx < cacheZZZigZagDebug.Length; idx++)
                    if (cacheZZZigZagDebug[idx].DeviationType == deviationType && Math.Abs(cacheZZZigZagDebug[idx].DeviationValue - deviationValue) <= double.Epsilon && cacheZZZigZagDebug[idx].UseHighLow == useHighLow && cacheZZZigZagDebug[idx].EqualsInput(input))
                        return cacheZZZigZagDebug[idx];

            lock (checkZZZigZagDebug)
            {
                checkZZZigZagDebug.DeviationType = deviationType;
                deviationType = checkZZZigZagDebug.DeviationType;
                checkZZZigZagDebug.DeviationValue = deviationValue;
                deviationValue = checkZZZigZagDebug.DeviationValue;
                checkZZZigZagDebug.UseHighLow = useHighLow;
                useHighLow = checkZZZigZagDebug.UseHighLow;

                if (cacheZZZigZagDebug != null)
                    for (int idx = 0; idx < cacheZZZigZagDebug.Length; idx++)
                        if (cacheZZZigZagDebug[idx].DeviationType == deviationType && Math.Abs(cacheZZZigZagDebug[idx].DeviationValue - deviationValue) <= double.Epsilon && cacheZZZigZagDebug[idx].UseHighLow == useHighLow && cacheZZZigZagDebug[idx].EqualsInput(input))
                            return cacheZZZigZagDebug[idx];

                ZZZigZagDebug indicator = new ZZZigZagDebug();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.DeviationType = deviationType;
                indicator.DeviationValue = deviationValue;
                indicator.UseHighLow = useHighLow;
                Indicators.Add(indicator);
                indicator.SetUp();

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