예제 #1
0
 public override void Add(DataEntry entry)
 {
     double price = entry.Items[0].Price;
     if (this.bar == null)
     {
         this.double_1 = (double)((decimal)price + (decimal)this.double_0);
         this.double_2 = (double)((decimal)price - (decimal)this.double_0);
         this.bar = new Bar(entry.DateTime, entry.DateTime, this.instrumentId, BarType.Custom, this.newBarSize, price, price, price, price, 0L, 0L);
         base.AddItemsToBar(entry.Items);
         return;
     }
     if (price >= this.double_1 + this.double_0)
     {
         if (!this.bool_0)
         {
             this.bar.High = this.double_1;
             this.bar.Close = this.double_1;
             this.bool_0 = true;
         }
         this.double_2 = this.double_1;
         this.double_1 = (double)((decimal)this.double_1 + (decimal)this.double_0);
         this.bar.DateTime = entry.DateTime;
         base.EmitNewCompressedBar();
         double high = (price > this.double_1) ? price : this.double_1;
         this.bar = new Bar(entry.DateTime, entry.DateTime, this.instrumentId, BarType.Custom, this.newBarSize, this.double_2, high, this.double_2, this.double_1, 0L, 0L);
         base.AddItemsToBar(entry.Items);
         return;
     }
     if (price <= this.double_2 - this.double_0)
     {
         if (!this.bool_0)
         {
             this.bar.Low = this.double_2;
             this.bar.Close = this.double_2;
             this.bool_0 = true;
         }
         this.double_1 = this.double_2;
         this.double_2 = (double)((decimal)this.double_2 - (decimal)this.double_0);
         this.bar.DateTime = entry.DateTime;
         base.EmitNewCompressedBar();
         double low = (price < this.double_2) ? price : this.double_2;
         this.bar = new Bar(entry.DateTime, entry.DateTime, this.instrumentId, BarType.Custom, this.newBarSize, this.double_1, this.double_1, low, this.double_2, 0L, 0L);
         base.AddItemsToBar(entry.Items);
         return;
     }
     AddItemsToBar(entry.Items);
 }
예제 #2
0
 public abstract void Add(DataEntry entry);
예제 #3
0
 public override void Add(DataEntry entry)
 {
     if (this.time1 <= entry.DateTime.TimeOfDay && entry.DateTime.TimeOfDay < this.time2)
     {
         if (this.bar == null || this.bar.dateTime.Date != entry.DateTime.Date)
         {
             if (this.bar != null)
                 EmitNewCompressedBar();
             CreateNewBar(BarType.Session, entry.DateTime.Date.Add(this.time1), entry.DateTime.Date.Add(this.time2), entry.Items[0].Price);
         }
         AddItemsToBar(entry.Items);
     }
 }
예제 #4
0
        public override void Add(DataEntry entry)
        {
            if (this.bar == null)
                CreateNewBar(BarType.Volume, entry.DateTime, entry.DateTime, entry.Items[0].Price);

            AddItemsToBar(entry.Items);
            this.bar.DateTime = entry.DateTime;

            if (this.bar.Volume >= this.newBarSize)
            {
                EmitNewCompressedBar();
                this.bar = null;
            }
        }
예제 #5
0
        public override void Add(DataEntry entry)
        {
            if (this.bar == null)
                CreateNewBar(BarType.Tick, entry.DateTime, entry.DateTime, entry.Items[0].Price);
            AddItemsToBar(entry.Items);

            this.bar.DateTime = entry.DateTime;
            this.long_0 += this.oldBarSize;
            if (this.long_0 == this.newBarSize)
            {
                EmitNewCompressedBar();
                this.bar = null;
                this.long_0 = 0;
            }
        }
예제 #6
0
        public override void Add(DataEntry entry)
        {
            if (this.bar == null || this.bar.DateTime <= entry.DateTime)
            {
                if (this.bar != null)
                    EmitNewCompressedBar();

                var dateTime = this.method_2(entry.DateTime);
                var endTime = this.method_3(dateTime);
                CreateNewBar(BarType.Time, dateTime, endTime, entry.Items[0].Price);
            }
            AddItemsToBar(entry.Items);
        }
예제 #7
0
 public abstract void Add(DataEntry entry);