Esempio n. 1
0
 public void StartingBalanceTest()
 {
     StartingBalance startingBalance = new StartingBalance();
     startingBalance.SetupTest();
     startingBalance.TheStartingBalanceTest();
     startingBalance.TeardownTest();
 }
Esempio n. 2
0
        void ShowAccount(Account Account, Order2GoAddIn.Summary Summary)
        {
            AccountBalance   = Account.Balance;
            PipsToMC         = Account.PipsToMC;
            minEquityHistory = (int)Account.Equity;
            LotsLeft         = (int)(Account.UsableMargin * Leverage);
            var tradesAll = fw.GetTrades("");

            NetPL         = tradesAll.GrossInPips();
            UsableMargin  = string.Format("{0:c0}/{1:p1}", Account.UsableMargin, Account.UsableMargin / Account.Equity);
            AccountEquity = Account.Equity;// string.Format("{0:c0}/{1:n1}", Account.Equity, netPL);
            var doCloseLotsOfTrades = tradesAll.Length > app.MainWindows.Count + 1 && Account.Gross > 0;

            Commission = fw.CommisionPending;
            var haveGoodProfit = DensityAverage > 0 && NetPL.Abs() >= DensityAverage;

            if (StartingBalance > 0 && Account.Equity >= StartingBalance ||
                haveGoodProfit ||
                doCloseLotsOfTrades ||
                (priceToExit > 0 &&
                 ((conditionToExit == Condition.LessThen && Summary.PriceCurrent.Average < priceToExit) ||
                  (conditionToExit == Condition.MoreThen && Summary.PriceCurrent.Average > priceToExit)
                 ))
                )
            {
                ClosePositions(this, new RoutedEventArgs());
                StartingBalance = Math.Round(fw.GetAccount().Equity *(1 + PriceToAdd / 100), 0);
                app.RaiseClosingalanceChanged(this, StartingBalance.ToInt());
                RuleToExit = "0";
            }
        }
Esempio n. 3
0
        public virtual string CloseAndReport()
        {
            CurrentBalance -= monServCharge;

            CalculateInterest();

            StringBuilder report = new StringBuilder();

            report.Append("This month's starting balance: ");
            report.Append(string.Format("{0}", StartingBalance.toNAMoney(true)) + "\n");
            report.Append("This month's final balance: ");
            report.Append(string.Format("{0}", CurrentBalance.toNAMoney(true)) + "\n");
            report.Append("This month's total withdrawls: ");
            report.Append(string.Format("{0}", totalWithdraw.toNAMoney(true)) + "\n");
            report.Append("This month's total deposits: ");
            report.Append(string.Format("{0}", totalDeposits.toNAMoney(true)) + "\n");
            report.Append("This month's total number of withdrawls: ");
            report.Append(string.Format("{0}", numWithdraw) + "\n");
            report.Append("This month's total number of deposits: ");
            report.Append(string.Format("{0}", numDeposits) + "\n");
            report.Append("The monthly interest that was calculated this month was:");
            report.Append(string.Format("{0}", (CurrentBalance * (InterestRate / 12)).toNAMoney(true)));

            numWithdraw   = 0;
            numDeposits   = 0;
            monServCharge = 0.0;

            return(report.ToString());
        }
Esempio n. 4
0
        public virtual string CloseAndReport()
        {
            currentBalance -= monthServiceCharge;
            CalculateInterest();
            numberDeposits     = 0;
            numberWithdrawls   = 0;
            monthServiceCharge = 0;
            double percentChange = MyExtension.ExtensionMethod.getPercentageChange();
            string report        = string.Format("Previous Balance: {0:C}\n" +
                                                 "New Balance: {1:C}\n" +
                                                 "Percentage change from the starting the current balances: {2}%"
                                                 , StartingBalance.toNAMoneyFormat(true), CurrentBalance.toNAMoneyFormat(true), percentChange);

            Console.WriteLine(report);
            return(report);
        }
Esempio n. 5
0
        public virtual string CloseAndReport()
        {
            CurrentBalance -= serviceCharge;
            CalculateInterest();

            StringBuilder str = new StringBuilder();

            str.Append("This month's starting balance: " + string.Format("{0}", StartingBalance.ToNAMoney(true)) + "\n");
            str.Append("this month' final balance: " + string.Format("{0}", CurrentBalance.ToNAMoney(true)) + "\n");
            str.Append("This month's total deposits: " + string.Format("{0}", totalDeposit.ToNAMoney(true)) + "\n");
            str.Append("This month's total withdrawls: " + string.Format("{0}", totalWithdrawl.ToNAMoney(true)) + "\n");
            str.Append("This month's number of deposits: " + string.Format("{0}", counterDeposit) + "\n");
            str.Append("This month's number of withdrawls" + string.Format("{0}", counterWithdrawl) + "\n");
            str.Append("The interest for this month was: " + string.Format("{0}", (CurrentBalance * (Interest / 12)).ToNAMoney(true)) + "\n");

            counterWithdrawl = 0;
            counterDeposit   = 0;
            serviceCharge    = 0;


            return(str.ToString());
        }