Exemple #1
0
        public void BarAnalyzerBreakTest()
        {
            List <IBar> bars = upTrendMocks.ToList();

            IBarDatum workingBar = null;

            Felix.Data.Trend.TrendType currentTrend = Felix.Data.Trend.TrendType.Unknown;

            for (int i = 0, c = bars.Count; i < c; ++i)
            {
                IBarDatum datum = CreateBar(bars[i]);

                BarAnalyzerResult result = BarAnalyzer.Analyze(workingBar, datum, currentTrend);

                Felix.Data.Trend.TrendType expectedType = GetExpectedTrendType(datum.Index);

                IBarDatum expectedBar = datum.Index != 25 ? datum : workingBar;

                VerifyBarAnalyzerResult(result, expectedBar, datum.Index != 25, expectedType);

                workingBar = result.WorkingBar;

                currentTrend = result.Trend;
            }
        }
Exemple #2
0
        public void Insert(IBarDatum bd)
        {
            InsertDataList(bd);

            BarAnalyzerResult result = BarAnalyzer.Analyze(WorkingBar, bd, CurrentTrendType);

            Update(result);
        }
Exemple #3
0
        public void BarAnalyzerInitialTest()
        {
            IBar bar = upTrendMocks.First();

            IBarDatum datum = CreateBar(bar);

            BarAnalyzerResult result = BarAnalyzer.Analyze(null, datum, Felix.Data.Trend.TrendType.Unknown);

            Assert.IsNotNull(result);

            Assert.IsTrue(result.Trend == Felix.Data.Trend.TrendType.Up);

            Assert.IsTrue(result.WorkingBar == datum);

            Assert.IsTrue(result.IsValidTrendBar == true);
        }
Exemple #4
0
        public void BarAnalyzerTest()
        {
            List <IBar> bars = upTrendMocks.Take(5).ToList();

            IBarDatum workingBar = null;

            foreach (IBar bar in bars)
            {
                IBarDatum datum = CreateBar(bar);

                BarAnalyzerResult result = BarAnalyzer.Analyze(workingBar, datum, Felix.Data.Trend.TrendType.Unknown);

                VerifyBarAnalyzerResult(result, datum, true, Felix.Data.Trend.TrendType.Up);

                workingBar = result.WorkingBar;
            }
        }