Exemplo n.º 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;
            }
        }
Exemplo n.º 2
0
        public Trend(Felix.Data.Trend.TrendType type) : this()
        {
            var t = Repository.Trend((int)type);

            TrendId     = t.TrendId;
            Description = t.Description;
        }
Exemplo n.º 3
0
        private void VerifyBarAnalyzerResult(BarAnalyzerResult result, IBarDatum expectedBar, bool expectedValidity, Felix.Data.Trend.TrendType expectedTrend)
        {
            Assert.IsNotNull(result);

            Assert.IsTrue(result.Trend == expectedTrend);

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

            Assert.IsTrue(result.IsValidTrendBar == expectedValidity);
        }
Exemplo n.º 4
0
        private Felix.Data.Trend.TrendType GetExpectedTrendType(int ndx)
        {
            Felix.Data.Trend.TrendType retType = ndx < 20 || ndx > 25 ? Felix.Data.Trend.TrendType.Up : Felix.Data.Trend.TrendType.Down;

            return(retType);
        }