示例#1
0
        public DoubleSeries GetArray(int index1, int index2, BarData barData)
        {
            DoubleSeries ds = new DoubleSeries();

            for (int i = index1; i <= index2; ++i)
            {
                ds.Add(this.GetDateTime(i), this[i, barData]);
            }
            return(ds);
        }
示例#2
0
        public DoubleSeries GetOpenIntSeries()
        {
            DoubleSeries ds = new DoubleSeries(this.Name);

            for (int i = 0; i < this.Count; ++i)
            {
                ds.Add(this[i].DateTime, this[i].OpenInt);
            }
            return(ds);
        }
示例#3
0
        public DoubleSeries Pow(double Pow)
        {
            DoubleSeries ds = this.GetType().GetConstructor(new Type[0]).Invoke(new object[0]) as DoubleSeries;

            ds.fName  = this.fName;
            ds.fTitle = this.fTitle;
            for (int i = 0; i < this.Count; ++i)
            {
                ds.Add(this.GetDateTime(i), Math.Pow(this[i, 0], Pow));
            }
            return(ds);
        }
示例#4
0
        public DoubleSeries GetCloseSeries(DateTime date1, DateTime date2)
        {
            DoubleSeries ds = new DoubleSeries(this.Name);

            for (int i = 0; i < this.Count; ++i)
            {
                if (this[i].DateTime >= date1 && this[i].DateTime <= date2)
                {
                    ds.Add(this[i].DateTime, this[i].Close);
                }
            }
            return(ds);
        }
示例#5
0
        public DoubleSeries GetOpenIntSeries(DateTime date1, DateTime date2)
        {
            DoubleSeries doubleSeries = new DoubleSeries(this.Name);

            for (int index = 0; index < this.Count; ++index)
            {
                if (this[index].DateTime >= date1 && this[index].DateTime <= date2)
                {
                    doubleSeries.Add(this[index].DateTime, (double)this[index].OpenInt);
                }
            }
            return(doubleSeries);
        }
示例#6
0
        public virtual DoubleSeries GetNegativeSeries()
        {
            DoubleSeries ds = new DoubleSeries();

            for (int i = 0; i < this.Count; ++i)
            {
                if (this[i] < 0.0)
                {
                    ds.Add(this.GetDateTime(i), this[i]);
                }
            }
            return(ds);
        }
示例#7
0
 protected override void OnUpdateChart(ICollection<IDataObject> objects)
 {
   DoubleSeries doubleSeries = new DoubleSeries("Trade");
   using (IEnumerator<IDataObject> enumerator = ((IEnumerable<IDataObject>) objects).GetEnumerator())
   {
     while (((IEnumerator) enumerator).MoveNext())
     {
       Trade trade = (Trade) enumerator.Current;
       doubleSeries.Add(trade.DateTime, trade.Price);
     }
   }
   ((TimeSeries) doubleSeries).Draw(Color.Black);
 }
示例#8
0
        public static DoubleSeries operator *(double val, DoubleSeries series)
        {
            if (series == null)
            {
                throw new ArgumentException("series == null");
            }
            DoubleSeries ds = new DoubleSeries("series1.Name" + series.Name);

            for (int i = 0; i < series.Count; ++i)
            {
                ds.Add(series.GetDateTime(i), val * series[i, 0]);
            }
            return(ds);
        }
示例#9
0
        public virtual DoubleSeries GetPercentReturnSeries()
        {
            DoubleSeries ds = new DoubleSeries(this.fName, this.fTitle);

            if (this.Count > 1)
            {
                double t0 = this[0];
                for (int i = 0; i < this.Count; ++i)
                {
                    DateTime dt = this.GetDateTime(i);
                    double   t1 = this[i];
                    if (t0 != 0.0)
                    {
                        ds.Add(dt, (t1 / t0 - 1.0) * 100.0);
                    }
                    else
                    {
                        ds.Add(dt, 0.0);
                    }
                    t0 = t1;
                }
            }
            return(ds);
        }
示例#10
0
    protected override void OnUpdateChart(ICollection<IDataObject> objects)
    {
      DoubleSeries doubleSeries1 = new DoubleSeries("Bid");
      DoubleSeries doubleSeries2 = new DoubleSeries("Ask");
      using (IEnumerator<IDataObject> enumerator = ((IEnumerable<IDataObject>) objects).GetEnumerator())
      {
        while (((IEnumerator) enumerator).MoveNext())
        {
          Quote quote = (Quote) enumerator.Current;
          doubleSeries1.Add(quote.DateTime, quote.Bid);
					doubleSeries2.Add(quote.DateTime, quote.Ask);
        }
      }
      ((TimeSeries) doubleSeries1).Draw(Color.Blue);
      ((TimeSeries) doubleSeries2).Draw(Color.Red);
    }
示例#11
0
        public static DoubleSeries operator /(DoubleSeries series1, DoubleSeries series2)
        {
            if (series1 == null || series2 == null)
            {
                throw new ArgumentException("series1 = null || series2 == null");
            }
            DoubleSeries ds = new DoubleSeries("series1.Name" + series1.Name + "series2.Name" + series2.Name);

            for (int i = 0; i < series1.Count; ++i)
            {
                DateTime dt = series1.GetDateTime(i);
                if (series2.Contains(dt) && series2[dt] != 0.0)
                {
                    ds.Add(dt, series1[dt, EIndexOption.Null] / series2[dt, EIndexOption.Null]);
                }
            }
            return(ds);
        }
示例#12
0
文件: BarSeries.cs 项目: heber/FreeOQ
		public DoubleSeries GetHighSeries()
		{
			DoubleSeries ds = new DoubleSeries(this.Name + "HighSeries");
			for (int i = 0; i < this.Count; ++i)
				ds.Add(this[i].DateTime, this[i].High);
			return ds;
		}
示例#13
0
文件: BarSeries.cs 项目: heber/FreeOQ
		public DoubleSeries GetLowSeries()
		{
			DoubleSeries doubleSeries = new DoubleSeries(this.Name + "LowSeries");
			for (int index = 0; index < this.Count; ++index)
				doubleSeries.Add(this[index].DateTime, this[index].Low);
			return doubleSeries;
		}
示例#14
0
文件: BarSeries.cs 项目: heber/FreeOQ
		public DoubleSeries GetCloseSeries()
		{
			DoubleSeries doubleSeries = new DoubleSeries(this.Name + "CloseSeries");
			for (int i = 0; i < this.Count; ++i)
				doubleSeries.Add(this[i].DateTime, this[i].Close);
			return doubleSeries;
		}
示例#15
0
文件: VCH.cs 项目: heber/FreeOQ
 public static double Value(TimeSeries input, int index, int length1, int length2)
 {
   if (index < length2 - 1 + input.FirstIndex)
     return double.NaN;
   DoubleSeries doubleSeries = new DoubleSeries();
   for (int index1 = 0; index1 <= index; ++index1)
     doubleSeries.Add(input.GetDateTime(index1), input[index1, BarData.High] - input[index1, BarData.Low]);
   EMA ema = new EMA((TimeSeries) doubleSeries, length1, BarData.Close);
   return (ema[index] - ema[index - length2 + 1]) / ema[index - length2 + 1] * 100.0;
 }
示例#16
0
		public virtual DoubleSeries GetNegativeSeries()
		{
			DoubleSeries ds = new DoubleSeries();
			for (int i = 0; i < this.Count; ++i)
			{
				if (this[i] < 0.0)
					ds.Add(this.GetDateTime(i), this[i]);
			}
			return ds;
		}
示例#17
0
文件: BarSeries.cs 项目: heber/FreeOQ
		public DoubleSeries GetOpenIntSeries()
		{
			DoubleSeries doubleSeries = new DoubleSeries(this.Name + "OpenIntSeries");
			for (int i = 0; i < this.Count; ++i)
				doubleSeries.Add(this[i].DateTime, (double)this[i].OpenInt);
			return doubleSeries;
		}
示例#18
0
文件: PnFSeries.cs 项目: heber/FreeOQ
		public DoubleSeries GetArray(int index1, int index2, BarData barData)
		{
			DoubleSeries ds = new DoubleSeries();
			for (int i = index1; i <= index2; ++i)
				ds.Add(this.GetDateTime(i), this[i, barData]);
			return ds;
		}
示例#19
0
		public static DoubleSeries operator *(DoubleSeries series, double val)
		{
			if (series == null)
				throw new ArgumentException("series == null");
			DoubleSeries ds = new DoubleSeries("series1.Name" + series.Name);
			for (int i = 0; i < series.Count; ++i)
				ds.Add(series.GetDateTime(i), series[i, 0] * val);
			return ds;
		}
示例#20
0
		public static DoubleSeries operator /(DoubleSeries series1, DoubleSeries series2)
		{
			if (series1 == null || series2 == null)
				throw new ArgumentException("series1 = null || series2 == null");
			DoubleSeries ds = new DoubleSeries("series1.Name" + series1.Name + "series2.Name" + series2.Name);
			for (int i = 0; i < series1.Count; ++i)
			{
				DateTime dt = series1.GetDateTime(i);
				if (series2.Contains(dt) && series2[dt] != 0.0)
					ds.Add(dt, series1[dt, EIndexOption.Null] / series2[dt, EIndexOption.Null]);
			}
			return ds;
		}
示例#21
0
文件: Indicator.cs 项目: heber/FreeOQ
		public override DoubleSeries GetNegativeSeries()
		{
			DoubleSeries ds = new DoubleSeries();
			for (int i = this.fFirstIndex; i < this.fLastIndex; ++i)
			{
				if (this[i] < 0.0)
				{
					ds.Add(this.GetDateTime(i), this[i]);
				}
			}
			return ds;
		}
示例#22
0
文件: PnFSeries.cs 项目: heber/FreeOQ
		public DoubleSeries GetCloseSeries(DateTime date1, DateTime date2)
		{
			DoubleSeries ds = new DoubleSeries(this.Name);
			for (int i = 0; i < this.Count; ++i)
			{
				if (this[i].DateTime >= date1 && this[i].DateTime <= date2)
					ds.Add(this[i].DateTime, this[i].Close);
			}
			return ds;
		}
示例#23
0
文件: TRIX.cs 项目: heber/FreeOQ
 public static double Value(TimeSeries input, int index, int length, BarData option)
 {
   if (index < 1 + input.FirstIndex)
     return double.NaN;
   DoubleSeries doubleSeries = new DoubleSeries();
   for (int firstIndex = input.FirstIndex; firstIndex <= index; ++firstIndex)
     doubleSeries.Add(input.GetDateTime(firstIndex), input[firstIndex, option]);
   EMA ema = new EMA((TimeSeries) new EMA((TimeSeries) new EMA((TimeSeries) doubleSeries, length, option), length, option), length, option);
   return (ema[index - input.FirstIndex] - ema[index - 1 - input.FirstIndex]) / ema[index - 1 - input.FirstIndex] * 100.0;
 }
示例#24
0
文件: VOSC.cs 项目: heber/FreeOQ
 public static double Value(TimeSeries input, int index, int length1, int length2)
 {
   if (index < length1 - 1 + input.FirstIndex || index < length2 - 1 + input.FirstIndex)
     return double.NaN;
   DoubleSeries doubleSeries = new DoubleSeries();
   for (int index1 = index; index1 > index - Math.Max(length1, length2); --index1)
     doubleSeries.Add(input.GetDateTime(index1), input[index1, BarData.Volume]);
   return SMA.Value((TimeSeries) doubleSeries, length1 - 1, length1, BarData.Close) - SMA.Value((TimeSeries) doubleSeries, length2 - 1, length2, BarData.Close);
 }
示例#25
0
文件: BarSeries.cs 项目: heber/FreeOQ
		public DoubleSeries GetVolumeSeries()
		{
			DoubleSeries doubleSeries = new DoubleSeries(this.Name + "VolumeSeries");
			for (int i = 0; i < this.Count; ++i)
				doubleSeries.Add(this[i].DateTime, (double)this[i].Volume);
			return doubleSeries;
		}
示例#26
0
		public static DoubleSeries operator /(double val, DoubleSeries series)
		{
			if (series == null)
				throw new ArgumentException("series == null");
			DoubleSeries ds = new DoubleSeries("series1.Name" + series.Name);
			for (int i = 0; i < series.Count; ++i)
			{
				if (series[i, 0] != 0.0)
					ds.Add(series.GetDateTime(i), val / series[i, 0]);
			}
			return ds;
		}
示例#27
0
文件: MASS.cs 项目: heber/FreeOQ
 public static double Value(TimeSeries input, int index, int length, int order)
 {
   if (index < length - 1 + input.FirstIndex)
     return double.NaN;
   DoubleSeries doubleSeries = new DoubleSeries();
   double num = 0.0;
   for (int index1 = 0; index1 <= index; ++index1)
     doubleSeries.Add(input.GetDateTime(index1), input[index1, BarData.High] - input[index1, BarData.Low]);
   EMA ema1 = new EMA((TimeSeries) doubleSeries, order, BarData.Close);
   EMA ema2 = new EMA((TimeSeries) ema1, order, BarData.Close);
   for (int index1 = index; index1 > index - length; --index1)
     num += ema1[index1] / ema2[index1];
   return num;
 }
示例#28
0
		public virtual DoubleSeries GetPercentReturnSeries()
		{
			DoubleSeries ds = new DoubleSeries(this.fName, this.fTitle);
			if (this.Count > 1)
			{
				double t0 = this[0];
				for (int i = 0; i < this.Count; ++i)
				{
					DateTime dt = this.GetDateTime(i);
					double t1 = this[i];
					if (t0 != 0.0)
						ds.Add(dt, (t1 / t0 - 1.0) * 100.0);
					else
						ds.Add(dt, 0.0);
					t0 = t1;
				}
			}
			return ds;
		}
示例#29
0
文件: PnFSeries.cs 项目: heber/FreeOQ
		public DoubleSeries GetOpenIntSeries()
		{
			DoubleSeries ds = new DoubleSeries(this.Name);
			for (int i = 0; i < this.Count; ++i)
				ds.Add(this[i].DateTime, this[i].OpenInt);
			return ds;
		}
示例#30
0
文件: BarSeries.cs 项目: heber/FreeOQ
		public DoubleSeries GetVolumeSeries(DateTime date1, DateTime date2)
		{
			DoubleSeries doubleSeries = new DoubleSeries(this.Name + "VolumeSeries");
			for (int i = 0; i < this.Count; ++i)
			{
				if (this[i].DateTime >= date1 && this[i].DateTime <= date2)
					doubleSeries.Add(this[i].DateTime, (double)this[i].Volume);
			}
			return doubleSeries;
		}
示例#31
0
文件: PnFSeries.cs 项目: heber/FreeOQ
		public DoubleSeries GetOpenIntSeries(DateTime date1, DateTime date2)
		{
			DoubleSeries doubleSeries = new DoubleSeries(this.Name);
			for (int index = 0; index < this.Count; ++index)
			{
				if (this[index].DateTime >= date1 && this[index].DateTime <= date2)
					doubleSeries.Add(this[index].DateTime, (double)this[index].OpenInt);
			}
			return doubleSeries;
		}
示例#32
0
文件: Indicator.cs 项目: heber/FreeOQ
		public override DoubleSeries GetPercentReturnSeries()
		{
			DoubleSeries ds = new DoubleSeries(this.Name, this.Title);
			if (this.fRealCount > 1)
			{
				double t0 = this[0];
				for (int i = this.fFirstIndex; i < this.fLastIndex; ++i)
				{
					DateTime dt = this.GetDateTime(i);
					double t1 = this[i];
					if (t0 != 0.0)
						ds.Add(dt, (t1 / t0 - 1.0) * 100.0);
					else
						ds.Add(dt, 0.0);
					t0 = t1;
				}
			}
			return ds;
		}