예제 #1
0
        private void okButton_Click(object sender, EventArgs e)
        {
            if (radioButtonRsi.Checked)
            {
                if (cmbRsiTime.SelectedItem == null)
                {
                    MessageBox.Show("Time is missing");
                    return;
                }

                IndicatorTime.TryParse(cmbRsiTime.SelectedItem.ToString(), out IndicatorTime time);
                _strategy = new RsiBotStrategy()
                {
                    Options = new RsiOptions(time, (int)numRsiPoints.Value)
                };
            }

            if (radioButtonTradingView.Checked)
            {
                if (cmbTradingViewTime.SelectedItem == null)
                {
                    MessageBox.Show("Time is missing");
                    return;
                }
                if (cmbTradingViewType.SelectedItem == null)
                {
                    MessageBox.Show("Type is missing");
                    return;
                }

                TradingViewTime.TryParse(cmbTradingViewTime.SelectedItem.ToString(), out TradingViewTime time);
                TradingViewIndicatorType.TryParse(cmbTradingViewType.SelectedItem.ToString(), out TradingViewIndicatorType type);
                _strategy = new TradingViewBotStrategy()
                {
                    Options = new TradingViewOptions(type, time)
                };
            }

            if (radioButtonManual.Checked)
            {
                _strategy = new ManualStrategy();
            }
            if (radioButtonNonstop.Checked)
            {
                _strategy = new NonStopBotStrategy();
            }

            this.DialogResult = DialogResult.OK;
        }
예제 #2
0
        private void okButton_Click(object sender, EventArgs e)
        {
            if (radioButtonQfl.Checked)
            {
                if (cmbQflType.SelectedItem == null)
                {
                    MessageBox.Show("QFL Type is missing");
                    return;
                }

                if (numQflPercent.Value == 0)
                {
                    MessageBox.Show("QFL Percentage is missing");
                    return;
                }

                QflType.TryParse(cmbQflType.SelectedItem.ToString(), out QflType type);
                _strategy = new QflBotStrategy()
                {
                    Options = new QflOptions(type, numQflPercent.Value)
                };
            }

            if (radioButtonRsi.Checked)
            {
                if (cmbRsiTime.SelectedItem == null)
                {
                    MessageBox.Show("Time is missing");
                    return;
                }

                IndicatorTime.TryParse(cmbRsiTime.SelectedItem.ToString(), out IndicatorTime time);
                _strategy = new RsiBotStrategy()
                {
                    Options = new RsiOptions(time, (int)numRsiPoints.Value)
                };
            }

            if (radioButtonUlt.Checked)
            {
                if (cmbUltTime.SelectedItem == null)
                {
                    MessageBox.Show("Time is missing");
                    return;
                }

                IndicatorTime.TryParse(cmbUltTime.SelectedItem.ToString(), out IndicatorTime time);
                _strategy = new UltBotStrategy()
                {
                    Options = new UltOptions(time, (int)numUltPoints.Value)
                };
            }

            if (radioButtonTradingView.Checked)
            {
                if (cmbTradingViewTime.SelectedItem == null)
                {
                    MessageBox.Show("Time is missing");
                    return;
                }
                if (cmbTradingViewType.SelectedItem == null)
                {
                    MessageBox.Show("Type is missing");
                    return;
                }

                TradingViewTime.TryParse(cmbTradingViewTime.SelectedItem.ToString(), out TradingViewTime time);
                TradingViewIndicatorType.TryParse(cmbTradingViewType.SelectedItem.ToString(), out TradingViewIndicatorType type);
                _strategy = new TradingViewBotStrategy()
                {
                    Options = new TradingViewOptions(type, time)
                };
            }

            if (radioButtonTaPresets.Checked)
            {
                if (cmbTaPresetsTime.SelectedItem == null)
                {
                    MessageBox.Show("Time is missing");
                    return;
                }
                if (cmbTaPresetsType.SelectedItem == null)
                {
                    MessageBox.Show("Type is missing");
                    return;
                }

                IndicatorTime.TryParse(cmbTaPresetsTime.SelectedItem.ToString(), out IndicatorTime time);
                TaPresetsType.TryParse(cmbTaPresetsType.SelectedItem.ToString(), out TaPresetsType type);
                _strategy = new TaPresetsBotStrategy {
                    Options = new TaPresetsOptions(type, time)
                };
            }

            if (radioButtonManual.Checked)
            {
                _strategy = new ManualStrategy();
            }
            if (radioButtonNonstop.Checked)
            {
                _strategy = new NonStopBotStrategy();
            }

            if (radioButtonCustom.Checked)
            {
                if (string.IsNullOrWhiteSpace(txtCustom.Text))
                {
                    MessageBox.Show("Name is missing");
                    return;
                }
                _strategy = new UnknownStrategy(txtCustom.Text);
            }

            if (radioButtonMarketplaceItems.Checked)
            {
                if (cmbMarketplaceSignals.SelectedItem == null)
                {
                    MessageBox.Show("No Item selected");
                    return;
                }
                _strategy = new UnknownStrategy(((MarketplaceItem)cmbMarketplaceSignals.SelectedItem).StrategyKey);
            }

            this.DialogResult = DialogResult.OK;
        }