CommissionInMoney() public static method

Calculates the commission in currency.
public static CommissionInMoney ( double lots, double price, bool isPosClosing ) : double
lots double
price double
isPosClosing bool
return double
        /// <summary>
        /// Calculates the result
        /// </summary>
        private void Calculate()
        {
            bool         isLong       = (CbxDirection.SelectedIndex == 0);
            PosDirection posDir       = isLong ? PosDirection.Long : PosDirection.Short;
            int          lotSize      = Data.InstrProperties.LotSize;
            var          lots         = (double)NUDLots.Value;
            var          entryPrice   = (double)NUDEntryPrice.Value;
            var          exitPrice    = (double)NUDExitPrice.Value;
            var          daysRollover = (int)NUDDays.Value;
            double       point        = Data.InstrProperties.Point;
            string       unit         = " " + Configs.AccountCurrency;
            double       entryValue   = lots * lotSize * entryPrice;
            double       exitValue    = lots * lotSize * exitPrice;

            // Required margin
            double requiredMargin = (lots * lotSize / Configs.Leverage) *
                                    (entryPrice / Backtester.AccountExchangeRate(entryPrice));

            AlblOutputValues[0].Text = requiredMargin.ToString("F2") + unit;

            // Gross Profit
            double grossProfit = (isLong ? exitValue - entryValue : entryValue - exitValue) /
                                 Backtester.AccountExchangeRate(exitPrice);

            AlblOutputValues[1].Text = grossProfit.ToString("F2") + unit;

            // Spread
            double spread = Data.InstrProperties.Spread * point * lots * lotSize / Backtester.AccountExchangeRate(exitPrice);

            AlblOutputValues[2].Text = spread.ToString("F2") + unit;

            // Entry Commission
            double entryCommission = Backtester.CommissionInMoney(lots, entryPrice, false);

            AlblOutputValues[3].Text = entryCommission.ToString("F2") + unit;

            // Exit Commission
            double exitCommission = Backtester.CommissionInMoney(lots, exitPrice, true);

            AlblOutputValues[4].Text = exitCommission.ToString("F2") + unit;

            // Rollover
            double rollover = Backtester.RolloverInMoney(posDir, lots, daysRollover, exitPrice);

            AlblOutputValues[5].Text = rollover.ToString("F2") + unit;

            // Slippage
            double slippage = Data.InstrProperties.Slippage * point * lots * lotSize / Backtester.AccountExchangeRate(exitPrice);

            AlblOutputValues[6].Text = slippage.ToString("F2") + unit;

            // Net Profit
            double netProfit = grossProfit - entryCommission - exitCommission - rollover - slippage;

            AlblOutputValues[7].Text = netProfit.ToString("F2") + unit;
        }