테스트 보드 수정
This commit is contained in:
@@ -38,11 +38,15 @@ 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.checkEdit_구매전봉기준가중이동평균5봉이40봉크로스이후구매 = new DevExpress.XtraEditors.CheckEdit();
|
||||
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();
|
||||
((System.ComponentModel.ISupportInitialize)(this.checkEdit_구름떼상한선하락시판매.Properties)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.checkEdit_구매전봉기준가중이동평균5봉이40봉크로스이후구매.Properties)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// simpleButton_FullInsertCandle
|
||||
@@ -68,6 +72,8 @@ namespace Million_Hunter.HunterSubForm
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Controls.Add(this.checkEdit_구매전봉기준가중이동평균5봉이40봉크로스이후구매);
|
||||
this.groupBox2.Controls.Add(this.checkEdit_구름떼상한선하락시판매);
|
||||
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);
|
||||
@@ -103,14 +109,15 @@ namespace Million_Hunter.HunterSubForm
|
||||
this.groupBox3.Size = new System.Drawing.Size(154, 63);
|
||||
this.groupBox3.TabIndex = 4;
|
||||
this.groupBox3.TabStop = false;
|
||||
this.groupBox3.Text = "데이터 채우기";
|
||||
this.groupBox3.Text = "관리";
|
||||
//
|
||||
// simpleButton_Reset
|
||||
//
|
||||
this.simpleButton_Reset.Location = new System.Drawing.Point(0, 0);
|
||||
this.simpleButton_Reset.Location = new System.Drawing.Point(6, 21);
|
||||
this.simpleButton_Reset.Name = "simpleButton_Reset";
|
||||
this.simpleButton_Reset.Size = new System.Drawing.Size(75, 23);
|
||||
this.simpleButton_Reset.Size = new System.Drawing.Size(109, 32);
|
||||
this.simpleButton_Reset.TabIndex = 0;
|
||||
this.simpleButton_Reset.Text = "Reset";
|
||||
//
|
||||
// progressBar1
|
||||
//
|
||||
@@ -129,6 +136,24 @@ namespace Million_Hunter.HunterSubForm
|
||||
this.simpleButton_찬.Text = "찬테스트";
|
||||
this.simpleButton_찬.Click += new System.EventHandler(this.simpleButton_찬_Click);
|
||||
//
|
||||
// checkEdit_구름떼상한선하락시판매
|
||||
//
|
||||
this.checkEdit_구름떼상한선하락시판매.Location = new System.Drawing.Point(379, 22);
|
||||
this.checkEdit_구름떼상한선하락시판매.Name = "checkEdit_구름떼상한선하락시판매";
|
||||
this.checkEdit_구름떼상한선하락시판매.Properties.Caption = "구름떼 상한선 하락시 판매 (1%)";
|
||||
this.checkEdit_구름떼상한선하락시판매.Size = new System.Drawing.Size(179, 19);
|
||||
this.checkEdit_구름떼상한선하락시판매.TabIndex = 2;
|
||||
this.checkEdit_구름떼상한선하락시판매.CheckedChanged += new System.EventHandler(this.checkEdit_common_CheckedChanged);
|
||||
//
|
||||
// checkEdit_구매전봉기준가중이동평균5봉이40봉크로스이후구매
|
||||
//
|
||||
this.checkEdit_구매전봉기준가중이동평균5봉이40봉크로스이후구매.Location = new System.Drawing.Point(19, 47);
|
||||
this.checkEdit_구매전봉기준가중이동평균5봉이40봉크로스이후구매.Name = "checkEdit_구매전봉기준가중이동평균5봉이40봉크로스이후구매";
|
||||
this.checkEdit_구매전봉기준가중이동평균5봉이40봉크로스이후구매.Properties.Caption = "구매 전봉 기준 가중이동평균 5봉이 40봉 크로스 이후 구매";
|
||||
this.checkEdit_구매전봉기준가중이동평균5봉이40봉크로스이후구매.Size = new System.Drawing.Size(310, 19);
|
||||
this.checkEdit_구매전봉기준가중이동평균5봉이40봉크로스이후구매.TabIndex = 3;
|
||||
this.checkEdit_구매전봉기준가중이동평균5봉이40봉크로스이후구매.CheckedChanged += new System.EventHandler(this.checkEdit_common_CheckedChanged);
|
||||
//
|
||||
// TestBoardForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
|
||||
@@ -136,6 +161,7 @@ namespace Million_Hunter.HunterSubForm
|
||||
this.ClientSize = new System.Drawing.Size(853, 297);
|
||||
this.Controls.Add(this.progressBar1);
|
||||
this.Controls.Add(this.simpleButton_찬);
|
||||
this.Controls.Add(this.groupBox3);
|
||||
this.Controls.Add(this.groupBox2);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Name = "TestBoardForm";
|
||||
@@ -145,6 +171,8 @@ namespace Million_Hunter.HunterSubForm
|
||||
((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.checkEdit_구매전봉기준가중이동평균5봉이40봉크로스이후구매.Properties)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@@ -161,5 +189,7 @@ namespace Million_Hunter.HunterSubForm
|
||||
private System.Windows.Forms.GroupBox groupBox3;
|
||||
private DevExpress.XtraEditors.SimpleButton simpleButton_Reset;
|
||||
private DevExpress.XtraEditors.CheckEdit checkEdit_구매이전봉볼린저40_1이하;
|
||||
private DevExpress.XtraEditors.CheckEdit checkEdit_구매전봉기준가중이동평균5봉이40봉크로스이후구매;
|
||||
private DevExpress.XtraEditors.CheckEdit checkEdit_구름떼상한선하락시판매;
|
||||
}
|
||||
}
|
||||
@@ -195,28 +195,9 @@ namespace Million_Hunter.HunterSubForm
|
||||
var 구매이전봉 = startDate;
|
||||
|
||||
//차트 Date Time 설정하기
|
||||
var StartDateInterval = 1;
|
||||
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;
|
||||
}
|
||||
구매이전봉 = changeDatetimeFormat(구매이전봉, StartDateInterval);
|
||||
|
||||
var candleData = analysisData.CandleDatas[MCandleTimeType].Find(item => item.DateTime == 구매이전봉);
|
||||
// 시간대 캔들이 없으면 결과에서 제외
|
||||
@@ -264,28 +245,9 @@ namespace Million_Hunter.HunterSubForm
|
||||
var 구매이전봉 = startDate;
|
||||
|
||||
//차트 Date Time 설정하기
|
||||
var StartDateInterval = 1;
|
||||
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;
|
||||
}
|
||||
구매이전봉 = changeDatetimeFormat(구매이전봉, StartDateInterval);
|
||||
|
||||
var candleData = analysisData.CandleDatas[MCandleTimeType].Find(item => item.DateTime == 구매이전봉);
|
||||
// 시간대 캔들이 없으면 결과에서 제외
|
||||
@@ -318,12 +280,125 @@ namespace Million_Hunter.HunterSubForm
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (checkEdit_구름떼상한선하락시판매.Checked)
|
||||
{
|
||||
// 평균 승률 계산하기
|
||||
double winRate = 0;
|
||||
// 평균 수익률 계산하기
|
||||
double profitRate = 0;
|
||||
|
||||
var count__ = 0;
|
||||
var count_2 = 0;
|
||||
var count_3 = 0;
|
||||
|
||||
foreach (var analysisData in parentForm._analysisDatas)
|
||||
{
|
||||
if (!analysisData.Inclusion) continue;
|
||||
|
||||
var startDate = changeDatetimeFormat(analysisData.StartDate, 0);
|
||||
var endDate = changeDatetimeFormat(analysisData.EndDate, 0);
|
||||
|
||||
var candleData = analysisData.CandleDatas.First().Value.Find(item => item.DateTime >= startDate &&
|
||||
item.IndicatorDic["Ich2695226"]?.value != null && item.IndicatorDic["Ich2695226"]?.value > item.LowValue);
|
||||
|
||||
|
||||
if(candleData != null)
|
||||
{
|
||||
var endResut = changeDatetimeFormat(candleData.DateTime, 0);
|
||||
var ichValue = ((IchimokData)candleData.IndicatorDic["Ich2695226"]).GetOverValue();
|
||||
|
||||
// 판매 시간 이전에 하락 시 다시 계산
|
||||
if (endDate > endResut)
|
||||
{
|
||||
// 수익이면
|
||||
if (analysisData.BuyValue > ichValue)
|
||||
{
|
||||
winRate++;
|
||||
count__++;
|
||||
}
|
||||
|
||||
//var profitRate1 = profitRate1 + (-100 + (Convert.ToDouble(ichValue) / Convert.ToDouble(analysisData.BuyValue) * 100));
|
||||
profitRate += -1 * ((analysisData.BuyValue - ichValue) / analysisData.BuyValue * 100);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (analysisData.WinFlag)
|
||||
{
|
||||
winRate++;
|
||||
count_2++;
|
||||
}
|
||||
|
||||
profitRate = profitRate + analysisData.EarningRate;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(startDate != endDate)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (analysisData.WinFlag)
|
||||
{
|
||||
count_2++;
|
||||
winRate++;
|
||||
}
|
||||
else { }
|
||||
|
||||
profitRate = profitRate + analysisData.EarningRate;
|
||||
}
|
||||
}
|
||||
|
||||
var allCount = parentForm._analysisDatas.Count(item => item.Inclusion == true);
|
||||
|
||||
winRate = winRate * 100 / allCount;
|
||||
|
||||
MessageBox.Show(string.Format("승률 : {0:0.00} % 수익률 : {1:0.00} % 개수 : {2}",
|
||||
double.Parse(winRate.ToString()), double.Parse(profitRate.ToString()), allCount.ToString()) );
|
||||
}
|
||||
|
||||
parentForm.treeList_ResultData.RefreshDataSource();
|
||||
parentForm.CalcurateProfitAndWinRate();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 시간/분/일 등의 Datetime 과 비교하기 위한 Format String 변경 함수
|
||||
/// </summary>
|
||||
/// <param name="dateTime"></param>
|
||||
/// <param name="StartDateInterval"></param>
|
||||
/// <returns></returns>
|
||||
public DateTime changeDatetimeFormat(DateTime dateTime, int StartDateInterval)
|
||||
{
|
||||
var _dateTime = dateTime;
|
||||
|
||||
switch (MCandleTimeType)
|
||||
{
|
||||
case CommonProperty.MCandleTimeType.H1:
|
||||
_dateTime = Convert.ToDateTime(dateTime.ToString("yyyy-MM-dd HH:00")) + new TimeSpan(0, StartDateInterval, 0, 0);
|
||||
break;
|
||||
case CommonProperty.MCandleTimeType.H4:
|
||||
_dateTime = Convert.ToDateTime(dateTime.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:
|
||||
_dateTime = Convert.ToDateTime(dateTime.ToString("yyyy-MM-dd")) + new TimeSpan(StartDateInterval, 0, 0, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
return _dateTime;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 이전봉40_2볼린저이하
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user