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"; } }
void ShowSummary(Order2GoAddIn.Summary Summary, Account Account) { var summary = Summary ?? new Order2GoAddIn.Summary(); double buyLossPerLotK; double sellLossPerLotK; SellPL = summary.SellNetPL; SellLots = summary.SellLots; SellLPP = summary.SellLPP; SellPositions = summary.SellPositions; SellPips = (int)(summary.SellDelta / summary.PointSize); BuyPL = summary.BuyNetPL; BuyLots = summary.BuyLots; BuyLPP = summary.BuyLPP; BuyPositions = summary.BuyPositions; BuyPips = (int)(summary.BuyDelta / summary.PointSize); var totalPips = (summary.BuyPriceFirst - summary.SellPriceFirst) / fw.GetPipSize(pair); BuyPipsToNet = summary.BuyNetPLPip; SellPipsToNet = summary.SellNetPLPip; buyLossPerLotK = summary.BuyLots > 0 ? summary.BuyNetPL / (summary.BuyLots / 1000) : 0; sellLossPerLotK = summary.SellLots > 0 ? summary.SellNetPL / (summary.SellLots / 1000) : 0; }