Ejemplo n.º 1
0
        private void count()
        {
            double takeProfit = getDoubleFromTextBox(takeProfitTextBox);
            double sharePrice = getDoubleFromTextBox(sharePriceTextBox);
            double stopLoss   = getDoubleFromTextBox(stopLossTextBox);

            double commissionsPercentage = (double)commissionsPercentageNumericUpDown.Value;
            double commissionsPerShare   = (double)commissionsPerShareNumericUpDown.Value;
            double commissionsPerTrade   = (double)commissionsPerTradeNumericUpDown.Value;

            double commissionsMinPerTrade           = (double)commissionsMinPerTradeNumericUpDown.Value;
            bool   commissionsMinPerTradePercentage = minimumPerTradePercentageRadioButton.Checked;
            double commissionsMaxPerTrade           = (double)commissionsMaxPerTradeNumericUpDown.Value;
            bool   commissionsMaxPerTradePercentage = maximumPerTradePercentageRadioButton.Checked;

            double riskUnit = getDoubleFromTextBox(riskTextBox);

            double capital = getDoubleFromTextBox(capitalTextBox);

            Info info = new Info(takeProfit, sharePrice, stopLoss, commissionsPercentage,
                                 commissionsPerShare, commissionsPerTrade, commissionsMinPerTrade,
                                 commissionsMinPerTradePercentage, commissionsMaxPerTrade, commissionsMaxPerTradePercentage,
                                 riskUnit, capital);

            Result result = UIInteractions.mainCount(info);

            riskRewardTextBox.Text     = result.riskReward.ToString();
            numberOfSharesTextBox.Text = result.numberOfShares.ToString();
            finalPriceTextBox.Text     = result.finalPrice.ToString();
            gainTextBox.Text           = result.gain.ToString();
            riskingTextBox.Text        = result.risking.ToString();
        }
Ejemplo n.º 2
0
 private void loadUsdbutton_Click(object sender, EventArgs e)
 {
     try
     {
         loadSettings(UIInteractions.loadSettings(), Currency.USD);
         currencyLabel.Text = "USD";
     }
     catch (Exception)
     {
     }
 }
Ejemplo n.º 3
0
        public void saveSettings(Currency currency)
        {
            try
            {
                Settings settings = createSettings(currency);

                UIInteractions.saveSettings(settings, currency);

                capitalTextBox.BackColor = Color.White;
            }
            catch (Exception ex)
            {
                capitalTextBox.BackColor = Color.MediumVioletRed;
            }
        }
Ejemplo n.º 4
0
        public void countRiskUnit()
        {
            double capital;

            Double.TryParse(capitalTextBox.Text, out capital);

            if (capital == 0)
            {
                capitalTextBox.BackColor = Color.MediumVioletRed;
            }
            else
            {
                capitalTextBox.BackColor = Color.White;
            }

            riskTextBox.Text = UIInteractions.countRisk(capital, riskPercentageNumericUpDown.Value).ToString();
        }