1 min CandleTick이 완료됐을 때 5 MA tick을 생성하도록 수정

This commit is contained in:
mjjo
2016-07-25 11:11:45 +09:00
parent 3fb2c4adbe
commit ab2181747f

View File

@@ -75,8 +75,12 @@ namespace upper_limit_crawler
PriceNode node = new PriceNode(iTime, iPrice);
m_PriceList.Add(node);
Insert1MinChart(iTime, iPrice);
Insert5MinChart(iTime);
bool bMakeNew = Insert1MinChart(iTime, iPrice);
if(bMakeNew == true && m_1MinChart.Keys.Count >= 2)
{
int iTimeKey = m_1MinChart.Keys[m_1MinChart.Keys.Count-2];
Insert5MinChart(iTimeKey);
}
}
public void Received()
@@ -142,18 +146,19 @@ namespace upper_limit_crawler
return iHour*10000 + iMin*100 + iSecond;
}
void Insert1MinChart(int iTime, int iPrice)
bool Insert1MinChart(int iTime, int iPrice)
{
int iHour = GetHour(iTime);
int iMin = GetMinute(iTime);
int iSec = GetSecond(iTime);
int iKey = GetTimeKey1Min(iHour, iMin, iSec);
bool bMadeNew = false;
if (m_1MinChart.ContainsKey(iKey) == false)
{
CandleTick tick1 = new CandleTick(iTime, iPrice);
m_1MinChart.Add(iKey, tick1);
bMadeNew = true;
}
else
{
@@ -162,7 +167,10 @@ namespace upper_limit_crawler
tick1.m_iEnd = iPrice;
tick1.m_iLowest = Math.Min(tick1.m_iLowest, iPrice);
tick1.m_iHighest = Math.Max(tick1.m_iHighest, iPrice);
bMadeNew = false;
}
return bMadeNew;
}
public void MakeChart()