Пример #1
0
        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public EncogExample EncogExample(Data.IDataSeries input, bool export)
        {
            if (cacheEncogExample != null)
            {
                for (int idx = 0; idx < cacheEncogExample.Length; idx++)
                {
                    if (cacheEncogExample[idx].Export == export && cacheEncogExample[idx].EqualsInput(input))
                    {
                        return(cacheEncogExample[idx]);
                    }
                }
            }

            lock (checkEncogExample)
            {
                checkEncogExample.Export = export;
                export = checkEncogExample.Export;

                if (cacheEncogExample != null)
                {
                    for (int idx = 0; idx < cacheEncogExample.Length; idx++)
                    {
                        if (cacheEncogExample[idx].Export == export && cacheEncogExample[idx].EqualsInput(input))
                        {
                            return(cacheEncogExample[idx]);
                        }
                    }
                }

                EncogExample indicator = new EncogExample();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input  = input;
                indicator.Export = export;
                Indicators.Add(indicator);
                indicator.SetUp();

                EncogExample[] tmp = new EncogExample[cacheEncogExample == null ? 1 : cacheEncogExample.Length + 1];
                if (cacheEncogExample != null)
                {
                    cacheEncogExample.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheEncogExample   = tmp;
                return(indicator);
            }
        }
Пример #2
0
        /// <summary>
        /// Enter the description of your new custom indicator here
        /// </summary>
        /// <returns></returns>
        public EncogExample EncogExample(Data.IDataSeries input, bool export)
        {
            if (cacheEncogExample != null)
                for (int idx = 0; idx < cacheEncogExample.Length; idx++)
                    if (cacheEncogExample[idx].Export == export && cacheEncogExample[idx].EqualsInput(input))
                        return cacheEncogExample[idx];

            lock (checkEncogExample)
            {
                checkEncogExample.Export = export;
                export = checkEncogExample.Export;

                if (cacheEncogExample != null)
                    for (int idx = 0; idx < cacheEncogExample.Length; idx++)
                        if (cacheEncogExample[idx].Export == export && cacheEncogExample[idx].EqualsInput(input))
                            return cacheEncogExample[idx];

                EncogExample indicator = new EncogExample();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.Export = export;
                Indicators.Add(indicator);
                indicator.SetUp();

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