execute 관련 하나만 처리 할 수 있는 로직 추가(이찬균)

This commit is contained in:
kyh
2022-09-12 09:12:54 +09:00
parent 4d323e95d9
commit ab8913c81b
4 changed files with 93 additions and 5 deletions

View File

@@ -282,7 +282,7 @@ namespace Million_Prototype
var indicatorSetUpList = distinctIndicator.Where(t => t.MCandleTimeType == key).ToList();
foreach (var setup in indicatorSetUpList)
{
setup.excute(dic[key]);
setup.excute(dic[key], true);
}
}

View File

@@ -66,8 +66,14 @@ namespace Million.IndicatorConditionSetup
int i = 0;
if(last)
{
if (data.Count() < Period)
return;
i = data.Count() - Period - 1;
if(data[data.Count()-2].IndicatorDic.ContainsKey(bolKeyName))
{
단일볼렌저(data, data.Count() - 1);
return;
}
}
for (; i < data.Count(); i++)
@@ -126,7 +132,66 @@ namespace Million.IndicatorConditionSetup
}
}
}
public void 단일볼렌저(List<CandleData> data, int i)
{
var bolKeyName = GetKeyName();
var bol = data[i].IndicatorDic[bolKeyName] = new IndicatorData();
double total_average = 0;
if (i < Period - 1)
{
return;
}
for (int t = i - Period + 1; t < i; t++)
{
total_average += data[t].EndValue;
}
var total_Open = total_average + data[i].StartValue;
var total_High = total_average + data[i].HighValue;
var total_Low = total_average + data[i].LowValue;
total_average += data[i].EndValue;
double average = total_average / Period;
double average_Open = total_Open / Period;
double average_High = total_High / Period;
double average_Low = total_Low / Period;
double t_Open = 0;
double t_Close = 0;
double t_High = 0;
double t_Low = 0;
//오버렙 값 구하기 위한 변수
double sum = 0;
double powSum = 0;
int j;
for (j = (i - Period + 1); j < i; j++)
{
t_Open += Math.Pow(data[j].EndValue - average_Open, 2);
t_High += Math.Pow(data[j].EndValue - average_High, 2);
t_Low += Math.Pow(data[j].EndValue - average_Low, 2);
t_Close += Math.Pow(data[j].EndValue - average, 2);
sum += data[j].EndValue;
powSum += Math.Pow(data[j].EndValue, 2);
}
t_Open += Math.Pow(data[j].StartValue - average_Open, 2);
t_High += Math.Pow(data[j].HighValue - average_High, 2);
t_Low += Math.Pow(data[j].LowValue - average_Low, 2);
t_Close += Math.Pow(data[j].EndValue - average, 2);
bol.startValue = average_Open + Squared * Math.Sqrt(t_Open / Period);
bol.highValue = average_High + Squared * Math.Sqrt(t_High / Period);
bol.lowValue = average_Low + Squared * Math.Sqrt(t_Low / Period);
bol.value = average + Squared * Math.Sqrt(t_Close / Period);
IndicatorData.OverChecker(data[i], bol, data[i - 1].IndicatorDic[bolKeyName].indicator_over);
if (bol.overStatus != CommonProperty.OverStatus.None)
{
bol.overlapValue = getTargetValue(Period, sum, Squared, powSum);
}
}
private double getBol(List<CandleData> candleDatas,double sum,double candle)
{

View File

@@ -79,8 +79,13 @@ namespace Million.IndicatorConditionSetup
int dataIndex = 0;
if(last)
{
dataIndex = dataCount - Displacement - LaggingSpan2Period;
if (data[data.Count() - 2].IndicatorDic.ContainsKey(key))
{
dataIndex = dataCount - Displacement-1;
}
}
for (; dataIndex < dataCount; dataIndex++)
{
var saveIndex = dataIndex + Displacement;

View File

@@ -92,7 +92,6 @@ namespace Million.IndicatorConditionSetup
return IndexString + key;
return key;
}
/// <summary>
/// 단순 이평선 계산
/// TODO : 지수 가중
@@ -110,7 +109,26 @@ namespace Million.IndicatorConditionSetup
double dividValue = Period * (Period + 1) / 2;
var endValueList = new List<double>();
for (int i = 0; i < data.Count(); i++)
int i = 0;
if (last)
{
if(i+Period>= data.Count())
{
return;
}
if (data[data.Count() - 2].IndicatorDic.ContainsKey(movingKeyName))
{
i = data.Count() - 1;
for(int j= data.Count()-Period;j<i;i++)
{
var thisValue = GetStockValue(data[i]);
total_average += thisValue;
endValueList.Add(thisValue);
}
}
}
for (; i < data.Count(); i++)
{
if (!data[i].IndicatorDic.ContainsKey(movingKeyName))
{