Esempio n. 1
0
        public void UpdateLastBar__Turn_LastBar_To_DownBar_And_Create_New_DownLeg()
        {
            LegAnalyzer la = new LegAnalyzer();

            List <Bar> barList = new List <Bar>();

            barList.Add(Helper.GetUpBar());
            barList.Add(Helper.GetUpBar(barList.Last(), barList.Last().DateTime.AddDays(1)));
            barList.Add(Helper.GetUpBar(barList.Last(), barList.Last().DateTime.AddDays(1)));

            la.AddBarList(barList);

            FxBar b  = (FxBar)la.LastLeg.BarList[1];
            FxBar nb = new FxBar
            {
                Open     = b.Open,
                AskOpen  = b.AskOpen,
                High     = b.High - 5,
                AskHigh  = b.AskHigh - 5,
                Low      = b.Low - 5,
                AskLow   = b.AskLow - 5,
                Close    = b.Open - 3,
                AskClose = b.AskOpen - 3,
                DateTime = b.DateTime,
                Volume   = 100
            };

            la.UpdateLastBar(nb);

            Assert.AreEqual(2, la.LegsCount);
            Assert.AreEqual(LegDirection.Down, la.LastLeg.Direction);
        }
Esempio n. 2
0
        public void AddBarList(IEnumerable <Bar> barList)
        {
            LegAnalyzer.AddBarList(barList);
            drawBars();

            addTickDelegate = addTick;
        }
Esempio n. 3
0
        public void AddBar__Add_UpBar_To_UpLeg()
        {
            LegAnalyzer la = new LegAnalyzer();

            List <Bar> barList = new List <Bar>();

            barList.Add(Helper.GetUpBar());
            barList.Add(Helper.GetUpBar(barList.Last(), barList.Last().DateTime.AddDays(1)));
            barList.Add(Helper.GetUpBar(barList.Last(), barList.Last().DateTime.AddDays(1)));
            la.AddBarList(barList);

            la.AddBar(Helper.GetUpBar(la.LastBar, la.LastBar.DateTime.AddDays(1)));

            Assert.AreEqual(4, la.LastLeg.BarCount);
        }
Esempio n. 4
0
        public void AddBarList__Should_Create_UpLeg()
        {
            LegAnalyzer la = new LegAnalyzer();

            List <Bar> barList = new List <Bar>();

            barList.Add(Helper.GetUpBar());
            barList.Add(Helper.GetUpBar(barList.Last(), barList.Last().DateTime.AddDays(1)));
            barList.Add(Helper.GetUpBar(barList.Last(), barList.Last().DateTime.AddDays(1)));

            la.AddBarList(barList);

            Assert.AreEqual(1, la.LegsCount);
            Assert.AreEqual(LegDirection.Up, la.LastLeg.Direction);
            Assert.AreEqual(3, la.LastLeg.BarCount);
        }