Esempio n. 1
0
        private void ForwardToday_TimeLineData(int mainBarPosIfFinished)
        {
            if (!dataForForward_Code.UseTimeLineData)
            {
                return;
            }
            ITickBar tickBar = dataForForward_Code.CurrentTickData;
            ITimeLineData_RealTime timeLineData = dataForForward_Code.CurrentTimeLineData;

            //该时段已经结束,跳到下一时段
            if (isTimeLineEnd)
            {
                if (mainBarPosIfFinished > 0)
                {
                    timeLineData.ResetCurrentBar();
                    timeLineData.BarPos = forwardDataIndeier.GetTimeLineBarPosIfFinished(mainBarPosIfFinished);
                    return;
                }
                TimeLineBar timeLineBar2 = TimeLineUtils.GetTimeLineBar(tickBar, timeLineData.YesterdayEnd);
                int         barP         = forwardDataIndeier.GetTimeLineBarPosIfFinished(mainBarPosIfFinished);
                timeLineData.ChangeCurrentBar(timeLineBar2, barP);
                //timeLineData.ChangeCurrentBar(timeLineBar2, timeLineData.BarPos + 1);
                isTimeLineEnd = false;
                return;
            }

            TimeLineBar timeLineBar = TimeLineUtils.GetTimeLineBar(timeLineData, tickBar, timeLineData.YesterdayEnd);

            timeLineData.ChangeCurrentBar(timeLineBar);

            if (mainBarPosIfFinished > 0)
            {
                isTimeLineEnd = true;
            }
        }
        private static TimeLineBar GetTimeLineBar(ITickData tickData, int startIndex, int endIndex, float lastEndPrice)
        {
            TimeLineBar timeLineBar = TimeLineUtils.GetTimeLineBar(tickData.GetBar(startIndex), lastEndPrice);

            for (int i = startIndex + 1; i <= endIndex; i++)
            {
                timeLineBar = TimeLineUtils.GetTimeLineBar(timeLineBar, tickData.GetBar(i), lastEndPrice);
            }
            return(timeLineBar);
        }
Esempio n. 3
0
 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));
     }
 }
Esempio n. 4
0
        private void ForwardToday_TimeLine(ITimeLineData_RealTime timeLineData, double time, ITickData tickData, int prevTickIndex)
        {
            if (timeLineData == null)
            {
                return;
            }
            int nextTimeLineIndex = DataForward_Code_Tick.FindNextTimeLineIndex(timeLineData, time);

            if (nextTimeLineIndex == timeLineData.BarPos)
            {
                timeLineData.ChangeCurrentBar(TimeLineUtils.GetTimeLineBar(timeLineData, tickData, prevTickIndex, tickData.BarPos, timeLineData.YesterdayEnd));
            }
            else
            {
                double periodStartTime = timeLineData.Arr_Time[nextTimeLineIndex];
                int    startTickIndex  = FindNextTickIndex(tickData, prevTickIndex, time);
                timeLineData.ChangeCurrentBar(TimeLineUtils.GetTimeLineBar(tickData, startTickIndex, tickData.BarPos, timeLineData.YesterdayEnd), nextTimeLineIndex);
            }
        }
Esempio n. 5
0
 private static TimeLineBar GetTimeLineBar(ITimeLineBar klineBar, ITickBar tickBar, float lastEndPricce)
 {
     return(TimeLineUtils.GetTimeLineBar(klineBar, tickBar, lastEndPricce));
 }
Esempio n. 6
0
 internal static TimeLineBar GetTimeLineBar(ITickBar tickBar, float lastEndPrice)
 {
     return(TimeLineUtils.GetTimeLineBar(tickBar, lastEndPrice));
 }