Compare 기본 비교 로직 완료
This commit is contained in:
@@ -121,8 +121,7 @@ namespace Million
|
||||
단순비교 = 0,
|
||||
돌파비교 = 1,
|
||||
최초돌파 = 2,
|
||||
크로스 = 3,
|
||||
조건단순비교 = 4
|
||||
크로스 = 3
|
||||
}
|
||||
|
||||
// 시가/고가/종가/저가
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Million.IndicatorConditionSetup
|
||||
/// <returns></returns>
|
||||
public object Clone()
|
||||
{
|
||||
var clone = new BolingerConditionSetup
|
||||
var clone = new CompareConditionSetup
|
||||
{
|
||||
CandlePriceTypeFirstOver = CandlePriceTypeFirstOver,
|
||||
OverStatusEnumListFirstOver = OverStatusEnumListFirstOver,
|
||||
@@ -49,9 +49,20 @@ namespace Million.IndicatorConditionSetup
|
||||
OverStatusEnumList = OverStatusEnumList,
|
||||
MCandleTimeType = MCandleTimeType,
|
||||
Description = Description,
|
||||
IndexString = IndexString
|
||||
IndexString = IndexString,
|
||||
Origin = Origin,
|
||||
Compare = Compare,
|
||||
CompareType = CompareType
|
||||
};
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
||||
public override string GetKeyName(bool IndexStr = false)
|
||||
{
|
||||
var key = "Compare" + Origin + Compare;
|
||||
if (IndexStr)
|
||||
return IndexString + key;
|
||||
return key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,9 +72,6 @@ namespace Million.IndicatorConditionSetup
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (obj.GetType() == typeof(BolingerConditionSetup))
|
||||
{
|
||||
var thisBol = (BolingerConditionSetup)this;
|
||||
@@ -103,6 +100,14 @@ namespace Million.IndicatorConditionSetup
|
||||
thisMov.MACandlePriceType == objMov.MACandlePriceType &&
|
||||
thisMov.MovingAverageType == objMov.MovingAverageType;
|
||||
}
|
||||
else if (obj.GetType() == typeof(CompareConditionSetup)) {
|
||||
var objCompare = (CompareConditionSetup)obj;
|
||||
var thisCompare = (CompareConditionSetup)this;
|
||||
return objCompare.Origin == thisCompare.Origin &&
|
||||
objCompare.Compare == thisCompare.Compare &&
|
||||
objCompare.CompareType == thisCompare.CompareType;
|
||||
}
|
||||
|
||||
|
||||
return base.Equals(obj);
|
||||
}
|
||||
|
||||
@@ -345,6 +345,11 @@ namespace Million.Manager
|
||||
RateValue(setUp, parentCandleDataList, childrenCandleDataList, buyData);
|
||||
}
|
||||
}
|
||||
//조건 단순비교
|
||||
else if (setUp.IndicatorType == IndicatorType.조건단순비교)
|
||||
{
|
||||
CompareSimpleComparison(setUp, totalIndicator, parentCandleDataList, childrenCandleDataList);
|
||||
}
|
||||
//돌파
|
||||
else if (setUp.SubIndicatorSetupType == SubIndicatorSetupType.돌파비교)
|
||||
{
|
||||
@@ -367,11 +372,7 @@ namespace Million.Manager
|
||||
for (var i = 0; i < 3; i++)
|
||||
CrossCondition(setUp, parentCandleDataList, childrenCandleDataList, subIndicator, i);
|
||||
}
|
||||
//조건 단순비교
|
||||
else if(setUp.SubIndicatorSetupType == SubIndicatorSetupType.조건단순비교)
|
||||
{
|
||||
CompareSimpleComparison(setUp, totalIndicator, parentCandleDataList, childrenCandleDataList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -387,6 +388,8 @@ namespace Million.Manager
|
||||
|
||||
var cSetup = (CompareConditionSetup)setUp;
|
||||
|
||||
var key = GetKeyData(cSetup);
|
||||
|
||||
var originSetup = totalIndicator.FirstOrDefault(t => t.IndexString == cSetup.Origin);
|
||||
var originKey = GetKeyData(originSetup);
|
||||
var originVal = 0.0;
|
||||
@@ -423,7 +426,7 @@ namespace Million.Manager
|
||||
{
|
||||
if (parent.CalculateFlag[cSetup.IndexString]) break;
|
||||
|
||||
if (originValueList.Count < i)
|
||||
if (originValueList.Count < i)
|
||||
{
|
||||
originVal = originValueList[originValueList.Count - 1];
|
||||
}
|
||||
@@ -447,9 +450,18 @@ namespace Million.Manager
|
||||
(cSetup.CompareType == CompareType.Origin_DownOrSame_Compare_Up && originVal <= compareVal))
|
||||
{
|
||||
parent.CalculateFlag[cSetup.IndexString] = true;
|
||||
|
||||
parent.IndicatorDic[key] = new IndicatorData();
|
||||
parent.IndicatorDic[key].value = parent.EndValue;
|
||||
|
||||
var childList = GetChildrenDatas(parent, cSetup.MCandleTimeType, childrenCandleDataList);
|
||||
|
||||
foreach (var item in childList) item.CalculateFlag[cSetup.IndexString] = true;
|
||||
foreach (var item in childList)
|
||||
{
|
||||
item.CalculateFlag[cSetup.IndexString] = true;
|
||||
item.IndicatorDic[key] = new IndicatorData();
|
||||
item.IndicatorDic[key].value = item.EndValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.IndicatorType == IndicatorType.조건단순비교).ToList();
|
||||
|
||||
var subIndStringiList = new List<string>();
|
||||
foreach (var item in parentIndicator)
|
||||
{
|
||||
var subRegExpression = "";
|
||||
if (item.SubIndicatorSetupType == CommonProperty.SubIndicatorSetupType.조건단순비교)
|
||||
if (item.IndicatorType == CommonProperty.IndicatorType.조건단순비교)
|
||||
{
|
||||
subRegExpression = ((CompareConditionSetup)item).Origin + "," + ((CompareConditionSetup)item).Compare;
|
||||
}
|
||||
|
||||
@@ -35,10 +35,12 @@ namespace Million.Manager
|
||||
else if (setup.GetType() == typeof(PriceRateCondtionSetup))
|
||||
{
|
||||
indicatorList.Add((PriceRateCondtionSetup)setup);
|
||||
}else if(setup.GetType() == typeof(CompareConditionSetup))
|
||||
{
|
||||
indicatorList.Add((CompareConditionSetup)setup);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return indicatorList;
|
||||
}
|
||||
|
||||
|
||||
@@ -317,12 +317,7 @@ namespace Million.HunterSubForm.IndicatorSetupForm
|
||||
case CommonProperty.SubIndicatorSetupType.크로스:
|
||||
_indicatorSetupData.Description +=
|
||||
$",크로스[{_indicatorSetupData.CrossType},정규식({_indicatorSetupData.CrossSubRegExpression})]";
|
||||
break;
|
||||
|
||||
case CommonProperty.SubIndicatorSetupType.조건단순비교:
|
||||
_indicatorSetupData.Description +=
|
||||
$",조건단순비교";
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,7 +342,7 @@ namespace Million.HunterSubForm.IndicatorSetupForm
|
||||
case CommonProperty.IndicatorType.조건단순비교:
|
||||
((CompareSetupUserForm)_curruentIndicatorSpecSetupform).SaveIndicatorSetup(_indicatorSetupData);
|
||||
return ((CompareConditionSetup)_indicatorSetupData).Clone();
|
||||
}
|
||||
}
|
||||
return _indicatorSetupData;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user