From b1ece2225897956f7720ddae7e4b6b30338227be Mon Sep 17 00:00:00 2001 From: jwlee Date: Tue, 16 May 2023 13:16:25 +0900 Subject: [PATCH] =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EB=B3=B4?= =?UTF-8?q?=EB=93=9C=20=EA=B8=B0=EB=8A=A5=20=EC=9E=91=EC=84=B1=20=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HunterSubForm/TestBoardForm.Designer.cs | 124 +++++++++++++++--- Million Hunter/HunterSubForm/TestBoardForm.cs | 92 +++++++++++-- 2 files changed, 184 insertions(+), 32 deletions(-) diff --git a/Million Hunter/HunterSubForm/TestBoardForm.Designer.cs b/Million Hunter/HunterSubForm/TestBoardForm.Designer.cs index f4167a3..f01094d 100644 --- a/Million Hunter/HunterSubForm/TestBoardForm.Designer.cs +++ b/Million Hunter/HunterSubForm/TestBoardForm.Designer.cs @@ -32,6 +32,12 @@ 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.textEdit_종가시간판매 = new DevExpress.XtraEditors.TextEdit(); + this.checkEdit_종가시간판매 = new DevExpress.XtraEditors.CheckEdit(); + this.textEdit1 = new DevExpress.XtraEditors.TextEdit(); + this.textEdit_종목보유수별수익률계산 = new DevExpress.XtraEditors.TextEdit(); + this.checkEdit1 = new DevExpress.XtraEditors.CheckEdit(); + this.checkEdit_종목보유수별수익률계산 = new DevExpress.XtraEditors.CheckEdit(); this.checkEdit_구매전봉기준가중이동평균5봉이40봉크로스이후구매 = new DevExpress.XtraEditors.CheckEdit(); this.checkEdit_구름떼상한선하락시판매 = new DevExpress.XtraEditors.CheckEdit(); this.checkEdit_구매이전봉볼린저40_1이하 = new DevExpress.XtraEditors.CheckEdit(); @@ -40,17 +46,23 @@ namespace Million_Hunter.HunterSubForm this.simpleButton_Reset = new DevExpress.XtraEditors.SimpleButton(); this.progressBar1 = new System.Windows.Forms.ProgressBar(); this.simpleButton_찬 = new DevExpress.XtraEditors.SimpleButton(); - this.checkEdit_종목보유수별수익률계산 = new DevExpress.XtraEditors.CheckEdit(); - this.textEdit_종목보유수별수익률계산 = new DevExpress.XtraEditors.TextEdit(); + this.checkEdit_시가구름떼위에서시작 = new DevExpress.XtraEditors.CheckEdit(); + this.checkEdit_시가가볼린저401보다작음 = new DevExpress.XtraEditors.CheckEdit(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.textEdit_종가시간판매.Properties)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.checkEdit_종가시간판매.Properties)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.textEdit1.Properties)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.textEdit_종목보유수별수익률계산.Properties)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.checkEdit1.Properties)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.checkEdit_종목보유수별수익률계산.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.checkEdit_구매전봉기준가중이동평균5봉이40봉크로스이후구매.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.checkEdit_구름떼상한선하락시판매.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.checkEdit_구매이전봉볼린저40_1이하.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.checkEdit_이전봉40_2볼린저이하.Properties)).BeginInit(); this.groupBox3.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.checkEdit_종목보유수별수익률계산.Properties)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.textEdit_종목보유수별수익률계산.Properties)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.checkEdit_시가구름떼위에서시작.Properties)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.checkEdit_시가가볼린저401보다작음.Properties)).BeginInit(); this.SuspendLayout(); // // simpleButton_FullInsertCandle @@ -76,7 +88,13 @@ namespace Million_Hunter.HunterSubForm // // groupBox2 // + this.groupBox2.Controls.Add(this.checkEdit_시가가볼린저401보다작음); + this.groupBox2.Controls.Add(this.checkEdit_시가구름떼위에서시작); + this.groupBox2.Controls.Add(this.textEdit_종가시간판매); + this.groupBox2.Controls.Add(this.checkEdit_종가시간판매); + this.groupBox2.Controls.Add(this.textEdit1); this.groupBox2.Controls.Add(this.textEdit_종목보유수별수익률계산); + this.groupBox2.Controls.Add(this.checkEdit1); this.groupBox2.Controls.Add(this.checkEdit_종목보유수별수익률계산); this.groupBox2.Controls.Add(this.checkEdit_구매전봉기준가중이동평균5봉이40봉크로스이후구매); this.groupBox2.Controls.Add(this.checkEdit_구름떼상한선하락시판매); @@ -84,11 +102,64 @@ namespace Million_Hunter.HunterSubForm 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, 123); + this.groupBox2.Size = new System.Drawing.Size(829, 151); this.groupBox2.TabIndex = 3; this.groupBox2.TabStop = false; this.groupBox2.Text = "지표"; // + // textEdit_종가시간판매 + // + this.textEdit_종가시간판매.EditValue = "0"; + this.textEdit_종가시간판매.Location = new System.Drawing.Point(660, 20); + this.textEdit_종가시간판매.Name = "textEdit_종가시간판매"; + this.textEdit_종가시간판매.Properties.Mask.EditMask = "d"; + this.textEdit_종가시간판매.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; + this.textEdit_종가시간판매.Size = new System.Drawing.Size(42, 20); + this.textEdit_종가시간판매.TabIndex = 6; + // + // checkEdit_종가시간판매 + // + this.checkEdit_종가시간판매.Location = new System.Drawing.Point(564, 21); + this.checkEdit_종가시간판매.Name = "checkEdit_종가시간판매"; + this.checkEdit_종가시간판매.Properties.Caption = "종가(시간)판매"; + this.checkEdit_종가시간판매.Size = new System.Drawing.Size(150, 19); + this.checkEdit_종가시간판매.TabIndex = 5; + this.checkEdit_종가시간판매.CheckedChanged += new System.EventHandler(this.checkEdit_common_CheckedChanged); + // + // textEdit1 + // + this.textEdit1.EditValue = "1"; + this.textEdit1.Location = new System.Drawing.Point(298, 72); + this.textEdit1.Name = "textEdit1"; + this.textEdit1.Size = new System.Drawing.Size(42, 20); + this.textEdit1.TabIndex = 4; + // + // textEdit_종목보유수별수익률계산 + // + this.textEdit_종목보유수별수익률계산.EditValue = "1"; + this.textEdit_종목보유수별수익률계산.Location = new System.Drawing.Point(175, 72); + this.textEdit_종목보유수별수익률계산.Name = "textEdit_종목보유수별수익률계산"; + this.textEdit_종목보유수별수익률계산.Size = new System.Drawing.Size(42, 20); + this.textEdit_종목보유수별수익률계산.TabIndex = 4; + // + // checkEdit1 + // + this.checkEdit1.Location = new System.Drawing.Point(233, 73); + this.checkEdit1.Name = "checkEdit1"; + this.checkEdit1.Properties.Caption = "거래대금"; + this.checkEdit1.Size = new System.Drawing.Size(150, 19); + this.checkEdit1.TabIndex = 3; + this.checkEdit1.CheckedChanged += new System.EventHandler(this.checkEdit_common_CheckedChanged); + // + // checkEdit_종목보유수별수익률계산 + // + this.checkEdit_종목보유수별수익률계산.Location = new System.Drawing.Point(19, 72); + this.checkEdit_종목보유수별수익률계산.Name = "checkEdit_종목보유수별수익률계산"; + this.checkEdit_종목보유수별수익률계산.Properties.Caption = "종목 보유수 별 수익률 계산"; + this.checkEdit_종목보유수별수익률계산.Size = new System.Drawing.Size(150, 19); + this.checkEdit_종목보유수별수익률계산.TabIndex = 3; + this.checkEdit_종목보유수별수익률계산.CheckedChanged += new System.EventHandler(this.checkEdit_common_CheckedChanged); + // // checkEdit_구매전봉기준가중이동평균5봉이40봉크로스이후구매 // this.checkEdit_구매전봉기준가중이동평균5봉이40봉크로스이후구매.Location = new System.Drawing.Point(19, 47); @@ -161,22 +232,23 @@ namespace Million_Hunter.HunterSubForm this.simpleButton_찬.Text = "찬테스트"; this.simpleButton_찬.Click += new System.EventHandler(this.simpleButton_찬_Click); // - // checkEdit_종목보유수별수익률계산 + // checkEdit_시가구름떼위에서시작 // - this.checkEdit_종목보유수별수익률계산.Location = new System.Drawing.Point(19, 72); - this.checkEdit_종목보유수별수익률계산.Name = "checkEdit_종목보유수별수익률계산"; - this.checkEdit_종목보유수별수익률계산.Properties.Caption = "종목 보유수 별 수익률 계산"; - this.checkEdit_종목보유수별수익률계산.Size = new System.Drawing.Size(310, 19); - this.checkEdit_종목보유수별수익률계산.TabIndex = 3; - this.checkEdit_종목보유수별수익률계산.CheckedChanged += new System.EventHandler(this.checkEdit_common_CheckedChanged); + this.checkEdit_시가구름떼위에서시작.Location = new System.Drawing.Point(19, 97); + this.checkEdit_시가구름떼위에서시작.Name = "checkEdit_시가구름떼위에서시작"; + this.checkEdit_시가구름떼위에서시작.Properties.Caption = "시가 구름떼 위에서 시작"; + this.checkEdit_시가구름떼위에서시작.Size = new System.Drawing.Size(150, 19); + this.checkEdit_시가구름떼위에서시작.TabIndex = 7; + this.checkEdit_시가구름떼위에서시작.CheckedChanged += new System.EventHandler(this.checkEdit_common_CheckedChanged); // - // textEdit_종목보유수별수익률계산 + // checkEdit_시가가볼린저401보다작음 // - this.textEdit_종목보유수별수익률계산.EditValue = "1"; - this.textEdit_종목보유수별수익률계산.Location = new System.Drawing.Point(175, 72); - this.textEdit_종목보유수별수익률계산.Name = "textEdit_종목보유수별수익률계산"; - this.textEdit_종목보유수별수익률계산.Size = new System.Drawing.Size(42, 20); - this.textEdit_종목보유수별수익률계산.TabIndex = 4; + this.checkEdit_시가가볼린저401보다작음.Location = new System.Drawing.Point(164, 97); + this.checkEdit_시가가볼린저401보다작음.Name = "checkEdit_시가가볼린저401보다작음"; + this.checkEdit_시가가볼린저401보다작음.Properties.Caption = "시가가 볼린저 40 1 보다 작음"; + this.checkEdit_시가가볼린저401보다작음.Size = new System.Drawing.Size(150, 19); + this.checkEdit_시가가볼린저401보다작음.TabIndex = 8; + this.checkEdit_시가가볼린저401보다작음.CheckedChanged += new System.EventHandler(this.checkEdit_common_CheckedChanged); // // TestBoardForm // @@ -192,13 +264,19 @@ namespace Million_Hunter.HunterSubForm this.Text = "TestBoard"; this.groupBox1.ResumeLayout(false); this.groupBox2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.textEdit_종가시간판매.Properties)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.checkEdit_종가시간판매.Properties)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.textEdit1.Properties)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.textEdit_종목보유수별수익률계산.Properties)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.checkEdit1.Properties)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.checkEdit_종목보유수별수익률계산.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.checkEdit_구매전봉기준가중이동평균5봉이40봉크로스이후구매.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.checkEdit_구름떼상한선하락시판매.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.checkEdit_구매이전봉볼린저40_1이하.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.checkEdit_이전봉40_2볼린저이하.Properties)).EndInit(); this.groupBox3.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.checkEdit_종목보유수별수익률계산.Properties)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.textEdit_종목보유수별수익률계산.Properties)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.checkEdit_시가구름떼위에서시작.Properties)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.checkEdit_시가가볼린저401보다작음.Properties)).EndInit(); this.ResumeLayout(false); } @@ -219,5 +297,11 @@ namespace Million_Hunter.HunterSubForm private DevExpress.XtraEditors.CheckEdit checkEdit_구름떼상한선하락시판매; private DevExpress.XtraEditors.TextEdit textEdit_종목보유수별수익률계산; private DevExpress.XtraEditors.CheckEdit checkEdit_종목보유수별수익률계산; + private DevExpress.XtraEditors.TextEdit textEdit_종가시간판매; + private DevExpress.XtraEditors.CheckEdit checkEdit_종가시간판매; + private DevExpress.XtraEditors.TextEdit textEdit1; + private DevExpress.XtraEditors.CheckEdit checkEdit1; + private DevExpress.XtraEditors.CheckEdit checkEdit_시가구름떼위에서시작; + private DevExpress.XtraEditors.CheckEdit checkEdit_시가가볼린저401보다작음; } } \ No newline at end of file diff --git a/Million Hunter/HunterSubForm/TestBoardForm.cs b/Million Hunter/HunterSubForm/TestBoardForm.cs index 3bb244d..3d50efa 100644 --- a/Million Hunter/HunterSubForm/TestBoardForm.cs +++ b/Million Hunter/HunterSubForm/TestBoardForm.cs @@ -441,19 +441,87 @@ namespace Million_Hunter.HunterSubForm } } - - if (checkEdit_종목보유수별수익률계산.Checked) - { - var coinCount = Convert.ToInt32(textEdit_종목보유수별수익률계산.Text); - - //inCount = - - - } - - parentForm.CalcurateProfitAndWinRate(); - parentForm.treeList_ResultData.RefreshDataSource(); } + + + if (checkEdit_종목보유수별수익률계산.Checked) + { + var coinCount = Convert.ToInt32(textEdit_종목보유수별수익률계산.Text); + //r Con + //inCount = + + + } + // 종가 판매 + if (checkEdit_종가시간판매.Checked) + { + // 종가 판매 봉기준 + var candleInterval = Convert.ToInt32(textEdit_종가시간판매.Text); + + foreach (var analysisData in parentForm._analysisDatas) + { + var startDate = changeDatetimeFormat(analysisData.StartDate, 0); + var endDate = changeDatetimeFormat(analysisData.EndDate, 0); + var 종가판매기준시간 = changeDatetimeFormat(startDate, candleInterval); + + if (analysisData.Inclusion) + { + if (changeDatetimeFormat(endDate, 0) > 종가판매기준시간) + { + var data = analysisData.CandleDatas.First().Value.Find(item => item.DateTime == 종가판매기준시간); + if(data == null) + { + var date = new DateTime(); + date = 종가판매기준시간; + while (data == null) + { + date = changeDatetimeFormat(date, -1); + data = analysisData.CandleDatas.First().Value.Find(item => item.DateTime == date); + + } + } + + // 수익률 구하기 + analysisData.EarningRate = (-100 + (data.EndValue / analysisData.BuyValue) * 100); + + + analysisData.WinFlag = analysisData.EarningRate > 0 ? true : false; + analysisData.SellValue = data.EndValue; + } + } + + continue; + } + } + + if(checkEdit_시가구름떼위에서시작.Checked) + { + foreach (var analysisData in parentForm._analysisDatas) + { + var startDate = changeDatetimeFormat(analysisData.StartDate, 0); + var data = analysisData.CandleDatas.First().Value.Find(item => item.DateTime == startDate); + + var maxich = Math.Max(((IchimokData)data.IndicatorDic["Ich2695226"]).value, ((IchimokData)data.IndicatorDic["Ich2695226"]).value2); + + if (analysisData.Inclusion) + if (maxich >= data.StartValue) analysisData.Inclusion = false; + } + } + + if (checkEdit_시가가볼린저401보다작음.Checked) + { + foreach (var analysisData in parentForm._analysisDatas) + { + var startDate = changeDatetimeFormat(analysisData.StartDate, 0); + var data = analysisData.CandleDatas.First().Value.Find(item => item.DateTime == startDate); + + if (analysisData.Inclusion) + if (data.IndicatorDic["Bol401"].value <= data.StartValue) analysisData.Inclusion = false; + } + } + + parentForm.CalcurateProfitAndWinRate(); + parentForm.treeList_ResultData.RefreshDataSource(); }