Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
 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);
     }
 }
Exemplo n.º 5
0
 internal static void AddBar(BarList b, Bar mybar, int instdataidx)
 {
     b._intervaldata[instdataidx].AddBar(mybar);
 }
Exemplo n.º 6
0
 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;
     }
 }
Exemplo n.º 7
0
 internal static void AddBar(BarList b, Bar mybar, int instdataidx)
 {
     b._intervaldata[instdataidx].AddBar(mybar);
 }
Exemplo n.º 8
0
        /// <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;
        }