Beispiel #1
0
        public virtual IKLineBar GetAggrKLineBar(int startIndex, int endIndex)
        {
            KLineBar bar = new KLineBar();

            bar.Time  = this.Arr_Time[startIndex];
            bar.Start = this.Arr_Start[startIndex];
            bar.End   = this.Arr_End[endIndex];
            bar.Hold  = this.Arr_Hold[endIndex];

            float high  = float.MinValue;
            float low   = float.MaxValue;
            int   mount = 0;
            float money = 0;

            for (int i = startIndex; i <= endIndex; i++)
            {
                float chigh = this.Arr_High[i];
                float clow  = this.Arr_Low[i];
                high   = high < chigh ? chigh : high;
                low    = low > clow ? clow : low;
                mount += this.Arr_Mount[i];
                money += this.Arr_Money[i];
            }
            bar.High  = high;
            bar.Low   = low;
            bar.Mount = mount;
            bar.Money = money;
            return(bar);
        }
Beispiel #2
0
        public static KLineBar CopyFrom(IKLineBar otherKlineBar)
        {
            KLineBar klineBar = new KLineBar();

            klineBar.code  = otherKlineBar.Code;
            klineBar.start = otherKlineBar.Start;
            klineBar.high  = otherKlineBar.High;
            klineBar.low   = otherKlineBar.Low;
            klineBar.end   = otherKlineBar.End;
            klineBar.mount = otherKlineBar.Mount;
            klineBar.money = otherKlineBar.Money;
            klineBar.hold  = otherKlineBar.Hold;
            return(klineBar);
        }