예제 #1
0
		public override void Add(CompressorDataItem data)
		{
			if (this.bar == null)
				this.CreateNewBar(BarType.Volume, data.DateTime, data.DateTime, data.Items[0].Price);
			this.AddDataToBar(data.Items);
			this.bar.EndTime = data.DateTime;
			if (this.bar.Volume < this.barSize)
				return;
			this.EmitNewCompressedBar();
			this.bar = null;
		}
예제 #2
0
		public override void Add(CompressorDataItem data)
		{
			if (this.bar == null || this.bar.EndTime <= data.DateTime)
			{
				if (this.bar != null)
					this.EmitNewCompressedBar();
				DateTime barBeginTime = this.GetBarBeginTime(data.DateTime);
				this.CreateNewBar(BarType.Time, barBeginTime, barBeginTime.AddSeconds(this.barSize), data.Items[0].Price);
				this.AddDataToBar(data.Items);
			}
			else
				this.AddDataToBar(data.Items);
		}
예제 #3
0
 public override void Add(CompressorDataItem data)
 {
     if (this.bar == null)
     {
         this.CreateNewBar(BarType.Volume, data.DateTime, data.DateTime, data.Items[0].Price);
     }
     this.AddDataToBar(data.Items);
     this.bar.EndTime = data.DateTime;
     if (this.bar.Volume < this.barSize)
     {
         return;
     }
     this.EmitNewCompressedBar();
     this.bar = null;
 }
예제 #4
0
		public override void Add(CompressorDataItem data)
		{
			if (this.bar == null)
				this.CreateNewBar(BarType.Tick, data.DateTime, data.DateTime, data.Items[0].Price);
			this.AddDataToBar(data.Items);
			this.bar.EndTime = data.DateTime;
			if (this.dataSource.Input == DataSourceInput.Bar)
				this.tickCount += ((BarDataSource)this.dataSource).BarSize;
			else
				++this.tickCount;
			if (this.tickCount != this.barSize)
				return;
			this.EmitNewCompressedBar();
			this.bar = null;
			this.tickCount = 0;
		}
예제 #5
0
 public override void Add(CompressorDataItem data)
 {
     if (this.bar == null || this.bar.EndTime <= data.DateTime)
     {
         if (this.bar != null)
         {
             this.EmitNewCompressedBar();
         }
         DateTime barBeginTime = this.GetBarBeginTime(data.DateTime);
         this.CreateNewBar(BarType.Time, barBeginTime, barBeginTime.AddSeconds(this.barSize), data.Items[0].Price);
         this.AddDataToBar(data.Items);
     }
     else
     {
         this.AddDataToBar(data.Items);
     }
 }
예제 #6
0
        public override void Add(CompressorDataItem data)
        {
            if (data.Items.Count != 1)
            {
                throw new ArgumentException(string.Format("Cannot make range bars from {0}", (object)this.dataSource.Input));
            }
            double price = data.Items[0].Price;

            if (this.bar == null)
            {
                this.CreateNewBar((BarType)4, data.DateTime, data.DateTime, price);
            }
            else
            {
                this.AddDataToBar(data.Items);
                this.bar.EndTime = data.DateTime;
                bool flag = false;
                while (!flag)
                {
                    if (10000.0 * (this.bar.High - this.bar.Low) >= (double)this.barSize)
                    {
                        Bar bar = new Bar(BarType.Range, this.barSize, data.DateTime, data.DateTime, price, price, price, price, 0, 0);
                        if (this.bar.High == price)
                        {
                            this.bar.High  = this.bar.Low + (double)this.barSize / 10000.0;
                            this.bar.Close = this.bar.High;
                            bar.Low        = this.bar.High;
                        }
                        if (this.bar.Low == price)
                        {
                            this.bar.Low   = this.bar.High - (double)this.barSize / 10000.0;
                            this.bar.Close = this.bar.Low;
                            bar.High       = this.bar.Low;
                        }
                        this.EmitNewCompressedBar();
                        this.bar = bar;
                        flag     = 10000.0 * (this.bar.High - this.bar.Low) < (double)this.barSize;
                    }
                    else
                    {
                        flag = true;
                    }
                }
            }
        }
예제 #7
0
		public override void Add(CompressorDataItem data)
		{
			if (data.Items.Count != 1)
				throw new ArgumentException(string.Format("Cannot make range bars from {0}", (object)this.dataSource.Input));
			double price = data.Items[0].Price;
			if (this.bar == null)
			{
				this.CreateNewBar((BarType)4, data.DateTime, data.DateTime, price);
			}
			else
			{
				this.AddDataToBar(data.Items);
				this.bar.EndTime = data.DateTime;
				bool flag = false;
				while (!flag)
				{
					if (10000.0 * (this.bar.High - this.bar.Low) >= (double)this.barSize)
					{
						Bar bar = new Bar(BarType.Range, this.barSize, data.DateTime, data.DateTime, price, price, price, price, 0, 0);
						if (this.bar.High == price)
						{
							this.bar.High = this.bar.Low + (double)this.barSize / 10000.0;
							this.bar.Close = this.bar.High;
							bar.Low = this.bar.High;
						}
						if (this.bar.Low == price)
						{
							this.bar.Low = this.bar.High - (double)this.barSize / 10000.0;
							this.bar.Close = this.bar.Low;
							bar.High = this.bar.Low;
						}
						this.EmitNewCompressedBar();
						this.bar = bar;
						flag = 10000.0 * (this.bar.High - this.bar.Low) < (double)this.barSize;
					}
					else
						flag = true;
				}
			}
		}
예제 #8
0
 public override void Add(CompressorDataItem data)
 {
     if (this.bar == null)
     {
         this.CreateNewBar(BarType.Tick, data.DateTime, data.DateTime, data.Items[0].Price);
     }
     this.AddDataToBar(data.Items);
     this.bar.EndTime = data.DateTime;
     if (this.dataSource.Input == DataSourceInput.Bar)
     {
         this.tickCount += ((BarDataSource)this.dataSource).BarSize;
     }
     else
     {
         ++this.tickCount;
     }
     if (this.tickCount != this.barSize)
     {
         return;
     }
     this.EmitNewCompressedBar();
     this.bar       = null;
     this.tickCount = 0;
 }
예제 #9
0
 public abstract void Add(CompressorDataItem data);
예제 #10
0
		public abstract void Add(CompressorDataItem data);