/// <summary> /// filtering results at the end of the current phase /// фильтрация результатов в конце текущей фазы /// </summary> private void EndOfFazeFiltration(OptimazerFazeReport bots, OptimazerFazeReport botsToOutOfSample) { int startCount = bots.Reports.Count; for (int i = 0; i < bots.Reports.Count; i++) { if (_master.IsAcceptedByFilter(bots.Reports[i])) { botsToOutOfSample.Reports.Add(bots.Reports[i]); } } if (botsToOutOfSample.Reports.Count == 0) { /* SendLogMessage(OsLocalization.Optimizer.Message8, LogMessageType.System); * MessageBox.Show(OsLocalization.Optimizer.Message8); * NeadToMoveUiToEvent(NeadToMoveUiTo.TabsAndTimeFrames);*/ } else if (startCount != botsToOutOfSample.Reports.Count) { SendLogMessage(OsLocalization.Optimizer.Message9 + (startCount - botsToOutOfSample.Reports.Count), LogMessageType.System); } }
/// <summary> /// draw a table of results /// прорисовать таблицу результатов /// </summary> private void PaintTableResults() { if (_gridResults == null) { return; } if (_gridResults.InvokeRequired) { _gridResults.Invoke(new Action(PaintTableResults)); return; } _gridResults.SelectionChanged -= _gridResults_SelectionChanged; _gridResults.CellMouseClick -= _gridResults_CellMouseClick; UpdateHeaders(); _gridResults.Rows.Clear(); if (_reports == null) { return; } if (_gridFazesEnd.CurrentCell == null) { return; } int num = 0; num = _gridFazesEnd.CurrentCell.RowIndex; if (num >= _reports.Count) { return; } OptimazerFazeReport fazeReport = _reports[num]; if (fazeReport == null) { return; } for (int i = 0; i < fazeReport.Reports.Count; i++) { OptimizerReport report = fazeReport.Reports[i]; if (report == null || report.TabsReports.Count == 0 || !_master.IsAcceptedByFilter(report)) { continue; } DataGridViewRow row = new DataGridViewRow(); row.Cells.Add(new DataGridViewTextBoxCell()); if (report.TabsReports.Count == 1) { row.Cells[0].Value = report.BotName; } else { row.Cells[0].Value = "Сводные"; } DataGridViewTextBoxCell cell2 = new DataGridViewTextBoxCell(); cell2.Value = report.GetParamsToDataTable(); row.Cells.Add(cell2); DataGridViewTextBoxCell cell3 = new DataGridViewTextBoxCell(); cell3.Value = report.PositionsCount; row.Cells.Add(cell3); DataGridViewTextBoxCell cell4 = new DataGridViewTextBoxCell(); cell4.Value = report.TotalProfit.ToStringWithNoEndZero() + " (" + report.TotalProfitPersent.ToStringWithNoEndZero() + "%)"; row.Cells.Add(cell4); DataGridViewTextBoxCell cell5 = new DataGridViewTextBoxCell(); cell5.Value = report.MaxDrowDawn.ToStringWithNoEndZero(); row.Cells.Add(cell5); DataGridViewTextBoxCell cell6 = new DataGridViewTextBoxCell(); cell6.Value = report.AverageProfit.ToStringWithNoEndZero(); row.Cells.Add(cell6); DataGridViewTextBoxCell cell7 = new DataGridViewTextBoxCell(); cell7.Value = report.AverageProfitPercent.ToStringWithNoEndZero(); row.Cells.Add(cell7); DataGridViewTextBoxCell cell8 = new DataGridViewTextBoxCell(); cell8.Value = report.ProfitFactor.ToStringWithNoEndZero(); row.Cells.Add(cell8); DataGridViewTextBoxCell cell9 = new DataGridViewTextBoxCell(); cell9.Value = report.PayOffRatio.ToStringWithNoEndZero(); row.Cells.Add(cell9); DataGridViewTextBoxCell cell10 = new DataGridViewTextBoxCell(); cell10.Value = report.Recovery.ToStringWithNoEndZero(); row.Cells.Add(cell10); DataGridViewButtonCell cell11 = new DataGridViewButtonCell(); cell11.Value = OsLocalization.Optimizer.Message40; row.Cells.Add(cell11); _gridResults.Rows.Add(row); if (report.TabsReports.Count > 1) { for (int i2 = 0; i2 < report.TabsReports.Count; i2++) { _gridResults.Rows.Add(GetRowResult(report.TabsReports[i2])); } } } _gridResults.SelectionChanged += _gridResults_SelectionChanged; _gridResults.CellMouseClick += _gridResults_CellMouseClick; }