private void btnCombineWeights_Click(object sender, EventArgs e) { if (checkedListBox2.CheckedItems.Count == 0) return; List<WtsWrapper> list = new List<WtsWrapper>(); for (int i = 0; i < checkedListBox2.CheckedIndices.Count; ++i) list.Add((WtsWrapper)checkedListBox2.Items[i]); Construct latestdateConstruct = null; for (int i = 0; i < list.Count; ++i) if (latestdateConstruct == null || (latestdateConstruct.Dates[0] < list[i].Weights.Dates[0])) latestdateConstruct = list[i].Weights; Construct combined = new Construct(latestdateConstruct.ArrayLength); combined.InitialiseToValue(latestdateConstruct.Dates, 0.0); foreach (DateTime date in latestdateConstruct.Dates) for (int i = 0; i < latestdateConstruct.ArrayLength; ++i) for (int j = 0; j < list.Count; ++j) combined.AddValue(date, i, list[j].Weights.GetValue(date, i)); ReturnsEval.DataSeriesEvaluator eval = list[0].Trader.DoPnl(list[0].Args, combined); ReturnsEvalDisplay.ReturnsDisplay rd = new FX.ReturnsEvalDisplay.ReturnsDisplay(); rd.Bind(eval); FX.Controls.ShowForm.Show(rd, FormBorderStyle.Sizable, null, "Combined weights"); }