public void dataBindCat() { CategoryController categoryController = new CategoryController(); List <CategoryDto> list = new List <CategoryDto>(); Month1[] cats = { }; string user_id = "7fa65ff0-4a3e-4cc5-b975-fae5c16b385e"; list = categoryController.get_cats_by_userid(user_id); if (list.Count() > 0) { cats = new Month1[list.Count()]; cats_fortest = new Month1[list.Count()]; int i = 0; foreach (var cat in list) { cats[i] = new Month1(cat.categoryId, cat.category, cat.type); cats_fortest[i] = new Month1(cat.categoryId, cat.category, cat.type); i++; } } comboBox1.DataSource = cats; comboBox1.ValueMember = "id"; comboBox1.DisplayMember = "name"; }
public void StepSecond() { if (Second1.FutureCount == 0) { throw new Exception("No future to step to"); } PriceCandle candle = Second1.GetFuture(0); // Close orders List <TradingOrder> ClosingOrders = CheckOrderLimits(OpenOrders, candle); foreach (TradingOrder closed_order in ClosingOrders) { this.OpenOrders.Remove(closed_order.OrderTicket); this.ClosedOrders.Add(closed_order); this.Cash += closed_order.Profit; } // Compute equity this.Equity = Cash; foreach (TradingOrder open_order in OpenOrders.Values) { Equity += open_order.ComputeValue(Prices.GetHistory(0)); } Prices.Step(); Second1.Step(); if ((0 < Minute1.FutureCount) && (Prices.GetHistory(0).Time == Minute1.GetFuture(0).CloseTime)) { Minute1.Step(); } else { // if it is not the end of a minute the others also do not nee to step return; } if ((0 < Minute15.FutureCount) && (Prices.GetHistory(0).Time == Minute15.GetFuture(0).CloseTime)) { Minute15.Step(); } if ((0 < Minute30.FutureCount) && (Prices.GetHistory(0).Time == Minute30.GetFuture(0).CloseTime)) { Minute30.Step(); } if ((0 < Hour1.FutureCount) && (Prices.GetHistory(0).Time == Hour1.GetFuture(0).CloseTime)) { Hour1.Step(); } if ((0 < Hour4.FutureCount) && (Prices.GetHistory(0).Time == Hour4.GetFuture(0).CloseTime)) { Hour4.Step(); } if ((0 < Day1.FutureCount) && (Prices.GetHistory(0).Time == Day1.GetFuture(0).CloseTime)) { Day1.Step(); } if ((0 < Week1.FutureCount) && (Prices.GetHistory(0).Time == Week1.GetFuture(0).CloseTime)) { Week1.Step(); } if ((0 < Month1.FutureCount) && (Prices.GetHistory(0).Time == Month1.GetFuture(0).CloseTime)) { Month1.Step(); } }