Esempio n. 1
0
        /// <summary>
        /// Chaikin oscillator as described here:
        /// <see href="https://en.wikipedia.org/wiki/Accumulation/distribution_index"/>
        /// </summary>
        /// <param name="series">input time series</param>
        /// <param name="parentId">caller cache id, optional</param>
        /// <param name="memberName">caller's member name, optional</param>
        /// <param name="lineNumber">caller line number, optional</param>
        /// <returns>accumulation/ distribution index as time series</returns>
        public static ITimeSeries <double> ChaikinOscillator(this Instrument series,
                                                             CacheId parentId = null, [CallerMemberName] string memberName = "", [CallerLineNumber] int lineNumber = 0)
        {
            var cacheId = new CacheId(parentId, memberName, lineNumber,
                                      series.GetHashCode());

            var adl = series.AccumulationDistributionIndex(cacheId);

            return(adl
                   .EMA(3, cacheId)
                   .Subtract(
                       adl
                       .EMA(10, cacheId),
                       cacheId));
        }