public static DataSeries operator *(DataSeries d1, DataSeries d2) { DataSeries retVal = new DataSeries(); if (d1.Count <= d2.Count) { for (int idx = 0; idx < d1.Count; idx++) { retVal.Add(d1[idx] * d2[idx]); } for (int idx = d1.Count; idx < d2.Count; idx++) { retVal.Add(d2[idx]); } } else { for (int idx = 0; idx < d2.Count; idx++) { retVal.Add(d1[idx] * d2[idx]); } for (int idx = d2.Count; idx < d1.Count; idx++) { retVal.Add(d1[idx]); } } return(retVal); }
private static commonClass.DataSeries MakeData(databases.tmpDS.marketDataDataTable dataTbl, DataFields type) { commonClass.DataSeries ds = new commonClass.DataSeries(); switch (type) { case DataFields.Count: for (int idx = 0; idx < dataTbl.Count; idx++) { ds.Add(dataTbl[idx].val0); } break; case DataFields.Volume: for (int idx = 0; idx < dataTbl.Count; idx++) { ds.Add(dataTbl[idx].val1); } break; case DataFields.DateTime: for (int idx = 0; idx < dataTbl.Count; idx++) { ds.Add(dataTbl[idx].onDate.ToOADate()); } break; } return(ds); }
private static commonClass.DataSeries MakeData(databases.tmpDS.marketDataDataTable dataTbl, DataFields type) { commonClass.DataSeries ds = new commonClass.DataSeries(); switch (type) { case DataFields.Count: for (int idx = 0; idx < dataTbl.Count; idx++) ds.Add(dataTbl[idx].val0); break; case DataFields.Volume: for (int idx = 0; idx < dataTbl.Count; idx++) ds.Add(dataTbl[idx].val1); break; case DataFields.DateTime: for (int idx = 0; idx < dataTbl.Count; idx++) ds.Add(dataTbl[idx].onDate.ToOADate()); break; } return ds; }
public static DataSeries operator >>(DataSeries ds, int n) { DataSeries retVal = new DataSeries(); for (int idx = 0; idx < n; idx++) { retVal.Add(0); } for (int idx = 0; idx < ds.Count; idx++) { retVal.Add(ds[idx]); } retVal.FirstValidValue = ds.FirstValidValue + n; return(retVal); }
public void Add(double _open, double _high, double _low, double _close, double _volume, double _dateTime) { Open.Add(_open); High.Add(_high); Low.Add(_low); Close.Add(_close); Volume.Add(_volume); DateTime.Add(_dateTime); return; }
public static DataSeries operator *(double d, DataSeries ds) { DataSeries retVal = new DataSeries(); for (int idx = 0; idx < ds.Count; idx++) { retVal.Add(ds[idx] * d); } retVal.FirstValidValue = ds.FirstValidValue; return(retVal); }
public static DataSeries operator /(DataSeries ds, double d) { DataSeries retVal = new DataSeries(); if (d != 0) { for (int idx = 0; idx < ds.Count; idx++) { retVal.Add(ds[idx] / d); } } else { for (int idx = 0; idx < ds.Count; idx++) { retVal.Add(0); } } retVal.FirstValidValue = ds.FirstValidValue; return(retVal); }
public static DataSeries operator <<(DataSeries ds, int n) { DataSeries retVal = new DataSeries(); for (int idx = n; idx < ds.Count; idx++) { retVal.Add(ds[idx]); } retVal.FirstValidValue = ds.FirstValidValue - n; if (retVal.FirstValidValue < 0) { retVal.FirstValidValue = 0; } return(retVal); }
public static DataSeries operator <<(DataSeries ds, int n) { DataSeries retVal = new DataSeries(); for (int idx = n; idx < ds.Count; idx++) retVal.Add(ds[idx]); retVal.FirstValidValue = ds.FirstValidValue - n; if (retVal.FirstValidValue < 0) retVal.FirstValidValue = 0; return retVal; }
public static DataSeries operator >>(DataSeries ds, int n) { DataSeries retVal = new DataSeries(); for (int idx = 0; idx < n; idx++) retVal.Add(0); for (int idx = 0; idx < ds.Count; idx++) retVal.Add(ds[idx]); retVal.FirstValidValue = ds.FirstValidValue + n; return retVal; }
public static DataSeries operator *(DataSeries d1, DataSeries d2) { DataSeries retVal = new DataSeries(); if (d1.Count <= d2.Count) { for (int idx = 0; idx < d1.Count; idx++) retVal.Add(d1[idx] * d2[idx]); for (int idx = d1.Count; idx < d2.Count; idx++) retVal.Add(d2[idx]); } else { for (int idx = 0; idx < d2.Count; idx++) retVal.Add(d1[idx] * d2[idx]); for (int idx = d2.Count; idx < d1.Count; idx++) retVal.Add(d1[idx]); } return retVal; }
public static DataSeries operator *(double d, DataSeries ds) { DataSeries retVal = new DataSeries(); for (int idx = 0; idx < ds.Count; idx++) retVal.Add(ds[idx] * d); retVal.FirstValidValue = ds.FirstValidValue; return retVal; }
public static DataSeries operator /(DataSeries ds, double d) { DataSeries retVal = new DataSeries(); if (d != 0) for (int idx = 0; idx < ds.Count; idx++) retVal.Add(ds[idx] / d); else for (int idx = 0; idx < ds.Count; idx++) retVal.Add(0); retVal.FirstValidValue = ds.FirstValidValue; return retVal; }
public static DataSeries operator -(DataSeries d1, DataSeries d2) { DataSeries retVal = new DataSeries(); if (d1.Count <= d2.Count) { for (int idx = 0; idx < d1.Count; idx++) retVal.Add(d1[idx] - d2[idx]); for (int idx = d1.Count; idx < d2.Count; idx++) retVal.Add(-d2[idx]); } else { for (int idx = 0; idx < d2.Count; idx++) retVal.Add(d1[idx] - d2[idx]); for (int idx = d2.Count; idx < d1.Count; idx++) retVal.Add(-d1[idx]); } retVal.FirstValidValue = d1.FirstValidValue; return retVal; }
public void PlotProfitChart() { string saveSort = tradeEstimateSource.Sort; tradeEstimateSource.Sort = ""; databases.tmpDS.tradeEstimateDataTable tbl = tradeEstimateSource.DataSource as databases.tmpDS.tradeEstimateDataTable; chartPnl.ResetGraph(); chartPnl.RemoveAllCurves(); DataSeries xSeries = new DataSeries(); DataSeries ySeries = new DataSeries(); for (int idx = 0; idx < tbl.Count; idx++) { if (!allTransactionMenuItem.Checked && tbl[idx].ignored) continue; ySeries.Add((double)tbl[idx].profit); xSeries.Add(tbl[idx].onDate.ToOADate()); } //Handle bug in graph for curve with only on point ???? if (ySeries.Count > 1) { chartPnl.myGraphObj.SetSeriesX(xSeries.Values, Charts.AxisType.DateAsOrdinal); chartPnl.myGraphObj.SetFont(Settings.sysChartFontSize); chartPnl.myGraphObj.ChartMarginTOP = constProfitChartMarginTOP; chartPnl.myGraphObj.ChartMarginBOTTOM = constProfitChartMarginBOTTOM; CurveItem curveItem = chartPnl.myGraphObj.AddCurveBar("profit", ySeries.Values, Settings.sysChartVolumesColor, Settings.sysChartVolumesColor, 1); chartPnl.myGraphObj.DefaultViewport(); chartPnl.PlotGraph(); } tradeEstimateSource.Sort = saveSort; }