コード例 #1
0
        /// <summary>
        /// Two EMA  line crossover indicator
        /// </summary>
        /// <returns></returns>
        public GekkoEMAcrossover GekkoEMAcrossover(Data.IDataSeries input, int aDXMinimum, int aDXPeriod, int fastEMAPeriod, int slowEMAPeriod)
        {
            if (cacheGekkoEMAcrossover != null)
            {
                for (int idx = 0; idx < cacheGekkoEMAcrossover.Length; idx++)
                {
                    if (cacheGekkoEMAcrossover[idx].ADXMinimum == aDXMinimum && cacheGekkoEMAcrossover[idx].ADXPeriod == aDXPeriod && cacheGekkoEMAcrossover[idx].FastEMAPeriod == fastEMAPeriod && cacheGekkoEMAcrossover[idx].SlowEMAPeriod == slowEMAPeriod && cacheGekkoEMAcrossover[idx].EqualsInput(input))
                    {
                        return(cacheGekkoEMAcrossover[idx]);
                    }
                }
            }

            lock (checkGekkoEMAcrossover)
            {
                checkGekkoEMAcrossover.ADXMinimum = aDXMinimum;
                aDXMinimum = checkGekkoEMAcrossover.ADXMinimum;
                checkGekkoEMAcrossover.ADXPeriod = aDXPeriod;
                aDXPeriod = checkGekkoEMAcrossover.ADXPeriod;
                checkGekkoEMAcrossover.FastEMAPeriod = fastEMAPeriod;
                fastEMAPeriod = checkGekkoEMAcrossover.FastEMAPeriod;
                checkGekkoEMAcrossover.SlowEMAPeriod = slowEMAPeriod;
                slowEMAPeriod = checkGekkoEMAcrossover.SlowEMAPeriod;

                if (cacheGekkoEMAcrossover != null)
                {
                    for (int idx = 0; idx < cacheGekkoEMAcrossover.Length; idx++)
                    {
                        if (cacheGekkoEMAcrossover[idx].ADXMinimum == aDXMinimum && cacheGekkoEMAcrossover[idx].ADXPeriod == aDXPeriod && cacheGekkoEMAcrossover[idx].FastEMAPeriod == fastEMAPeriod && cacheGekkoEMAcrossover[idx].SlowEMAPeriod == slowEMAPeriod && cacheGekkoEMAcrossover[idx].EqualsInput(input))
                        {
                            return(cacheGekkoEMAcrossover[idx]);
                        }
                    }
                }

                GekkoEMAcrossover indicator = new GekkoEMAcrossover();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input         = input;
                indicator.ADXMinimum    = aDXMinimum;
                indicator.ADXPeriod     = aDXPeriod;
                indicator.FastEMAPeriod = fastEMAPeriod;
                indicator.SlowEMAPeriod = slowEMAPeriod;
                Indicators.Add(indicator);
                indicator.SetUp();

                GekkoEMAcrossover[] tmp = new GekkoEMAcrossover[cacheGekkoEMAcrossover == null ? 1 : cacheGekkoEMAcrossover.Length + 1];
                if (cacheGekkoEMAcrossover != null)
                {
                    cacheGekkoEMAcrossover.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]    = indicator;
                cacheGekkoEMAcrossover = tmp;
                return(indicator);
            }
        }
コード例 #2
0
		/// <summary>
		/// Two EMA  line crossover indicator
		/// </summary>
		/// <returns></returns>
		public GekkoEMAcrossover GekkoEMAcrossover(Data.IDataSeries input, int aDXMinimum, int aDXPeriod, int fastEMAPeriod, int slowEMAPeriod)
		{
			if (cacheGekkoEMAcrossover != null)
				for (int idx = 0; idx < cacheGekkoEMAcrossover.Length; idx++)
					if (cacheGekkoEMAcrossover[idx].ADXMinimum == aDXMinimum && cacheGekkoEMAcrossover[idx].ADXPeriod == aDXPeriod && cacheGekkoEMAcrossover[idx].FastEMAPeriod == fastEMAPeriod && cacheGekkoEMAcrossover[idx].SlowEMAPeriod == slowEMAPeriod && cacheGekkoEMAcrossover[idx].EqualsInput(input))
						return cacheGekkoEMAcrossover[idx];

			lock (checkGekkoEMAcrossover)
			{
				checkGekkoEMAcrossover.ADXMinimum = aDXMinimum;
				aDXMinimum = checkGekkoEMAcrossover.ADXMinimum;
				checkGekkoEMAcrossover.ADXPeriod = aDXPeriod;
				aDXPeriod = checkGekkoEMAcrossover.ADXPeriod;
				checkGekkoEMAcrossover.FastEMAPeriod = fastEMAPeriod;
				fastEMAPeriod = checkGekkoEMAcrossover.FastEMAPeriod;
				checkGekkoEMAcrossover.SlowEMAPeriod = slowEMAPeriod;
				slowEMAPeriod = checkGekkoEMAcrossover.SlowEMAPeriod;

				if (cacheGekkoEMAcrossover != null)
					for (int idx = 0; idx < cacheGekkoEMAcrossover.Length; idx++)
						if (cacheGekkoEMAcrossover[idx].ADXMinimum == aDXMinimum && cacheGekkoEMAcrossover[idx].ADXPeriod == aDXPeriod && cacheGekkoEMAcrossover[idx].FastEMAPeriod == fastEMAPeriod && cacheGekkoEMAcrossover[idx].SlowEMAPeriod == slowEMAPeriod && cacheGekkoEMAcrossover[idx].EqualsInput(input))
							return cacheGekkoEMAcrossover[idx];

				GekkoEMAcrossover indicator = new GekkoEMAcrossover();
				indicator.BarsRequired = BarsRequired;
				indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
				indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
				indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
				indicator.Input = input;
				indicator.ADXMinimum = aDXMinimum;
				indicator.ADXPeriod = aDXPeriod;
				indicator.FastEMAPeriod = fastEMAPeriod;
				indicator.SlowEMAPeriod = slowEMAPeriod;
				Indicators.Add(indicator);
				indicator.SetUp();

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