Example #1
0
        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public GekkoAUDUSD0050 GekkoAUDUSD0050(Data.IDataSeries input, int hours, int stoploss, int takeProfit, int trailStop)
        {
            if (cacheGekkoAUDUSD0050 != null)
            {
                for (int idx = 0; idx < cacheGekkoAUDUSD0050.Length; idx++)
                {
                    if (cacheGekkoAUDUSD0050[idx].Hours == hours && cacheGekkoAUDUSD0050[idx].Stoploss == stoploss && cacheGekkoAUDUSD0050[idx].TakeProfit == takeProfit && cacheGekkoAUDUSD0050[idx].TrailStop == trailStop && cacheGekkoAUDUSD0050[idx].EqualsInput(input))
                    {
                        return(cacheGekkoAUDUSD0050[idx]);
                    }
                }
            }

            lock (checkGekkoAUDUSD0050)
            {
                checkGekkoAUDUSD0050.Hours = hours;
                hours = checkGekkoAUDUSD0050.Hours;
                checkGekkoAUDUSD0050.Stoploss = stoploss;
                stoploss = checkGekkoAUDUSD0050.Stoploss;
                checkGekkoAUDUSD0050.TakeProfit = takeProfit;
                takeProfit = checkGekkoAUDUSD0050.TakeProfit;
                checkGekkoAUDUSD0050.TrailStop = trailStop;
                trailStop = checkGekkoAUDUSD0050.TrailStop;

                if (cacheGekkoAUDUSD0050 != null)
                {
                    for (int idx = 0; idx < cacheGekkoAUDUSD0050.Length; idx++)
                    {
                        if (cacheGekkoAUDUSD0050[idx].Hours == hours && cacheGekkoAUDUSD0050[idx].Stoploss == stoploss && cacheGekkoAUDUSD0050[idx].TakeProfit == takeProfit && cacheGekkoAUDUSD0050[idx].TrailStop == trailStop && cacheGekkoAUDUSD0050[idx].EqualsInput(input))
                        {
                            return(cacheGekkoAUDUSD0050[idx]);
                        }
                    }
                }

                GekkoAUDUSD0050 indicator = new GekkoAUDUSD0050();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input      = input;
                indicator.Hours      = hours;
                indicator.Stoploss   = stoploss;
                indicator.TakeProfit = takeProfit;
                indicator.TrailStop  = trailStop;
                Indicators.Add(indicator);
                indicator.SetUp();

                GekkoAUDUSD0050[] tmp = new GekkoAUDUSD0050[cacheGekkoAUDUSD0050 == null ? 1 : cacheGekkoAUDUSD0050.Length + 1];
                if (cacheGekkoAUDUSD0050 != null)
                {
                    cacheGekkoAUDUSD0050.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]  = indicator;
                cacheGekkoAUDUSD0050 = tmp;
                return(indicator);
            }
        }
        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public GekkoAUDUSD0050 GekkoAUDUSD0050(Data.IDataSeries input, int hours, int stoploss, int takeProfit, int trailStop)
        {
            if (cacheGekkoAUDUSD0050 != null)
                for (int idx = 0; idx < cacheGekkoAUDUSD0050.Length; idx++)
                    if (cacheGekkoAUDUSD0050[idx].Hours == hours && cacheGekkoAUDUSD0050[idx].Stoploss == stoploss && cacheGekkoAUDUSD0050[idx].TakeProfit == takeProfit && cacheGekkoAUDUSD0050[idx].TrailStop == trailStop && cacheGekkoAUDUSD0050[idx].EqualsInput(input))
                        return cacheGekkoAUDUSD0050[idx];

            lock (checkGekkoAUDUSD0050)
            {
                checkGekkoAUDUSD0050.Hours = hours;
                hours = checkGekkoAUDUSD0050.Hours;
                checkGekkoAUDUSD0050.Stoploss = stoploss;
                stoploss = checkGekkoAUDUSD0050.Stoploss;
                checkGekkoAUDUSD0050.TakeProfit = takeProfit;
                takeProfit = checkGekkoAUDUSD0050.TakeProfit;
                checkGekkoAUDUSD0050.TrailStop = trailStop;
                trailStop = checkGekkoAUDUSD0050.TrailStop;

                if (cacheGekkoAUDUSD0050 != null)
                    for (int idx = 0; idx < cacheGekkoAUDUSD0050.Length; idx++)
                        if (cacheGekkoAUDUSD0050[idx].Hours == hours && cacheGekkoAUDUSD0050[idx].Stoploss == stoploss && cacheGekkoAUDUSD0050[idx].TakeProfit == takeProfit && cacheGekkoAUDUSD0050[idx].TrailStop == trailStop && cacheGekkoAUDUSD0050[idx].EqualsInput(input))
                            return cacheGekkoAUDUSD0050[idx];

                GekkoAUDUSD0050 indicator = new GekkoAUDUSD0050();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.Hours = hours;
                indicator.Stoploss = stoploss;
                indicator.TakeProfit = takeProfit;
                indicator.TrailStop = trailStop;
                Indicators.Add(indicator);
                indicator.SetUp();

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