private void ForwardToday_KLineData(IKLineData_RealTime klineData, KLinePeriod period) { ITickBar nextTickBar = currentTickData.GetBar(currentTickData.BarPos + 1); //日线,肯定不会跳到下一个bar if (period == KLinePeriod.KLinePeriod_1Day) { dic_KLinePeriod_IsEnd[period] = false; klineData.ChangeCurrentBar(GetKLineBar(klineData, nextTickBar)); return; } double nextTickTime = nextTickBar.Time; int nextKLineIndex = FindNextKLineIndex(klineData, nextTickTime); if (nextKLineIndex == klineData.BarPos) { dic_KLinePeriod_IsEnd[period] = false; klineData.ChangeCurrentBar(GetKLineBar(klineData, nextTickBar)); } else { dic_KLinePeriod_IsEnd[period] = true; klineData.ChangeCurrentBar(GetKLineBar(nextTickBar), nextKLineIndex); } }
private void ForwardToday_TimeLineData(ITimeLineData_RealTime timeLineData) { if (timeLineData == null) { return; } ITickData_Extend currentTickData = forwardData.CurrentTickData; ITickBar nextTickBar = currentTickData.GetBar(currentTickData.BarPos + 1); int nextTimeLineBarPos = timeLineData.BarPos + 1; if (nextTimeLineBarPos >= timeLineData.Length) { TimeLineBar timeLineBar = GetTimeLineBar(timeLineData, nextTickBar, timeLineData.YesterdayEnd); timeLineData.ChangeCurrentBar(timeLineBar, timeLineData.BarPos); return; } else { double nextTime = timeLineData.Arr_Time[nextTimeLineBarPos]; TimeLineBar timeLineBar; if (nextTickBar.Time >= nextTime) { timeLineBar = GetTimeLineBar(nextTickBar, timeLineData.YesterdayEnd); timeLineData.ChangeCurrentBar(timeLineBar, nextTimeLineBarPos); } else { timeLineBar = GetTimeLineBar(timeLineData, nextTickBar, timeLineData.YesterdayEnd); timeLineData.ChangeCurrentBar(timeLineBar, timeLineData.BarPos); } } }
private bool ForwardToday_MainKLineData() { ITickData_Extend currentTickData = forwardData.CurrentTickData; ITickBar nextTickBar = currentTickData.GetBar(currentTickData.BarPos + 1); double nextTickTime = nextTickBar.Time; IKLineData_RealTime klineData = forwardData.GetMainKLineData(); if (dic_KLinePeriod_IsEnd[forwardData.MainKLinePeriod]) { dic_KLinePeriod_IsEnd[forwardData.MainKLinePeriod] = false; } else { int nextKLineIndex = FindNextKLineIndex(klineData, nextTickTime); } //if (nextKLineIndex == klineData.BarPos) //{ // dic_KLinePeriod_IsEnd[period] = false; // klineData.ChangeCurrentBar(GetKLineBar(klineData, nextTickBar)); //} //else //{ // dic_KLinePeriod_IsEnd[period] = true; // klineData.ChangeCurrentBar(GetKLineBar(nextTickBar), nextKLineIndex); //} return(false); }
public ITickBar GetBar(int index) { return(tickData.GetBar(index)); }