private void toolStripButtonShowEntryData_Click(object sender, EventArgs e) { if (listViewProviderEntries.SelectedItems.Count == 0) { return; } if (listViewProviderEntries.SelectedItems.Count > 1) { MessageBox.Show("Select only one entry to show its data.", "Note", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } DataStoreEntry entry = (DataStoreEntry)listViewProviderEntries.SelectedItems[0].Tag; if (entry.Period.HasValue == false || entry.DataType != DataStoreEntry.EntryDataTypeEnum.DataBar) { return; } DataReaderWriter<DataBar> readerWriter = entry.GetDataBarReaderWriter(); if (readerWriter == null) { MessageBox.Show("Failed to read entry file.", "Open Forex Platform", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } List<DataBar> barData = readerWriter.Read(); RawDataTradeChartSeries series = new RawDataTradeChartSeries(entry.Symbol.Name); series.Initialize(barData, entry.Period.Value); ChartForm form = new ChartForm("Entry [" + entry.Symbol.Name + "," + entry.Period.ToString() + "] Data"); form.Chart.MasterPane.Add(series); form.Chart.MasterPane.FitDrawingSpaceToScreen(true, true); form.Show(this.ParentForm); }
private void buttonShowDistribution_Click(object sender, EventArgs e) { ChartForm form = new ChartForm("Distribution of results"); form.Show(); Dictionary<double, double> distributedResults = MathHelper.CalculateValueDistribution(_results[listBoxResults.SelectedIndex], 256); double[] distributedValues = GeneralHelper.EnumerableToArray(distributedResults.Values); double[] distributedValuesMA = MathHelper.CalculateQuickMA(distributedValues, 12); form.Chart.MasterPane.Add(new LinesChartSeries("Value distribution", LinesChartSeries.ChartTypeEnum.Histogram, GeneralHelper.DoublesToFloats(distributedValues)), true, false); form.Chart.MasterPane.Add(new LinesChartSeries("Value distribution MA 12", LinesChartSeries.ChartTypeEnum.Line, GeneralHelper.DoublesToFloats(distributedValuesMA)), true, false); }