private void ForwardToday_TimeLineData(TimeLineData_RealTime timeLineData) { if (timeLineData == null) { return; } ITickBar nextTickBar = currentTickData.GetBar(currentTickData.BarPos + 1); int nextTimeLineBarPos = timeLineData.BarPos + 1; if (nextTimeLineBarPos >= timeLineData.Length) { TimeLineBar timeLineBar = GetTimeLineBar(timeLineData, nextTickBar, lastEndPrice); timeLineData.ChangeCurrentBar(timeLineBar, timeLineData.BarPos); return; } else { double nextTime = timeLineData.Arr_Time[nextTimeLineBarPos]; TimeLineBar timeLineBar; if (nextTickBar.Time >= nextTime) { timeLineBar = GetTimeLineBar(nextTickBar, lastEndPrice); timeLineData.ChangeCurrentBar(timeLineBar, nextTimeLineBarPos); } else { timeLineBar = GetTimeLineBar(timeLineData, nextTickBar, lastEndPrice); timeLineData.ChangeCurrentBar(timeLineBar, timeLineData.BarPos); } } }
private TimeLineData_RealTime GetTimeLineData_RealTime(TimeLineData timeLineData, ITickData tickData, double time) { this.timeLineData_RealTime = new TimeLineData_RealTime(this.timeLineData); int timeLineIndex = TimeIndeierUtils.IndexOfTime_TimeLine(this.timeLineData, time); //this.timeLineData_RealTime.IndexOfTime(time); int tickIndex = TimeIndeierUtils.IndexOfTime_Tick(tickData, time); double klineTime = timeLineData_RealTime.Arr_Time[timeLineIndex]; int startTickIndex = TimeIndeierUtils.IndexOfTime_Tick(tickData, klineTime); //IKLineData klineData = dataPackage.GetKLineData(date, date, 1, 0, KLinePeriod.KLinePeriod_1Day); float lastEndPrice = dataPackage.GetLastEndPrice(date); TimeLineBar klineBar = GetTimeLineBar(tickData, startTickIndex, tickIndex, lastEndPrice); timeLineData_RealTime.ChangeCurrentBar(klineBar, timeLineIndex); return(timeLineData_RealTime); }
private void ForwardNextDay_TimeLine() { if (!useTimeLineData) { return; } int currentTradingDay = currentTickData.TradingDay; TimeLineData timeLineData = (TimeLineData)dataPackage.GetTimeLineData(currentTradingDay); if (timeLineData == null) { return; } float lastEndPrice = this.currentTimeLineData.Arr_Price[currentTimeLineData.Length - 1]; TimeLineData_RealTime timeLineData_RealTime = new TimeLineData_RealTime(timeLineData); timeLineData_RealTime.ChangeCurrentBar(GetTimeLineBar(currentTickData, lastEndPrice)); this.currentTimeLineData = timeLineData_RealTime; }