/// <summary> /// Constructor. /// </summary> static IndicatorManager() { ClosingIndicatorsWithClosingFilters = new List <string>(); CloseFilterIndicators = new List <string>(); OpenFilterIndicators = new List <string>(); ClosePointIndicators = new List <string>(); OpenPointIndicators = new List <string>(); AddOriginalIndicators(); foreach (var record in OriginalIndicators) { AllIndicators.Add(record.Key, record.Value); } }
/// <summary> /// Adds a strategy to the top 10 Layout /// </summary> public void AddStrategyInfo(Top10StrategyInfo top10StrategyInfo) { if (_top10Holder.ContainsKey(top10StrategyInfo.Balance)) { return; } if (_top10Holder.Count == _maxStrategies && top10StrategyInfo.Balance <= _minBalance) { return; } if (_top10Holder.Count == _maxStrategies && top10StrategyInfo.Balance > _minBalance) { _top10Holder.Remove(_minBalance); _top10Holder.Add(top10StrategyInfo.Balance, top10StrategyInfo); } else if (_top10Holder.Count < _maxStrategies) { _top10Holder.Add(top10StrategyInfo.Balance, top10StrategyInfo); } _top10Holder.ReverseSort(); _minBalance = int.MaxValue; _maxBalance = int.MinValue; foreach (var keyValue in _top10Holder) { if (_minBalance > keyValue.Key) { _minBalance = keyValue.Key; } if (_maxBalance < keyValue.Key) { _maxBalance = keyValue.Key; } } foreach (var keyValue in _top10Holder) { keyValue.Value.Top10Slot.IsSelected = false; } _top10Holder[_maxBalance].Top10Slot.IsSelected = true; ArrangeTop10Slots(); SetVerticalScrollBar(); }
/// <summary> /// Adds a strategy to the top 10 Layout /// </summary> public void AddStrategyInfo(Top10StrategyInfo top10StrategyInfo) { if (top10Holder.ContainsKey(top10StrategyInfo.Balance)) { return; } if (top10Holder.Count == maxStrategies && top10StrategyInfo.Balance <= minBalance) { return; } if (top10Holder.Count == maxStrategies && top10StrategyInfo.Balance > minBalance) { top10Holder.Remove(minBalance); top10Holder.Add(top10StrategyInfo.Balance, top10StrategyInfo); } else if (top10Holder.Count < maxStrategies) { top10Holder.Add(top10StrategyInfo.Balance, top10StrategyInfo); } top10Holder.ReverseSort(); minBalance = int.MaxValue; maxBalance = int.MinValue; foreach (KeyValuePair <int, Top10StrategyInfo> keyValue in top10Holder) { if (minBalance > keyValue.Key) { minBalance = keyValue.Key; } if (maxBalance < keyValue.Key) { maxBalance = keyValue.Key; } } foreach (KeyValuePair <int, Top10StrategyInfo> keyValue in top10Holder) { keyValue.Value.Top10Slot.IsSelected = false; } top10Holder[maxBalance].Top10Slot.IsSelected = true; ArrangeTop10Slots(); SetVerticalScrollBar(); }
/// <summary> /// Adds a strategy to the top 10 Layout /// </summary> public void AddStrategyInfo(Top10StrategyInfo strategyInfo) { if (top10Holder.ContainsKey(strategyInfo.Value)) { return; } if (top10Holder.Count == maxStrategies && strategyInfo.Value <= minValue) { return; } if (top10Holder.Count == maxStrategies && strategyInfo.Value > minValue) { top10Holder.Remove(minValue); top10Holder.Add(strategyInfo.Value, strategyInfo); } else if (top10Holder.Count < maxStrategies) { top10Holder.Add(strategyInfo.Value, strategyInfo); } top10Holder.ReverseSort(); minValue = float.MaxValue; maxValue = float.MinValue; foreach (var keyValue in top10Holder) { if (minValue > keyValue.Key) { minValue = keyValue.Key; } if (maxValue < keyValue.Key) { maxValue = keyValue.Key; } } foreach (var keyValue in top10Holder) { keyValue.Value.Top10Slot.IsSelected = false; } top10Holder[maxValue].Top10Slot.IsSelected = true; ArrangeTop10Slots(); SetVerticalScrollBar(); }
/// <summary> /// Resets the custom indicators in the custom indicators list. /// </summary> public static void ResetCustomIndicators(IEnumerable <Indicator> indicatorList) { CustomIndicators.Clear(); if (indicatorList == null) { return; } foreach (Indicator indicator in indicatorList) { if (!CustomIndicators.ContainsKey(indicator.IndicatorName)) { CustomIndicators.Add(indicator.IndicatorName, indicator); } } CustomIndicators.Sort(); }