결과 폼 필터 구현

This commit is contained in:
jwlee
2023-05-09 17:33:06 +09:00
parent 5e0832a7cc
commit 94ddacf08a
4 changed files with 235 additions and 42 deletions

View File

@@ -750,7 +750,6 @@ namespace Million.HunterSubForm
#endregion
private DevExpress.XtraEditors.PanelControl panelControl_IndicatorCondition;
private DevExpress.XtraTreeList.TreeList treeList_ResultData;
private System.Windows.Forms.GroupBox groupBox_;
private System.Windows.Forms.SplitContainer splitContainer_SetupPanel;
private System.Windows.Forms.GroupBox groupBox3;
@@ -796,5 +795,6 @@ namespace Million.HunterSubForm
private DevExpress.XtraEditors.LabelControl labelControl_WinRateProfitRate;
private DevExpress.XtraEditors.SimpleButton simpleButton_WinRateProfitRate;
public DevExpress.XtraEditors.SimpleButton simpleButton_TestBoard;
public DevExpress.XtraTreeList.TreeList treeList_ResultData;
}
}

View File

@@ -219,7 +219,7 @@ namespace Million.HunterSubForm
/// <summary>
/// 승률 및 수익률 계산 함수
/// </summary>
private void CalcurateProfitAndWinRate()
public void CalcurateProfitAndWinRate()
{
// 승률 수익률 계산하기
// 결과 반영 체크 && Filter 된 노드만 리스트로 모음

View File

@@ -32,10 +32,15 @@ namespace Million_Hunter.HunterSubForm
this.simpleButton_FullInsertCandle = new DevExpress.XtraEditors.SimpleButton();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.simpleButton_Calc = new DevExpress.XtraEditors.SimpleButton();
this.checkedListBox_Indicator = new System.Windows.Forms.CheckedListBox();
this.checkEdit_구매이전봉볼린저40_1이하 = new DevExpress.XtraEditors.CheckEdit();
this.checkEdit_이전봉40_2볼린저이하 = new DevExpress.XtraEditors.CheckEdit();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.simpleButton_Reset = new DevExpress.XtraEditors.SimpleButton();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.checkEdit_구매이전봉볼린저40_1이하.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkEdit_이전봉40_2볼린저이하.Properties)).BeginInit();
this.groupBox3.SuspendLayout();
this.SuspendLayout();
//
// simpleButton_FullInsertCandle
@@ -54,55 +59,76 @@ namespace Million_Hunter.HunterSubForm
this.groupBox1.Controls.Add(this.simpleButton_FullInsertCandle);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(419, 63);
this.groupBox1.Size = new System.Drawing.Size(154, 63);
this.groupBox1.TabIndex = 2;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "데이터 채우기";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.checkedListBox_Indicator);
this.groupBox2.Controls.Add(this.checkEdit_구매이전봉볼린저40_1이하);
this.groupBox2.Controls.Add(this.checkEdit_이전봉40_2볼린저이하);
this.groupBox2.Location = new System.Drawing.Point(12, 90);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(829, 129);
this.groupBox2.Size = new System.Drawing.Size(829, 123);
this.groupBox2.TabIndex = 3;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "지표";
//
// simpleButton_Calc
// checkEdit_구매이전봉볼린저40_1이하
//
this.simpleButton_Calc.Appearance.ForeColor = System.Drawing.Color.Teal;
this.simpleButton_Calc.Appearance.Options.UseForeColor = true;
this.simpleButton_Calc.Location = new System.Drawing.Point(720, 225);
this.simpleButton_Calc.Name = "simpleButton_Calc";
this.simpleButton_Calc.Size = new System.Drawing.Size(121, 32);
this.simpleButton_Calc.TabIndex = 1;
this.simpleButton_Calc.Text = "계산하기";
this.simpleButton_Calc.Click += new System.EventHandler(this.simpleButton_Calc_Click);
this.checkEdit_구매이전봉볼린저40_1이하.Location = new System.Drawing.Point(204, 22);
this.checkEdit_구매이전봉볼린저40_1이하.Name = "checkEdit_구매이전봉볼린저40_1이하";
this.checkEdit_구매이전봉볼린저40_1이하.Properties.Caption = "구매 이전 봉 볼린저 40_1 이하";
this.checkEdit_구매이전봉볼린저40_1이하.Size = new System.Drawing.Size(179, 19);
this.checkEdit_구매이전봉볼린저40_1이하.TabIndex = 1;
this.checkEdit_구매이전봉볼린저40_1이하.CheckedChanged += new System.EventHandler(this.checkEdit_common_CheckedChanged);
//
// checkedListBox_Indicator
// checkEdit_이전봉40_2볼린저이하
//
this.checkedListBox_Indicator.Dock = System.Windows.Forms.DockStyle.Fill;
this.checkedListBox_Indicator.FormattingEnabled = true;
this.checkedListBox_Indicator.Items.AddRange(new object[] {
"구매 시점 이전 봉 40 1 볼린저 값 이하"});
this.checkedListBox_Indicator.Location = new System.Drawing.Point(3, 18);
this.checkedListBox_Indicator.Name = "checkedListBox_Indicator";
this.checkedListBox_Indicator.Size = new System.Drawing.Size(823, 108);
this.checkedListBox_Indicator.TabIndex = 0;
this.checkEdit_이전봉40_2볼린저이하.Location = new System.Drawing.Point(19, 22);
this.checkEdit_이전봉40_2볼린저이하.Name = "checkEdit_이전봉40_2볼린저이하";
this.checkEdit_이전봉40_2볼린저이하.Properties.Caption = "구매 이전 봉 40_2 볼린저 이하";
this.checkEdit_이전봉40_2볼린저이하.Size = new System.Drawing.Size(179, 19);
this.checkEdit_이전봉40_2볼린저이하.TabIndex = 0;
this.checkEdit_이전봉40_2볼린저이하.CheckedChanged += new System.EventHandler(this.checkEdit_common_CheckedChanged);
//
// groupBox3
//
this.groupBox3.Controls.Add(this.simpleButton_Reset);
this.groupBox3.Location = new System.Drawing.Point(187, 12);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(154, 63);
this.groupBox3.TabIndex = 4;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "데이터 채우기";
//
// simpleButton_Reset
//
this.simpleButton_Reset.Appearance.ForeColor = System.Drawing.Color.SteelBlue;
this.simpleButton_Reset.Appearance.Options.UseForeColor = true;
this.simpleButton_Reset.Location = new System.Drawing.Point(6, 21);
this.simpleButton_Reset.Name = "simpleButton_Reset";
this.simpleButton_Reset.Size = new System.Drawing.Size(121, 32);
this.simpleButton_Reset.TabIndex = 1;
this.simpleButton_Reset.Text = "필터 초기화";
this.simpleButton_Reset.Click += new System.EventHandler(this.simpleButton_Reset_Click);
//
// TestBoardForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(853, 297);
this.Controls.Add(this.simpleButton_Calc);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Name = "TestBoardForm";
this.Text = "TestBoard";
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.checkEdit_구매이전봉볼린저40_1이하.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkEdit_이전봉40_2볼린저이하.Properties)).EndInit();
this.groupBox3.ResumeLayout(false);
this.ResumeLayout(false);
}
@@ -112,7 +138,9 @@ namespace Million_Hunter.HunterSubForm
private DevExpress.XtraEditors.SimpleButton simpleButton_FullInsertCandle;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.CheckedListBox checkedListBox_Indicator;
private DevExpress.XtraEditors.SimpleButton simpleButton_Calc;
private DevExpress.XtraEditors.CheckEdit checkEdit_이전봉40_2볼린저이하;
private System.Windows.Forms.GroupBox groupBox3;
private DevExpress.XtraEditors.SimpleButton simpleButton_Reset;
private DevExpress.XtraEditors.CheckEdit checkEdit_구매이전봉볼린저40_1이하;
}
}

View File

@@ -24,6 +24,8 @@ namespace Million_Hunter.HunterSubForm
CommonProperty.MCandleTimeType MCandleTimeType;
bool ignoreChangedfilter = false;
public TestBoardForm(ResultViewerForm resultViewerForm)
{
InitializeComponent();
@@ -137,34 +139,197 @@ namespace Million_Hunter.HunterSubForm
}
/// <summary>
/// 추가 조건 계산하기
/// 데이터 초기화
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void simpleButton_Calc_Click(object sender, EventArgs e)
private void simpleButton_Reset_Click(object sender, EventArgs e)
{
resetFilter();
ignoreChangedfilter = true;
checkEdit_구매이전봉볼린저40_1이하.Checked = false;
checkEdit_이전봉40_2볼린저이하.Checked = false;
ignoreChangedfilter = false;
parentForm.treeList_ResultData.RefreshDataSource();
parentForm.CalcurateProfitAndWinRate();
}
public void resetFilter()
{
// 구매 시점 이전 봉 40 1 볼린저 값 이하
foreach (var analysisData in parentForm._analysisDatas)
{
var startDate = analysisData.StartDate;
var endDate = analysisData.EndDate;
analysisData.Inclusion = true;
analysisData.Description = "";
}
var 구매이전봉 = startDate;
//차트 Date Time 설정하기
var StartDateInterval = -1;
}
var candleData = analysisData.CandleDatas[MCandleTimeType].Find(item => item.DateTime == 구매이전봉);
var highValue = candleData.HighValue;
var bol402 = candleData.IndicatorDic["Bol402"]?.value ;
public void calcurateFilter()
{
if(bol402 != null)
// 필터 초기화
resetFilter();
// 이전봉40_2볼린저이하
if (checkEdit_이전봉40_2볼린저이하.Checked)
{
// 구매 시점 이전 봉 40 1 볼린저 값 이하
foreach (var analysisData in parentForm._analysisDatas)
{
if (highValue < bol402) analysisData.Inclusion = true;
else analysisData.Inclusion = false;
}
var startDate = analysisData.StartDate;
var endDate = analysisData.EndDate;
if (checkEdit_이전봉40_2볼린저이하.Checked)
{
var 구매이전봉 = startDate;
//차트 Date Time 설정하기
var StartDateInterval = 1;
switch (MCandleTimeType)
{
case CommonProperty.MCandleTimeType.H1:
구매이전봉 = Convert.ToDateTime(startDate.ToString("yyyy-MM-dd HH:00")) - new TimeSpan(0, StartDateInterval, 0, 0);
break;
case CommonProperty.MCandleTimeType.H4:
구매이전봉 = Convert.ToDateTime(startDate.ToString("yyyy-MM-dd HH:00")) - new TimeSpan(0, StartDateInterval * 4, 0, 0);
break;
case CommonProperty.MCandleTimeType.M1:
break;
case CommonProperty.MCandleTimeType.M10:
case CommonProperty.MCandleTimeType.M15:
case CommonProperty.MCandleTimeType.M3:
case CommonProperty.MCandleTimeType.M30:
case CommonProperty.MCandleTimeType.M5:
break;
case CommonProperty.MCandleTimeType.D1:
구매이전봉 = Convert.ToDateTime(endDate.ToString("yyyy-MM-dd")) - new TimeSpan(StartDateInterval, 0, 0, 0);
break;
}
var candleData = analysisData.CandleDatas[MCandleTimeType].Find(item => item.DateTime == 구매이전봉);
// 시간대 캔들이 없으면 결과에서 제외
if (candleData == null)
{
analysisData.Description = "[오류:캔들없음]" + analysisData.Description;
analysisData.Inclusion = false;
continue;
}
var highValue = candleData.HighValue;
var bol402 = candleData.IndicatorDic["Bol402"]?.value;
if (bol402 != null)
{
// 제외된 조건인 아닌 경우
if (analysisData.Inclusion)
{
if (highValue < bol402)
{
analysisData.Inclusion = true;
analysisData.Description = '[' + checkEdit_이전봉40_2볼린저이하.Text + ']' + analysisData.Description;
}
else
analysisData.Inclusion = false;
}
}
}
}
}
// 이전봉40_1볼린저이하
if (checkEdit_구매이전봉볼린저40_1이하.Checked)
{
// 구매 시점 이전 봉 40 1 볼린저 값 이하
foreach (var analysisData in parentForm._analysisDatas)
{
var startDate = analysisData.StartDate;
var endDate = analysisData.EndDate;
if (checkEdit_구매이전봉볼린저40_1이하.Checked)
{
var 구매이전봉 = startDate;
//차트 Date Time 설정하기
var StartDateInterval = 1;
switch (MCandleTimeType)
{
case CommonProperty.MCandleTimeType.H1:
구매이전봉 = Convert.ToDateTime(startDate.ToString("yyyy-MM-dd HH:00")) - new TimeSpan(0, StartDateInterval, 0, 0);
break;
case CommonProperty.MCandleTimeType.H4:
구매이전봉 = Convert.ToDateTime(startDate.ToString("yyyy-MM-dd HH:00")) - new TimeSpan(0, StartDateInterval * 4, 0, 0);
break;
case CommonProperty.MCandleTimeType.M1:
break;
case CommonProperty.MCandleTimeType.M10:
case CommonProperty.MCandleTimeType.M15:
case CommonProperty.MCandleTimeType.M3:
case CommonProperty.MCandleTimeType.M30:
case CommonProperty.MCandleTimeType.M5:
break;
case CommonProperty.MCandleTimeType.D1:
구매이전봉 = Convert.ToDateTime(endDate.ToString("yyyy-MM-dd")) - new TimeSpan(StartDateInterval, 0, 0, 0);
break;
}
var candleData = analysisData.CandleDatas[MCandleTimeType].Find(item => item.DateTime == 구매이전봉);
// 시간대 캔들이 없으면 결과에서 제외
if (candleData == null)
{
analysisData.Description = "[오류:캔들없음]" + analysisData.Description;
analysisData.Inclusion = false;
continue;
}
var highValue = candleData.HighValue;
var bol401 = candleData.IndicatorDic["Bol401"]?.value;
if (bol401 != null)
{
// 제외된 조건인 아닌 경우
if (analysisData.Inclusion)
{
if (highValue < bol401)
{
analysisData.Inclusion = true;
analysisData.Description = '[' + checkEdit_이전봉40_2볼린저이하.Text + ']' + analysisData.Description;
}
else
analysisData.Inclusion = false;
}
}
}
}
}
parentForm.treeList_ResultData.RefreshDataSource();
parentForm.CalcurateProfitAndWinRate();
}
/// <summary>
/// 이전봉40_2볼린저이하
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void checkEdit_common_CheckedChanged(object sender, EventArgs e)
{
if(!ignoreChangedfilter)
{
calcurateFilter();
}
}