void SetData(MA ma, DateTime pivot, int n) { DateTime cur = pivot; int count = 0; while (true) { if (count >= n) { break; } if (_data.ContainsKey(cur)) { double value = _data[cur]; ma.Add(value); ++count; } cur = GetNearestDate(cur.AddDays(-1)); } }