예제 #1
0
        public static AwesomeOscillator Series(Bars bars, int period1, int period2)
        {
            string description = string.Concat(new object[] { "Awesome Oscillator(", period1, ",", period2, ")" });

            if (bars.Cache.ContainsKey(description))
            {
                return((AwesomeOscillator)bars.Cache[description]);
            }

            AwesomeOscillator _AwesomeOscillator = new AwesomeOscillator(bars, period1, period2, description);

            bars.Cache[description] = _AwesomeOscillator;
            return(_AwesomeOscillator);
        }
예제 #2
0
        public AccelerationDeceleration(Bars bars, int period1, int period2, int smoothing, string description)
            : base(bars, description)
        {
            base.FirstValidValue = Math.Max((period1 + period2), smoothing);

            AwesomeOscillator ao = AwesomeOscillator.Series(bars, period1, period2);

            var rangePartitioner = Partitioner.Create(0, bars.Count);

            Parallel.ForEach(rangePartitioner, (range, loopState) =>
            {
                for (int bar = range.Item1; bar < range.Item2; bar++)
                {
                    base[bar] = ao[bar] - Community.Indicators.FastSMA.Series(ao, smoothing)[bar];
                }
            });
        }