static void ProcessStock(List<int> StockHistory) { var stockDelta = new StockDelta(StockHistory); Console.ForegroundColor = ConsoleColor.White; for (int i = 0; i < StockHistory.Count - 1; i++) { //TODO : Check profit before changing Utils.WriteChart(i, StockHistory[i], StockHistory[i + 1]); if (StockHistory[i] < stockDelta.start.value) { stockDelta = new StockDelta(i, StockHistory[i]); } if (StockHistory[i] > stockDelta.end.value) { stockDelta.end.position = i; stockDelta.end.value = StockHistory[i]; } } Utils.WriteResult(stockDelta); }
static void ProcessStock(List <int> StockHistory) { var stockDelta = new StockDelta(StockHistory); Console.ForegroundColor = ConsoleColor.White; for (int i = 0; i < StockHistory.Count - 1; i++) { //TODO : Check profit before changing Utils.WriteChart(i, StockHistory[i], StockHistory[i + 1]); if (StockHistory[i] < stockDelta.start.value) { stockDelta = new StockDelta(i, StockHistory[i]); } if (StockHistory[i] > stockDelta.end.value) { stockDelta.end.position = i; stockDelta.end.value = StockHistory[i]; } } Utils.WriteResult(stockDelta); }
public static void WriteResult(StockDelta stockDelta) { Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.Green; Console.CursorTop = 21 - stockDelta.start.value; for (int i = stockDelta.start.position; i <= stockDelta.end.position; i++) { Console.CursorLeft = i; Console.CursorTop = 21 - stockDelta.start.value; Console.Write((char)9604); Console.CursorLeft = i; Console.CursorTop = 19 - stockDelta.end.value; Console.Write((char)9600); } Console.ForegroundColor = ConsoleColor.White; Console.CursorTop = 18; Console.CursorLeft = 0; Console.WriteLine(" Result"); Console.WriteLine(stockDelta.ToString()); Console.ReadLine(); Console.Clear(); }