static MtInstrumentChart selectChart(List <MtInstrumentChart> instrumentCharts) { MtInstrumentChart result = null; if (instrumentCharts != null) { Console.WriteLine("Select Chart:"); foreach (var chart in instrumentCharts) { if (chart.Instrument != null) { Console.WriteLine("{0} - {1}", instrumentCharts.IndexOf(chart), chart.Instrument.Symbol); } } string selectedIndexStr = Console.ReadLine(); int selectedIndex = -1; int.TryParse(selectedIndexStr, out selectedIndex); if (selectedIndex >= 0 && selectedIndex < instrumentCharts.Count) { result = instrumentCharts[selectedIndex]; } else { Console.WriteLine("ERROR: Invalid number of Chart!\nPress any key..."); } } return(result); }
public void RemoveInstrumentChart(MtInstrumentChart instrumentChart) { if (instrumentChart != null && mInstrumentCharts.Contains(instrumentChart) == true) { mInstrumentCharts.Remove(instrumentChart); instrumentChart.Stop(); } }
public void AddInstrumentChart(MtInstrumentChart instrumentChart) { if (instrumentChart != null && mInstrumentCharts.Contains(instrumentChart) == false) { mInstrumentCharts.Add(instrumentChart); instrumentChart.Start(); } }
static void addChart(MetaTrader mt) { Console.Clear(); Console.WriteLine("Adding Chart."); var selectedIinstrument = selectInstrument(mt.Instruments); if (selectedIinstrument != null) { var instrumentChart = new MtInstrumentChart(selectedIinstrument); mt.AddInstrumentChart(instrumentChart); } }