public static Leg GetDownLeg(int numberOfBars, Leg previousLeg = null) { FxBar[] barlist = new FxBar[numberOfBars + 1]; FxBar downBar = new FxBar(60, 61, 120, 121, 40, 41, 50, 51, 0, DateTime.Now, DateTime.Now); barlist[0] = downBar; Leg leg = new Leg(downBar, previousLeg); for (int i = 1; i < numberOfBars; i++) { barlist[i] = (new FxBar { Open = downBar.Open - (i + 10), AskOpen = downBar.AskOpen - (i + 10), High = downBar.High - (i + 10), AskHigh = downBar.AskHigh - (i + 10), Low = downBar.Low - (i + 10), AskLow = downBar.AskLow - (i + 10), Close = downBar.Close - (i + 10), AskClose = downBar.AskClose - (i + 10), PreviousBar = barlist[i - 1] }); leg.AddBar(barlist[i]); } return(leg); }
public static Leg GetUpLeg(int numberOfBars, Leg previousLeg = null) { FxBar[] barlist = new FxBar[numberOfBars + 1]; FxBar upBar = new FxBar(30, 31, 60, 61, 10, 11, 40, 41, 0, DateTime.Now, DateTime.Now); barlist[0] = upBar; Leg leg = new Leg(upBar, previousLeg); for (int i = 1; i < numberOfBars; i++) { barlist[i] = (new FxBar { Open = upBar.Open + (i + 10), AskOpen = upBar.AskOpen + (i + 10), High = upBar.High + (i + 10), AskHigh = upBar.AskHigh + (i + 10), Low = upBar.Low + (i + 10), AskLow = upBar.AskLow + (i + 10), Close = upBar.Close + (i + 10), AskClose = upBar.AskClose + (i + 10), PreviousBar = barlist[i - 1] }); leg.AddBar(barlist[i]); } return(leg); }
public void Adding_UpBar_to_DownLeg_Should_return_False() { Leg downLeg = Helper.GetDownLeg(5); var result = downLeg.AddBar(new FxBar(80, 81, 120, 121, 50, 51, 90, 91, 0, DateTime.Now, DateTime.Now)); Assert.AreEqual(false, result); }
public void Adding_DownBar_to_UpLeg_Should_return_False() { Leg upLeg = Helper.GetUpLeg(5); var result = upLeg.AddBar(new FxBar(7, 8, 10, 11, 0, 1, 5, 6, 0, DateTime.Now, DateTime.Now)); Assert.AreEqual(false, result); }
public void Adding_DownBar_to_DownLeg_Should_Add_Successfully() { Leg downLeg = Helper.GetDownLeg(3); downLeg.AddBar(new FxBar(7, 8, 10, 11, 0, 1, 5, 6, 0, DateTime.Now, DateTime.Now)); Assert.AreEqual(4, downLeg.BarCount); }
public void Adding_UpBar_to_UpLeg_Should_Add_Successfully() { Leg upLeg = Helper.GetUpLeg(3); upLeg.AddBar(new FxBar(80, 81, 120, 121, 50, 51, 90, 91, 0, DateTime.Now, DateTime.Now)); Assert.AreEqual(4, upLeg.BarCount); }