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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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); }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }