/// <summary> /// insert a bar at particular place in the list. /// REMEMBER YOU MUST REHANDLE GOTNEWBAR EVENT AFTER CALLING THIS. /// </summary> public static BarList InsertBar(BarList bl, Bar b, int position) { BarList copy = new BarList(bl.FullSymbol, bl.AvailableIntervals); for (int j = 0; j < bl.AvailableIntervals.Length; j++) { if (bl.AvailableIntervals[j] != b.Interval) { continue; } int count = bl.IntervalCount(b.Interval); if (count > 0) { for (int i = 0; i < count; i++) { if (i == position) { AddBar(copy, b, j); } AddBar(copy, bl[i, b.Interval], j); } } else { AddBar(copy, b, 0); } } return(copy); }
public BarListTracker(string[] syms, int[] intervals) { _defaultinterval = intervals[0]; foreach (string sym in syms) { BarList bl = new BarList(sym, intervals); bl.DefaultInterval = _defaultinterval; bl.NewBarHandler += bl_NewBarHandler; _bdict.Add(sym, bl); } }
public BarList this[string fullsymbol, int interval] { get { BarList bl; if (_bdict.TryGetValue(fullsymbol, out bl)) { bl.DefaultInterval = interval; } else { bl = new BarList(fullsymbol, interval); } return(bl); } }
internal static void AddBar(BarList b, Bar mybar, int instdataidx) { b._intervaldata[instdataidx].AddBar(mybar); }
public BarList this[string fullsymbol, int interval] { get { BarList bl; if (_bdict.TryGetValue(fullsymbol,out bl)) { bl.DefaultInterval = interval; } else { bl = new BarList(fullsymbol, interval); } return bl; } }
/// <summary> /// insert a bar at particular place in the list. /// REMEMBER YOU MUST REHANDLE GOTNEWBAR EVENT AFTER CALLING THIS. /// </summary> public static BarList InsertBar(BarList bl, Bar b, int position) { BarList copy = new BarList(bl.FullSymbol, bl.AvailableIntervals); for (int j = 0; j < bl.AvailableIntervals.Length; j++) { if (bl.AvailableIntervals[j] != b.Interval) continue; int count = bl.IntervalCount(b.Interval); if (count > 0) { for (int i = 0; i < count; i++) { if (i == position) { AddBar(copy, b, j); } AddBar(copy, bl[i, b.Interval], j); } } else AddBar(copy, b, 0); } return copy; }