Exemplo n.º 1
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";
            }
        }
Exemplo n.º 2
0
        public void GetAccount()
        {
            var a = o2g.GetAccount();

            MessageBox.Show("PMC:" + a.PipsToMC);
        }