private static void ForwardNextDay_KLine(DataForForward_Code forwardData, IKLineData_RealTime klineData, KLinePeriod period) { ITickBar tickBar = forwardData.CurrentTickData.GetCurrentBar(); int nextbarPos = klineData.BarPos + 1; klineData.ChangeCurrentBar(KLineUtils.GetKLineBar(tickBar), nextbarPos); }
private static KLineBar GetKLineBar(ITickData tickData, int startIndex, int endIndex) { KLineBar klineBar = KLineUtils.GetKLineBar(tickData.GetBar(startIndex)); for (int i = startIndex + 1; i <= endIndex; i++) { klineBar = KLineUtils.GetKLineBar(klineBar, tickData.GetBar(i)); } return(klineBar); }
private void PrepareData() { this.listenedCodes[0] = this.dataForForward_Code.Code; this.dataForForward_Code.TradingDay = dataPackage.StartDate; this.forwardDataIndeier = new ForwardDataIndeier(dataForForward_Code); this.onBarArgument = new ForwardOnBarArgument(barFinishedInfos, this); foreach (KLinePeriod period in referedPeriods.UsedKLinePeriods) { IKLineData_RealTime klineData = this.dataForForward_Code.GetKLineData(period); klineData.ChangeCurrentBar(KLineUtils.GetKLineBar(dataForForward_Code.CurrentTickData)); } if (dataForForward_Code.UseTimeLineData) { ITimeLineData_RealTime timeLineData = dataForForward_Code.CurrentTimeLineData; timeLineData.ChangeCurrentBar(TimeLineUtils.GetTimeLineBar(dataForForward_Code.CurrentTickData, timeLineData.YesterdayEnd)); } }
private void ForwardKLine(IKLineData_RealTime klineData, bool isBarFinished, bool isBarStart) { ITickBar tickBar = dataForForward_Code.CurrentTickData; if (isBarFinished) { klineData.ResetCurrentBar(); } else if (isBarStart) { KLineBar klineBar = KLineUtils.GetKLineBar(tickBar); klineData.ChangeCurrentBar(klineBar, klineData.BarPos + 1); } else { KLineBar klineBar = KLineUtils.GetKLineBar(klineData, tickBar); klineData.ChangeCurrentBar(klineBar); } dic_KLinePeriod_IsEnd[klineData.Period] = isBarFinished; }
private void ForwardToday_KLine(IKLineData_RealTime klineData, double time, ITickData tickData, int prevTickIndex) { if (klineData.Period.Equals(KLinePeriod.KLinePeriod_1Day)) { klineData.ChangeCurrentBar(KLineUtils.GetKLineBar(klineData, tickData, prevTickIndex, tickData.BarPos)); return; } int nextKLineIndex = DataForward_Code_Tick.FindNextKLineIndex(klineData, time); if (nextKLineIndex == klineData.BarPos) { klineData.ChangeCurrentBar(KLineUtils.GetKLineBar(klineData, tickData, prevTickIndex, tickData.BarPos)); } else { double periodStartTime = klineData.Arr_Time[nextKLineIndex]; int startTickIndex = FindNextTickIndex(tickData, prevTickIndex, time); klineData.ChangeCurrentBar(KLineUtils.GetKLineBar(tickData, startTickIndex, tickData.BarPos), nextKLineIndex); } }
private static KLineBar GetKLineBar(IKLineBar klineBar, ITickBar tickBar) { return(KLineUtils.GetKLineBar(klineBar, tickBar)); }
private static KLineBar GetKLineBar(ITickBar tickBar) { return(KLineUtils.GetKLineBar(tickBar)); }
internal static KLineBar GetKLineBar(ITickBar tickBar) { return(KLineUtils.GetKLineBar(tickBar)); }