Ejemplo n.º 1
0
        /// <summary>
        /// HeikenAshi technique discussed in the article 'Using Heiken-Ashi Technique' in February 2004 issue of TASC magazine.
        /// </summary>
        /// <returns></returns>
        public HeikenAshi HeikenAshi(Data.IDataSeries input)
        {
            if (cacheHeikenAshi != null)
            {
                for (int idx = 0; idx < cacheHeikenAshi.Length; idx++)
                {
                    if (cacheHeikenAshi[idx].EqualsInput(input))
                    {
                        return(cacheHeikenAshi[idx]);
                    }
                }
            }

            lock (checkHeikenAshi)
            {
                if (cacheHeikenAshi != null)
                {
                    for (int idx = 0; idx < cacheHeikenAshi.Length; idx++)
                    {
                        if (cacheHeikenAshi[idx].EqualsInput(input))
                        {
                            return(cacheHeikenAshi[idx]);
                        }
                    }
                }

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

                HeikenAshi[] tmp = new HeikenAshi[cacheHeikenAshi == null ? 1 : cacheHeikenAshi.Length + 1];
                if (cacheHeikenAshi != null)
                {
                    cacheHeikenAshi.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1] = indicator;
                cacheHeikenAshi     = tmp;
                return(indicator);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// HeikenAshi technique discussed in the article 'Using Heiken-Ashi Technique' in February 2004 issue of TASC magazine.
        /// </summary>
        /// <returns></returns>
        public HeikenAshi HeikenAshi(Data.IDataSeries input)
        {
            if (cacheHeikenAshi != null)
                for (int idx = 0; idx < cacheHeikenAshi.Length; idx++)
                    if (cacheHeikenAshi[idx].EqualsInput(input))
                        return cacheHeikenAshi[idx];

            lock (checkHeikenAshi)
            {
                if (cacheHeikenAshi != null)
                    for (int idx = 0; idx < cacheHeikenAshi.Length; idx++)
                        if (cacheHeikenAshi[idx].EqualsInput(input))
                            return cacheHeikenAshi[idx];

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

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