예제 #1
0
        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public GeekoParaTrend GeekoParaTrend(Data.IDataSeries input, double acceleration, double accelerationMax, double accelerationStep, int periodFast, int periodSlow)
        {
            if (cacheGeekoParaTrend != null)
                for (int idx = 0; idx < cacheGeekoParaTrend.Length; idx++)
                    if (Math.Abs(cacheGeekoParaTrend[idx].Acceleration - acceleration) <= double.Epsilon && Math.Abs(cacheGeekoParaTrend[idx].AccelerationMax - accelerationMax) <= double.Epsilon && Math.Abs(cacheGeekoParaTrend[idx].AccelerationStep - accelerationStep) <= double.Epsilon && cacheGeekoParaTrend[idx].PeriodFast == periodFast && cacheGeekoParaTrend[idx].PeriodSlow == periodSlow && cacheGeekoParaTrend[idx].EqualsInput(input))
                        return cacheGeekoParaTrend[idx];

            lock (checkGeekoParaTrend)
            {
                checkGeekoParaTrend.Acceleration = acceleration;
                acceleration = checkGeekoParaTrend.Acceleration;
                checkGeekoParaTrend.AccelerationMax = accelerationMax;
                accelerationMax = checkGeekoParaTrend.AccelerationMax;
                checkGeekoParaTrend.AccelerationStep = accelerationStep;
                accelerationStep = checkGeekoParaTrend.AccelerationStep;
                checkGeekoParaTrend.PeriodFast = periodFast;
                periodFast = checkGeekoParaTrend.PeriodFast;
                checkGeekoParaTrend.PeriodSlow = periodSlow;
                periodSlow = checkGeekoParaTrend.PeriodSlow;

                if (cacheGeekoParaTrend != null)
                    for (int idx = 0; idx < cacheGeekoParaTrend.Length; idx++)
                        if (Math.Abs(cacheGeekoParaTrend[idx].Acceleration - acceleration) <= double.Epsilon && Math.Abs(cacheGeekoParaTrend[idx].AccelerationMax - accelerationMax) <= double.Epsilon && Math.Abs(cacheGeekoParaTrend[idx].AccelerationStep - accelerationStep) <= double.Epsilon && cacheGeekoParaTrend[idx].PeriodFast == periodFast && cacheGeekoParaTrend[idx].PeriodSlow == periodSlow && cacheGeekoParaTrend[idx].EqualsInput(input))
                            return cacheGeekoParaTrend[idx];

                GeekoParaTrend indicator = new GeekoParaTrend();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.Acceleration = acceleration;
                indicator.AccelerationMax = accelerationMax;
                indicator.AccelerationStep = accelerationStep;
                indicator.PeriodFast = periodFast;
                indicator.PeriodSlow = periodSlow;
                Indicators.Add(indicator);
                indicator.SetUp();

                GeekoParaTrend[] tmp = new GeekoParaTrend[cacheGeekoParaTrend == null ? 1 : cacheGeekoParaTrend.Length + 1];
                if (cacheGeekoParaTrend != null)
                    cacheGeekoParaTrend.CopyTo(tmp, 0);
                tmp[tmp.Length - 1] = indicator;
                cacheGeekoParaTrend = tmp;
                return indicator;
            }
        }
예제 #2
0
        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public GeekoParaTrend GeekoParaTrend(Data.IDataSeries input, double acceleration, double accelerationMax, double accelerationStep, int periodFast, int periodSlow)
        {
            if (cacheGeekoParaTrend != null)
            {
                for (int idx = 0; idx < cacheGeekoParaTrend.Length; idx++)
                {
                    if (Math.Abs(cacheGeekoParaTrend[idx].Acceleration - acceleration) <= double.Epsilon && Math.Abs(cacheGeekoParaTrend[idx].AccelerationMax - accelerationMax) <= double.Epsilon && Math.Abs(cacheGeekoParaTrend[idx].AccelerationStep - accelerationStep) <= double.Epsilon && cacheGeekoParaTrend[idx].PeriodFast == periodFast && cacheGeekoParaTrend[idx].PeriodSlow == periodSlow && cacheGeekoParaTrend[idx].EqualsInput(input))
                    {
                        return(cacheGeekoParaTrend[idx]);
                    }
                }
            }

            lock (checkGeekoParaTrend)
            {
                checkGeekoParaTrend.Acceleration = acceleration;
                acceleration = checkGeekoParaTrend.Acceleration;
                checkGeekoParaTrend.AccelerationMax = accelerationMax;
                accelerationMax = checkGeekoParaTrend.AccelerationMax;
                checkGeekoParaTrend.AccelerationStep = accelerationStep;
                accelerationStep = checkGeekoParaTrend.AccelerationStep;
                checkGeekoParaTrend.PeriodFast = periodFast;
                periodFast = checkGeekoParaTrend.PeriodFast;
                checkGeekoParaTrend.PeriodSlow = periodSlow;
                periodSlow = checkGeekoParaTrend.PeriodSlow;

                if (cacheGeekoParaTrend != null)
                {
                    for (int idx = 0; idx < cacheGeekoParaTrend.Length; idx++)
                    {
                        if (Math.Abs(cacheGeekoParaTrend[idx].Acceleration - acceleration) <= double.Epsilon && Math.Abs(cacheGeekoParaTrend[idx].AccelerationMax - accelerationMax) <= double.Epsilon && Math.Abs(cacheGeekoParaTrend[idx].AccelerationStep - accelerationStep) <= double.Epsilon && cacheGeekoParaTrend[idx].PeriodFast == periodFast && cacheGeekoParaTrend[idx].PeriodSlow == periodSlow && cacheGeekoParaTrend[idx].EqualsInput(input))
                        {
                            return(cacheGeekoParaTrend[idx]);
                        }
                    }
                }

                GeekoParaTrend indicator = new GeekoParaTrend();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input            = input;
                indicator.Acceleration     = acceleration;
                indicator.AccelerationMax  = accelerationMax;
                indicator.AccelerationStep = accelerationStep;
                indicator.PeriodFast       = periodFast;
                indicator.PeriodSlow       = periodSlow;
                Indicators.Add(indicator);
                indicator.SetUp();

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