protected override void OnStrategyChanged() { base.OnStrategyChanged(); SignalNotificationStrategy s = ((SignalNotificationStrategy)Strategy); List <CombinedSignalDataItem> list = new List <CombinedSignalDataItem>(); if (s.StochIndicator == null) { this.combinedSignalDataItemBindingSource.DataSource = list; return; } lock (s.StochIndicator.Result) { lock (s.MacdIndicator.Result) { lock (s.RsiIndicator.Result) { for (int i = 0; i < s.StochIndicator.Count; i++) { CombinedSignalDataItem item = new CombinedSignalDataItem(); item.Index = i; item.Time = s.StochIndicator.Result[i].Time; item.Rsi = ((IndicatorValue)s.RsiIndicator.Result[i]).Value; item.MacdFast = ((IndicatorValue)s.MacdIndicator.FastEmaIndicator.Result[i]).Value; item.MacdSlow = ((IndicatorValue)s.MacdIndicator.SlowEmaIndicator.Result[i]).Value; item.Macd = ((IndicatorValue)s.MacdIndicator.Result[i]).Value; item.MacdSignal = ((IndicatorValue)s.MacdIndicator.SignalMaIndicator.Result[i]).Value; item.StochK = ((StochasticValue)s.StochIndicator.Result[i]).K; item.StochD = ((StochasticValue)s.StochIndicator.Result[i]).D; list.Add(item); } } } } this.combinedSignalDataItemBindingSource.DataSource = list; }
private void comboBoxEdit1_EditValueChanged(object sender, EventArgs e) { SignalNotificationStrategy s = (SignalNotificationStrategy)Strategy; CandleStickIntervalInfo info = (CandleStickIntervalInfo)this.comboBoxEdit1.EditValue; if (info != null) { s.CandleStickIntervalMin = (int)info.Interval.TotalMinutes; } else { s.CandleStickIntervalMin = (int)TimeSpan.FromHours(4).TotalMinutes; } }
protected override void OnStrategyChanged() { //TODO check that ticker correctly initiallized on editing. List <TickerNameInfo> tickerNameList = Exchange.GetTickersNameInfo(); if (tickerNameList == null || tickerNameList.Count == 0) { XtraMessageBox.Show("Tickers list not initialized. Please close editing form (do not press OK button) and then restart application."); return; } this.tickerNameInfoBindingSource.DataSource = tickerNameList; TickerStrategyBase ts = (TickerStrategyBase)Strategy; if (ts.TickerInfo != null) { ts.TickerInfo = tickerNameList.FirstOrDefault(t => t.Ticker == ts.TickerInfo.Ticker); } this.signalNotificationStrategyBindingSource.DataSource = Strategy; string faultExchanges = string.Empty; foreach (Exchange e in Exchange.Registered) { if (e.Tickers.Count == 0) { if (!string.IsNullOrEmpty(faultExchanges)) { faultExchanges += ", "; } faultExchanges += e.Name; } } SignalNotificationStrategy s = (SignalNotificationStrategy)Strategy; if (s.TickerInfo != null) { this.candleStickIntervalInfoBindingSource.DataSource = Exchange.Get(s.TickerInfo.Exchange).AllowedCandleStickIntervals; this.comboBoxEdit1.EditValue = Exchange.Get(s.TickerInfo.Exchange).AllowedCandleStickIntervals.FirstOrDefault(i => (int)(i.Interval.TotalMinutes) == s.CandleStickIntervalMin); } if (!string.IsNullOrEmpty(faultExchanges)) { XtraMessageBox.Show("Warning: failed load tickers for the following exchanges: " + faultExchanges); } }