示例#1
0
        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 = Strategy as TickerStrategyBase;

            if (ts?.TickerInfo != null)
            {
                ts.TickerInfo = tickerNameList.FirstOrDefault(t => t.Ticker == ts.TickerInfo.Ticker);
            }

            this.signalNotificationStrategyBindingSource.DataSource = Strategy;

            if (ts?.TickerInfo != null)
            {
                this.candleStickIntervalInfoBindingSource.DataSource = Exchange.Get(ts.TickerInfo.Exchange).AllowedCandleStickIntervals;
                this.comboBoxEdit1.EditValue = GetAllowedCandleSticksIntervals(ts).FirstOrDefault(i => (int)i.Interval.TotalMinutes == ts.CandleStickIntervalMin);
            }
            CheckUnreachableExchanges();
        }
        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);
            }
        }
        private void OnStrategyTickerClick(object sender, ItemClickEventArgs e)
        {
            if (e.Item.Tag == null)
            {
                return;
            }
            Ticker ticker = (Ticker)e.Item.Tag;

            if (StrategyType == null)
            {
                return;
            }
            TickerStrategyBase strategy = (TickerStrategyBase)StrategyType.GetConstructor(new Type[] { typeof(Ticker) }).Invoke(new object[] { ticker });

            using (TickerStrategyParametersForm form = new TickerStrategyParametersForm()) {
                form.Strategy = strategy;
                form.ShowDialog();
                if (form.DialogResult == DialogResult.Cancel)
                {
                    return;
                }
            }
        }
示例#4
0
        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.simpleBuyLowSellHighStrategyBindingSource.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;
                }
            }
            if (!string.IsNullOrEmpty(faultExchanges))
            {
                XtraMessageBox.Show("Warning: failed load tickers for the following exchanges: " + faultExchanges);
            }
        }