public void WickedOneRisingRenko() { var consolidator = new TestRenkoConsolidator(1.0m); var renkos = new List <RenkoBar>(); consolidator.DataConsolidated += (sender, renko) => renkos.Add(renko); var tickOn1 = new DateTime(2016, 1, 1, 17, 0, 0, 0); var tickOn2 = new DateTime(2016, 1, 1, 17, 0, 0, 1); consolidator.Update(new IndicatorDataPoint(tickOn1, 9.0m)); consolidator.Update(new IndicatorDataPoint(tickOn2, 10.1m)); Assert.AreEqual(renkos.Count, 1); Assert.AreEqual(renkos[0].Open, 9.0m); Assert.AreEqual(renkos[0].High, 10.0m); Assert.AreEqual(renkos[0].Low, 9.0m); Assert.AreEqual(renkos[0].Close, 10.0m); Assert.AreEqual(renkos[0].Direction, BarDirection.Rising); Assert.AreEqual(renkos[0].Spread, 1.0m); Assert.AreEqual(renkos[0].Start, tickOn1); Assert.AreEqual(renkos[0].EndTime, tickOn2); var openRenko = consolidator.OpenRenko(); Assert.AreEqual(openRenko.Start, tickOn2); Assert.AreEqual(openRenko.EndTime, tickOn2); Assert.AreEqual(openRenko.Open, 10.0m); Assert.AreEqual(openRenko.High, 10.1m); Assert.AreEqual(openRenko.Low, 10.0m); Assert.AreEqual(openRenko.Close, 10.1m); }
public void WickedNoFallingRenkoKissLimit() { var consolidator = new TestRenkoConsolidator(1.0m); var renkos = new List <RenkoBar>(); consolidator.DataConsolidated += (sender, renko) => renkos.Add(renko); var tickOn1 = new DateTime(2016, 1, 1, 17, 0, 0, 0); var tickOn2 = new DateTime(2016, 1, 1, 17, 0, 0, 1); consolidator.Update(new IndicatorDataPoint(tickOn1, 10.0m)); consolidator.Update(new IndicatorDataPoint(tickOn2, 9.0m)); Assert.AreEqual(renkos.Count, 0); var openRenko = consolidator.OpenRenko(); Assert.AreEqual(openRenko.Open, 10.0m); Assert.AreEqual(openRenko.High, 10.0m); Assert.AreEqual(openRenko.Low, 9.0m); Assert.AreEqual(openRenko.Close, 9.0m); }
public void WickedTwoRisingThenThreeFallingGapRenkos() { var consolidator = new TestRenkoConsolidator(1.0m); var renkos = new List <RenkoBar>(); consolidator.DataConsolidated += (sender, renko) => renkos.Add(renko); var tickOn1 = new DateTime(2016, 1, 1, 17, 0, 0, 0); var tickOn2 = new DateTime(2016, 1, 1, 17, 0, 0, 1); consolidator.Update(new IndicatorDataPoint(tickOn1, 10.0m)); consolidator.Update(new IndicatorDataPoint(tickOn1, 9.6m)); consolidator.Update(new IndicatorDataPoint(tickOn1, 10.5m)); consolidator.Update(new IndicatorDataPoint(tickOn1, 11.1m)); consolidator.Update(new IndicatorDataPoint(tickOn1, 11.0m)); consolidator.Update(new IndicatorDataPoint(tickOn1, 10.7m)); consolidator.Update(new IndicatorDataPoint(tickOn1, 11.6m)); consolidator.Update(new IndicatorDataPoint(tickOn1, 12.3m)); consolidator.Update(new IndicatorDataPoint(tickOn1, 12.3m)); consolidator.Update(new IndicatorDataPoint(tickOn1, 12.4m)); consolidator.Update(new IndicatorDataPoint(tickOn1, 11.5m)); consolidator.Update(new IndicatorDataPoint(tickOn1, 7.9m)); Assert.AreEqual(renkos.Count, 5); Assert.AreEqual(renkos[0].Open, 10.0); Assert.AreEqual(renkos[0].High, 11.0); Assert.AreEqual(renkos[0].Low, 9.6); Assert.AreEqual(renkos[0].Close, 11.0); Assert.AreEqual(renkos[0].Direction, BarDirection.Rising); Assert.AreEqual(renkos[0].Spread, 1.0); Assert.AreEqual(renkos[1].Open, 11.0); Assert.AreEqual(renkos[1].High, 12.0); Assert.AreEqual(renkos[1].Low, 10.7); Assert.AreEqual(renkos[1].Close, 12.0); Assert.AreEqual(renkos[1].Direction, BarDirection.Rising); Assert.AreEqual(renkos[1].Spread, 1.0); Assert.AreEqual(renkos[2].Open, 11.0); Assert.AreEqual(renkos[2].High, 12.4); Assert.AreEqual(renkos[2].Low, 10.0); Assert.AreEqual(renkos[2].Close, 10.0); Assert.AreEqual(renkos[2].Direction, BarDirection.Falling); Assert.AreEqual(renkos[2].Spread, 1.0); Assert.AreEqual(renkos[3].Open, 10.0); Assert.AreEqual(renkos[3].High, 10.0); Assert.AreEqual(renkos[3].Low, 9.0); Assert.AreEqual(renkos[3].Close, 9.0); Assert.AreEqual(renkos[3].Direction, BarDirection.Falling); Assert.AreEqual(renkos[3].Spread, 1.0); Assert.AreEqual(renkos[4].Open, 9.0); Assert.AreEqual(renkos[4].High, 9.0); Assert.AreEqual(renkos[4].Low, 8.0); Assert.AreEqual(renkos[4].Close, 8.0); Assert.AreEqual(renkos[4].Direction, BarDirection.Falling); Assert.AreEqual(renkos[4].Spread, 1.0); var openRenko = consolidator.OpenRenko(); Assert.AreEqual(openRenko.Open, 8.0); Assert.AreEqual(openRenko.High, 8.0); Assert.AreEqual(openRenko.Low, 7.9); Assert.AreEqual(openRenko.Close, 7.9); }