diff --git a/Million/CommonProperty.cs b/Million/CommonProperty.cs index 17df0bc..0eacf25 100644 --- a/Million/CommonProperty.cs +++ b/Million/CommonProperty.cs @@ -122,7 +122,7 @@ namespace Million 돌파비교 = 1, 최초돌파 = 2, 크로스 = 3, - 조건간단순비교 = 4 + 조건단순비교 = 4 } // 시가/고가/종가/저가 @@ -160,7 +160,8 @@ namespace Million 이동평균선 = 3, ParabolicSAR = 4, 거래량비율 = 5, - 가격비율 = 6 + 가격비율 = 6, + 조건단순비교 =7 } // 이동평균선 종류 @@ -373,7 +374,9 @@ namespace Million public enum CompareType { Origin_Up_Compare_Down = 0, - Origin_Down_Compare_Up = 1 + Origin_UpOrSame_Compare_Down = 1, + Origin_Down_Compare_Up = 2, + Origin_DownOrSame_Compare_Up = 3 } #endregion } diff --git a/Million/Manager/CalculateManager.cs b/Million/Manager/CalculateManager.cs index 4ddddbd..844e857 100644 --- a/Million/Manager/CalculateManager.cs +++ b/Million/Manager/CalculateManager.cs @@ -367,7 +367,8 @@ namespace Million.Manager for (var i = 0; i < 3; i++) CrossCondition(setUp, parentCandleDataList, childrenCandleDataList, subIndicator, i); } - else if(setUp.SubIndicatorSetupType == SubIndicatorSetupType.조건간단순비교) + //조건 단순비교 + else if(setUp.SubIndicatorSetupType == SubIndicatorSetupType.조건단순비교) { } diff --git a/Million/Manager/DataManager.cs b/Million/Manager/DataManager.cs index 744c017..ee1eaf1 100644 --- a/Million/Manager/DataManager.cs +++ b/Million/Manager/DataManager.cs @@ -126,13 +126,13 @@ namespace Million.Manager { // 최초와 cross의 조건먼저 계산이 필요함(선처리) var parentIndicator = totalIndicator.Where(t => t.SubIndicatorSetupType == CommonProperty.SubIndicatorSetupType.최초돌파 || - t.SubIndicatorSetupType == CommonProperty.SubIndicatorSetupType.크로스 || t.SubIndicatorSetupType == SubIndicatorSetupType.조건간단순비교).ToList(); + t.SubIndicatorSetupType == CommonProperty.SubIndicatorSetupType.크로스 || t.SubIndicatorSetupType == SubIndicatorSetupType.조건단순비교).ToList(); var subIndStringiList = new List(); foreach (var item in parentIndicator) { var subRegExpression = ""; - if (item.SubIndicatorSetupType == CommonProperty.SubIndicatorSetupType.조건간단순비교) + if (item.SubIndicatorSetupType == CommonProperty.SubIndicatorSetupType.조건단순비교) { subRegExpression = ((CompareConditionSetup)item).Origin + "," + ((CompareConditionSetup)item).Compare; } diff --git a/Million/Million Core.csproj b/Million/Million Core.csproj index e7d6321..4944ff5 100644 --- a/Million/Million Core.csproj +++ b/Million/Million Core.csproj @@ -262,6 +262,12 @@ MovingAverageSetupUserForm.cs + + UserControl + + + CompareSetupUserForm.cs + UserControl @@ -320,6 +326,9 @@ MovingAverageSetupUserForm.cs + + CompareSetupUserForm.cs + ParabolicSarSetupUserForm.cs diff --git a/Million/SubForm/IndicatorSetupForm/CommonIndicatorSetupUserForm.cs b/Million/SubForm/IndicatorSetupForm/CommonIndicatorSetupUserForm.cs index a7b61f4..85c2f77 100644 --- a/Million/SubForm/IndicatorSetupForm/CommonIndicatorSetupUserForm.cs +++ b/Million/SubForm/IndicatorSetupForm/CommonIndicatorSetupUserForm.cs @@ -96,6 +96,9 @@ namespace Million.HunterSubForm.IndicatorSetupForm case CommonProperty.IndicatorType.ParabolicSAR: _indicatorSetupData = new ParabolicSarIndicatorConditionSetup(); break; + case CommonProperty.IndicatorType.조건단순비교: + _indicatorSetupData = new CompareConditionSetup(); + break; } // Over Status (중복선택 가능, Over, OverCancle 설정) @@ -198,6 +201,13 @@ namespace Million.HunterSubForm.IndicatorSetupForm _curruentIndicatorSpecSetupform = new ParabolicSarSetupUserForm(_indicatorSetupData, _isCreate) { Dock = DockStyle.Fill }; break; + + case CommonProperty.IndicatorType.조건단순비교: + _curruentIndicatorSpecSetupform = new CompareSetupUserForm(_indicatorSetupData, _isCreate) + { Dock = DockStyle.Fill }; + comboBoxEdit_CandleDateTime.Enabled = false; + xtraTabControl_SubIndicatorSetup.Enabled = false; + break; } // 그룹박스에 Sepc Indicator Setup 폼 추가 @@ -308,6 +318,11 @@ namespace Million.HunterSubForm.IndicatorSetupForm _indicatorSetupData.Description += $",크로스[{_indicatorSetupData.CrossType},정규식({_indicatorSetupData.CrossSubRegExpression})]"; break; + + case CommonProperty.SubIndicatorSetupType.조건단순비교: + _indicatorSetupData.Description += + $",조건단순비교"; + break; } } @@ -329,6 +344,9 @@ namespace Million.HunterSubForm.IndicatorSetupForm case CommonProperty.IndicatorType.ParabolicSAR: ((ParabolicSarSetupUserForm)_curruentIndicatorSpecSetupform).SaveIndicatorSetup(_indicatorSetupData); return ((ParabolicSarIndicatorConditionSetup)_indicatorSetupData).Clone(); + case CommonProperty.IndicatorType.조건단순비교: + ((CompareSetupUserForm)_curruentIndicatorSpecSetupform).SaveIndicatorSetup(_indicatorSetupData); + return ((CompareConditionSetup)_indicatorSetupData).Clone(); } return _indicatorSetupData; } diff --git a/Million/SubForm/IndicatorSetupForm/CompareSetupUserForm.Designer.cs b/Million/SubForm/IndicatorSetupForm/CompareSetupUserForm.Designer.cs new file mode 100644 index 0000000..d404dda --- /dev/null +++ b/Million/SubForm/IndicatorSetupForm/CompareSetupUserForm.Designer.cs @@ -0,0 +1,133 @@ + +namespace Million.HunterSubForm.IndicatorSetupForm +{ + partial class CompareSetupUserForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.te_Origin = new DevExpress.XtraEditors.TextEdit(); + this.labelControl_IndicatorName = new DevExpress.XtraEditors.LabelControl(); + this.labelControl3 = new DevExpress.XtraEditors.LabelControl(); + this.te_Compare = new DevExpress.XtraEditors.TextEdit(); + this.labelControl1 = new DevExpress.XtraEditors.LabelControl(); + this.cb_Type = new DevExpress.XtraEditors.ComboBoxEdit(); + this.labelControl2 = new DevExpress.XtraEditors.LabelControl(); + ((System.ComponentModel.ISupportInitialize)(this.te_Origin.Properties)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.te_Compare.Properties)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.cb_Type.Properties)).BeginInit(); + this.SuspendLayout(); + // + // te_Origin + // + this.te_Origin.Location = new System.Drawing.Point(83, 20); + this.te_Origin.Name = "te_Origin"; + this.te_Origin.Properties.Mask.EditMask = "d"; + this.te_Origin.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; + this.te_Origin.Size = new System.Drawing.Size(91, 20); + this.te_Origin.TabIndex = 3; + // + // labelControl_IndicatorName + // + this.labelControl_IndicatorName.Location = new System.Drawing.Point(3, 3); + this.labelControl_IndicatorName.Name = "labelControl_IndicatorName"; + this.labelControl_IndicatorName.Size = new System.Drawing.Size(20, 14); + this.labelControl_IndicatorName.TabIndex = 9; + this.labelControl_IndicatorName.Text = "지표"; + // + // labelControl3 + // + this.labelControl3.Location = new System.Drawing.Point(28, 23); + this.labelControl3.Name = "labelControl3"; + this.labelControl3.Size = new System.Drawing.Size(49, 14); + this.labelControl3.TabIndex = 2; + this.labelControl3.Text = "Origin(A)"; + // + // te_Compare + // + this.te_Compare.Location = new System.Drawing.Point(83, 46); + this.te_Compare.Name = "te_Compare"; + this.te_Compare.Properties.Mask.EditMask = "d"; + this.te_Compare.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.Numeric; + this.te_Compare.Size = new System.Drawing.Size(91, 20); + this.te_Compare.TabIndex = 11; + // + // labelControl1 + // + this.labelControl1.Location = new System.Drawing.Point(12, 49); + this.labelControl1.Name = "labelControl1"; + this.labelControl1.Size = new System.Drawing.Size(65, 14); + this.labelControl1.TabIndex = 10; + this.labelControl1.Text = "Compare(B)"; + // + // cb_Type + // + this.cb_Type.Location = new System.Drawing.Point(83, 72); + this.cb_Type.Name = "cb_Type"; + this.cb_Type.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { + new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); + this.cb_Type.Size = new System.Drawing.Size(91, 20); + this.cb_Type.TabIndex = 19; + // + // labelControl2 + // + this.labelControl2.Location = new System.Drawing.Point(49, 75); + this.labelControl2.Name = "labelControl2"; + this.labelControl2.Size = new System.Drawing.Size(28, 14); + this.labelControl2.TabIndex = 20; + this.labelControl2.Text = "Type"; + // + // CompareSetupUserForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.labelControl2); + this.Controls.Add(this.cb_Type); + this.Controls.Add(this.te_Compare); + this.Controls.Add(this.labelControl1); + this.Controls.Add(this.labelControl_IndicatorName); + this.Controls.Add(this.te_Origin); + this.Controls.Add(this.labelControl3); + this.Name = "CompareSetupUserForm"; + this.Size = new System.Drawing.Size(196, 111); + ((System.ComponentModel.ISupportInitialize)(this.te_Origin.Properties)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.te_Compare.Properties)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.cb_Type.Properties)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private DevExpress.XtraEditors.TextEdit te_Origin; + private DevExpress.XtraEditors.LabelControl labelControl_IndicatorName; + private DevExpress.XtraEditors.LabelControl labelControl3; + private DevExpress.XtraEditors.TextEdit te_Compare; + private DevExpress.XtraEditors.LabelControl labelControl1; + private DevExpress.XtraEditors.ComboBoxEdit cb_Type; + private DevExpress.XtraEditors.LabelControl labelControl2; + } +} diff --git a/Million/SubForm/IndicatorSetupForm/CompareSetupUserForm.cs b/Million/SubForm/IndicatorSetupForm/CompareSetupUserForm.cs new file mode 100644 index 0000000..62368fd --- /dev/null +++ b/Million/SubForm/IndicatorSetupForm/CompareSetupUserForm.cs @@ -0,0 +1,61 @@ +using DevExpress.XtraEditors; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using Million; +using Million.IndicatorConditionSetup; + +namespace Million.HunterSubForm.IndicatorSetupForm +{ + public partial class CompareSetupUserForm : DevExpress.XtraEditors.XtraUserControl + { + private CompareConditionSetup _compareConditionSetup; + private bool _isCreate = false; + + public CompareSetupUserForm(object compareConditionSetup, bool IsCreate) + { + InitializeComponent(); + + _compareConditionSetup = (CompareConditionSetup)compareConditionSetup; + _isCreate = IsCreate; + + InitForm(); + } + + private void InitForm() + { + labelControl_IndicatorName.Text = @"조건단순비교"; + cb_Type.Properties.Items.AddRange(Enum.GetNames(enumType: typeof(CommonProperty.CompareType))); + } + + // Indicator 정보 저장 + public void SaveIndicatorSetup(object indicatorSetupData) + { + // 예외처리 필요 + var compareConditionSetup = (CompareConditionSetup) indicatorSetupData; + + //지표 설정 + compareConditionSetup.IndicatorType = CommonProperty.IndicatorType.조건단순비교; + compareConditionSetup.Origin = te_Origin.Text; + compareConditionSetup.Compare = te_Compare.Text; + + Enum.TryParse(cb_Type.SelectedItem.ToString(), + out CommonProperty.CompareType type); + compareConditionSetup.CompareType = type; + + var description = + $"[{compareConditionSetup.Origin}," + + $"{compareConditionSetup.Compare}," + + $"{compareConditionSetup.CompareType}]"; + + compareConditionSetup.Description = description + compareConditionSetup.Description; + } + + } +} diff --git a/Million/SubForm/IndicatorSetupForm/CompareSetupUserForm.resx b/Million/SubForm/IndicatorSetupForm/CompareSetupUserForm.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Million/SubForm/IndicatorSetupForm/CompareSetupUserForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file