示例#1
0
        private void ForwardBar_CurrentPeriod(KLineData_RealTime klineData, IKLineBar klineBar)
        {
            double time = klineBar.Time;

            IKLineBar oldbar = klineData.GetBar(klineData.BarPos);

            KLineBar bar = new KLineBar();

            bar.Time  = klineBar.Time;
            bar.Start = oldbar.Start;
            bar.High  = klineBar.High > oldbar.High ? klineBar.High : oldbar.High;
            bar.Low   = klineBar.Low < oldbar.Low ? klineBar.Low : oldbar.Low;
            bar.End   = klineBar.End;
            bar.Mount = oldbar.Mount + klineBar.Mount;
            bar.Money = oldbar.Money + klineBar.Money;
            bar.Hold  = klineBar.Hold;

            klineData.SetRealTimeData(bar);
        }
示例#2
0
        private void ForwardKLineData(KLineData_RealTime klineData)
        {
            IKLineBar nextMainBar   = mainKLineData.GetBar(mainKLineData.BarPos + 1);
            int       currentBarPos = klineData.BarPos;
            int       nextBarPos    = currentBarPos + 1;

            if (nextBarPos >= klineData.Length)
            {
                ForwardBar_CurrentPeriod(klineData, nextMainBar);
            }
            else
            {
                double nextTime     = klineData.Arr_Time[nextBarPos];
                double nextMainTime = mainKLineData.Arr_Time[mainKLineData.BarPos + 1];
                if (nextMainTime >= nextTime)
                {
                    ForwardBar_NextPeriod(klineData, nextMainBar);
                }
                else
                {
                    ForwardBar_CurrentPeriod(klineData, nextMainBar);
                }
            }
        }