예제 #1
0
        /**
         * Constructor.
         * @param indicator the indicator (usually close price)
         * @param longRoCTimeFrame the time frame for long term RoC
         * @param shortRoCTimeFrame the time frame for short term RoC
         * @param wmaTimeFrame the time frame (for WMA)
         */
        public CoppockCurveIndicator(IIndicator <decimal> indicator, int longRoCTimeFrame, int shortRoCTimeFrame, int wmaTimeFrame)
            : base(indicator)
        {
            SumIndicator sum = new SumIndicator(
                new ROCIndicator(indicator, longRoCTimeFrame),
                new ROCIndicator(indicator, shortRoCTimeFrame)
                );

            _wma = new WMAIndicator(sum, wmaTimeFrame);
        }
예제 #2
0
        public HMAIndicator(IIndicator <decimal> indicator, int timeFrame)
            : base(indicator)
        {
            WMAIndicator halfWma = new WMAIndicator(indicator, timeFrame / 2);
            WMAIndicator origWma = new WMAIndicator(indicator, timeFrame);

            IIndicator <decimal> indicatorForSqrtWma = new DifferenceIndicator(new MultiplierIndicator(halfWma, Decimals.TWO), origWma);

            _sqrtWma = new WMAIndicator(indicatorForSqrtWma, (int)Math.Sqrt(timeFrame));
        }