Пример #1
0
        public void Indicators_KAMA_Make_returns_proper_amount_of_results()
        {
            List <Bar> bars = new List <Bar>();

            bars.Add(new Bar(DateTime.Now, 140000, 144000, 139000, 143000, 100));
            bars.Add(new Bar(DateTime.Now, 140100, 144100, 139100, 143100, 100));
            bars.Add(new Bar(DateTime.Now, 140200, 144200, 139200, 143200, 100));
            bars.Add(new Bar(DateTime.Now, 140300, 144300, 139300, 143300, 100));
            bars.Add(new Bar(DateTime.Now, 140400, 144400, 139400, 143400, 100));
            bars.Add(new Bar(DateTime.Now, 140500, 144500, 139500, 143500, 100));

            IEnumerable <double> result = KAMA.Make(bars, 5, 2, 30);

            Assert.AreEqual(1, result.Count());
        }
        protected override void OnStart()
        {
            _botName       = ToString();
            _instanceLabel = string.Format("{0}-{1}-{2}-{3}-{4}", _botName, _botVersion, Symbol.Code, TimeFrame.ToString(), GlobalTimeFrame.ToString());
            tendency       = Indicators.GetIndicator <CandlestickTendencyII>(GlobalTimeFrame, MinimumGlobalCandleSize);
            tendency2      = Indicators.GetIndicator <CandlestickTendencyII_2>(GlobalTimeFrame2, MinimumGlobalCandleSize2);
            //_emaFast = Indicators.ExponentialMovingAverage(Price, FastPeriods);
            _adx    = Indicators.GetIndicator <ADXR>(Source, interval);
            _heiken = Indicators.GetIndicator <HeikenAshi2>(1);
            _kama   = Indicators.GetIndicator <KAMA>(Source, Fast, Slow, Period);
            Fischer = Indicators.GetIndicator <FisherTransform>(Len);
            //COG = Indicators.GetIndicator<CenterOfGravityOscillator>(Length);
            pipsATR          = Indicators.GetIndicator <PipsATRIndicator>(TimeFrame, AtrPeriod, AtrMaType);
            _onBalanceVolume = Indicators.OnBalanceVolume(Source);

            minPipsATR = pipsATR.Result.Minimum(pipsATR.Result.Count);
            maxPipsATR = pipsATR.Result.Maximum(pipsATR.Result.Count);
        }
Пример #3
0
        public void Indicators_KAMA_Make_returns_empty_result_if_period_equals_to_amount_of_source_bars()
        {
            List <Bar> bars = new List <Bar>();

            bars.Add(new Bar(DateTime.Now, 140000, 144000, 139000, 143000, 100));
            bars.Add(new Bar(DateTime.Now, 140100, 144100, 139100, 143100, 100));
            bars.Add(new Bar(DateTime.Now, 140200, 144200, 139200, 143200, 100));
            bars.Add(new Bar(DateTime.Now, 140300, 144300, 139300, 143300, 100));
            bars.Add(new Bar(DateTime.Now, 140400, 144400, 139400, 143400, 100));
            bars.Add(new Bar(DateTime.Now, 140500, 144500, 139500, 143500, 100));

            int period = 6;

            Assert.AreEqual(period, bars.Count);

            IEnumerable <double> result = KAMA.Make(bars, period, 2, 30);

            Assert.AreEqual(0, result.Count());
        }