Ejemplo n.º 1
0
        /// <summary>
        /// Generate the Account Statistics in pips.
        /// </summary>
        static void GenerateAccountStats()
        {
            accountStatsParam = new string[26]
            {
                Language.T("Intrabar scanning"),
                Language.T("Interpolation method"),
                Language.T("Ambiguous bars"),
                Language.T("Profit per day"),
                Language.T("Tested bars"),
                Language.T("Account balance"),
                Language.T("Minimum account"),
                Language.T("Maximum account"),
                Language.T("Maximum drawdown"),
                Language.T("Max equity drawdown"),
                Language.T("Max equity drawdown"),
                Language.T("Gross profit"),
                Language.T("Gross loss"),
                Language.T("Sent orders"),
                Language.T("Executed orders"),
                Language.T("Traded lots"),
                Language.T("Winning trades"),
                Language.T("Losing trades"),
                Language.T("Win/loss ratio"),
                Language.T("Time in position"),
                Language.T("Charged spread"),
                Language.T("Charged rollover"),
                Language.T("Charged commission"),
                Language.T("Charged slippage"),
                Language.T("Total charges"),
                Language.T("Balance without charges")
            };

            string unit = " " + Language.T("pips");

            accountStatsValue     = new string[26];
            accountStatsValue[0]  = isScanned ? Language.T("Accomplished") : Language.T("Not accomplished");
            accountStatsValue[1]  = InterpolationMethodShortToString();
            accountStatsValue[2]  = ambiguousBars.ToString();
            accountStatsValue[3]  = ProfitPerDay.ToString() + unit;
            accountStatsValue[4]  = (Bars - FirstBar).ToString();
            accountStatsValue[5]  = NetBalance.ToString() + unit;
            accountStatsValue[6]  = MinBalance.ToString() + unit;
            accountStatsValue[7]  = MaxBalance.ToString() + unit;
            accountStatsValue[8]  = MaxDrawdown.ToString() + unit;
            accountStatsValue[9]  = MaxEquityDrawdown.ToString() + unit;
            accountStatsValue[10] = EquityPercentDrawdown.ToString("F2") + " %";
            accountStatsValue[11] = GrossProfit.ToString() + unit;
            accountStatsValue[12] = GrossLoss.ToString() + unit;
            accountStatsValue[13] = SentOrders.ToString();
            accountStatsValue[14] = ExecutedOrders.ToString();
            accountStatsValue[15] = TradedLots.ToString("F2");
            accountStatsValue[16] = winningTrades.ToString();
            accountStatsValue[17] = losingTrades.ToString();
            accountStatsValue[18] = ((float)winningTrades / (winningTrades + losingTrades)).ToString("F2");
            accountStatsValue[19] = TimeInPosition.ToString() + " %";
            accountStatsValue[20] = Math.Round(TotalChargedSpread).ToString() + unit;
            accountStatsValue[21] = Math.Round(TotalChargedRollOver).ToString() + unit;
            accountStatsValue[22] = Math.Round(TotalChargedCommission).ToString() + unit;
            accountStatsValue[23] = TotalChargedSlippage.ToString("F2") + unit;
            accountStatsValue[24] = Math.Round(TotalChargedSpread + TotalChargedRollOver + TotalChargedSlippage).ToString() + unit;
            accountStatsValue[25] = Math.Round(NetBalance + TotalChargedSpread + TotalChargedRollOver + TotalChargedSlippage).ToString() + unit;

            accountStatsFlag    = new bool[26];
            accountStatsFlag[0] = ambiguousBars > 0 && !isScanned;
            accountStatsFlag[1] = interpolationMethod != InterpolationMethod.Pessimistic;
            accountStatsFlag[2] = ambiguousBars > 0;
            accountStatsFlag[5] = NetBalance < 0;
            accountStatsFlag[8] = MaxDrawdown > 500;

            return;
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Generate the Account Statistics in points.
        /// </summary>
        private static void GenerateAccountStats()
        {
            AccountStatsParam = new[]
            {
                Language.T("Intrabar scanning"),
                Language.T("Interpolation method"),
                Language.T("Ambiguous bars"),
                Language.T("Profit per day"),
                Language.T("Sharpe ratio"),
                Language.T("Max consecutive losses"),
                Language.T("Tested bars"),
                Language.T("Account balance"),
                Language.T("Minimum account"),
                Language.T("Maximum account"),
                Language.T("Maximum drawdown"),
                Language.T("Max equity drawdown"),
                Language.T("Max equity drawdown"),
                Language.T("Gross profit"),
                Language.T("Gross loss"),
                Language.T("Sent orders"),
                Language.T("Executed orders"),
                Language.T("Traded lots"),
                Language.T("Winning trades"),
                Language.T("Losing trades"),
                Language.T("Win/loss ratio"),
                Language.T("Time in position"),
                Language.T("Charged spread"),
                Language.T("Charged rollover"),
                Language.T("Charged commission"),
                Language.T("Charged slippage"),
                Language.T("Total charges"),
                Language.T("Balance without charges")
            };

            string unit = " " + Language.T("points");

            AccountStatsValue = new string[AccountStatsParam.Length];
            int i = 0;

            AccountStatsValue[i++] = IsScanPerformed ? Language.T("Accomplished") : Language.T("Not accomplished");
            AccountStatsValue[i++] = InterpolationMethodShortToString();
            AccountStatsValue[i++] = AmbiguousBars.ToString(CultureInfo.InvariantCulture);
            AccountStatsValue[i++] = ProfitPerDay + unit;
            AccountStatsValue[i++] = SharpeRatio.ToString("F2");
            AccountStatsValue[i++] = MaxConsecutiveLosses.ToString(CultureInfo.InvariantCulture);
            AccountStatsValue[i++] = (Bars - FirstBar).ToString(CultureInfo.InvariantCulture);
            AccountStatsValue[i++] = NetBalance + unit;
            AccountStatsValue[i++] = MinBalance + unit;
            AccountStatsValue[i++] = MaxBalance + unit;
            AccountStatsValue[i++] = MaxDrawdown + unit;
            AccountStatsValue[i++] = MaxEquityDrawdown + unit;
            AccountStatsValue[i++] = EquityPercentDrawdown.ToString("F2") + " %";
            AccountStatsValue[i++] = GrossProfit + unit;
            AccountStatsValue[i++] = GrossLoss + unit;
            AccountStatsValue[i++] = SentOrders.ToString(CultureInfo.InvariantCulture);
            AccountStatsValue[i++] = ExecutedOrders.ToString(CultureInfo.InvariantCulture);
            AccountStatsValue[i++] = TradedLots.ToString("F2");
            AccountStatsValue[i++] = WinningTrades.ToString(CultureInfo.InvariantCulture);
            AccountStatsValue[i++] = LosingTrades.ToString(CultureInfo.InvariantCulture);
            AccountStatsValue[i++] = ((float)WinningTrades / (WinningTrades + LosingTrades)).ToString("F2");
            AccountStatsValue[i++] = TimeInPosition + " %";
            AccountStatsValue[i++] = Math.Round(TotalChargedSpread) + unit;
            AccountStatsValue[i++] = Math.Round(TotalChargedRollOver) + unit;
            AccountStatsValue[i++] = Math.Round(TotalChargedCommission) + unit;
            AccountStatsValue[i++] = TotalChargedSlippage.ToString("F2") + unit;
            AccountStatsValue[i++] = Math.Round(TotalChargedSpread + TotalChargedRollOver + TotalChargedSlippage) + unit;
            AccountStatsValue[i++] = Math.Round(NetBalance + TotalChargedSpread + TotalChargedRollOver + TotalChargedSlippage) + unit;

            AccountStatsFlags     = new bool[AccountStatsParam.Length];
            AccountStatsFlags[0]  = AmbiguousBars > 0 && !IsScanPerformed;
            AccountStatsFlags[1]  = InterpolationMethod != InterpolationMethod.Pessimistic;
            AccountStatsFlags[2]  = AmbiguousBars > 0;
            AccountStatsFlags[5]  = MaxConsecutiveLosses > 6;
            AccountStatsFlags[7]  = NetBalance < 0;
            AccountStatsFlags[10] = MaxDrawdown > 500;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Generate the Account Statistics in currency.
        /// </summary>
        static void GenerateAccountStatsInMoney()
        {
            accountStatsParam = new string[28]
            {
                Language.T("Intrabar scanning"),
                Language.T("Interpolation method"),
                Language.T("Ambiguous bars"),
                Language.T("Profit per day"),
                Language.T("Tested bars"),
                Language.T("Initial account"),
                Language.T("Account balance"),
                Language.T("Minimum account"),
                Language.T("Maximum account"),
                Language.T("Maximum drawdown"),
                Language.T("Max equity drawdown"),
                Language.T("Max equity drawdown"),
                Language.T("Gross profit"),
                Language.T("Gross loss"),
                Language.T("Sent orders"),
                Language.T("Executed orders"),
                Language.T("Traded lots"),
                Language.T("Winning trades"),
                Language.T("Losing trades"),
                Language.T("Win/loss ratio"),
                Language.T("Time in position"),
                Language.T("Charged spread"),
                Language.T("Charged rollover"),
                Language.T("Charged commission"),
                Language.T("Charged slippage"),
                Language.T("Total charges"),
                Language.T("Balance without charges"),
                Language.T("Account exchange rate")
            };

            string unit = " " + Configs.AccountCurrency;

            accountStatsValue     = new string[28];
            accountStatsValue[0]  = isScanned ? Language.T("Accomplished") : Language.T("Not accomplished");
            accountStatsValue[1]  = InterpolationMethodShortToString();
            accountStatsValue[2]  = ambiguousBars.ToString();
            accountStatsValue[3]  = MoneyProfitPerDay.ToString("F2") + unit;
            accountStatsValue[4]  = (Bars - FirstBar).ToString();
            accountStatsValue[5]  = Configs.InitialAccount.ToString("F2") + unit;
            accountStatsValue[6]  = NetMoneyBalance.ToString("F2") + unit;
            accountStatsValue[7]  = MinMoneyBalance.ToString("F2") + unit;
            accountStatsValue[8]  = MaxMoneyBalance.ToString("F2") + unit;
            accountStatsValue[9]  = MaxMoneyDrawdown.ToString("F2") + unit;
            accountStatsValue[10] = MaxMoneyEquityDrawdown.ToString("F2") + unit;
            accountStatsValue[11] = MoneyEquityPercentDrawdown.ToString("F2") + " %";
            accountStatsValue[12] = GrossMoneyProfit.ToString("F2") + unit;
            accountStatsValue[13] = GrossMoneyLoss.ToString("F2") + unit;
            accountStatsValue[14] = SentOrders.ToString();
            accountStatsValue[15] = ExecutedOrders.ToString();
            accountStatsValue[16] = TradedLots.ToString("F2");
            accountStatsValue[17] = WinningTrades.ToString();
            accountStatsValue[18] = LosingTrades.ToString();
            accountStatsValue[19] = WinLossRatio.ToString("F2");
            accountStatsValue[20] = TimeInPosition.ToString() + " %";
            accountStatsValue[21] = TotalChargedMoneySpread.ToString("F2") + unit;
            accountStatsValue[22] = TotalChargedMoneyRollOver.ToString("F2") + unit;
            accountStatsValue[23] = TotalChargedMoneyCommission.ToString("F2") + unit;
            accountStatsValue[24] = TotalChargedMoneySlippage.ToString("F2") + unit;
            accountStatsValue[25] = (TotalChargedMoneySpread + TotalChargedMoneyRollOver + TotalChargedMoneyCommission + TotalChargedMoneySlippage).ToString("F2") + unit;
            accountStatsValue[26] = (NetMoneyBalance + TotalChargedMoneySpread + TotalChargedMoneyRollOver + TotalChargedMoneyCommission + TotalChargedMoneySlippage).ToString("F2") + unit;

            if (InstrProperties.PriceIn == Configs.AccountCurrency)
            {
                accountStatsValue[27] = Language.T("Not used");
            }
            else if (InstrProperties.InstrType == Instrumet_Type.Forex && Symbol.StartsWith(Configs.AccountCurrency))
            {
                accountStatsValue[27] = Language.T("Deal price");
            }
            else if (Configs.AccountCurrency == "USD")
            {
                accountStatsValue[27] = InstrProperties.RateToUSD.ToString("F4");
            }
            else if (Configs.AccountCurrency == "EUR")
            {
                accountStatsValue[27] = InstrProperties.RateToEUR.ToString("F4");
            }

            accountStatsFlag    = new bool[28];
            accountStatsFlag[0] = ambiguousBars > 0 && !isScanned;
            accountStatsFlag[1] = interpolationMethod != InterpolationMethod.Pessimistic;
            accountStatsFlag[2] = ambiguousBars > 0;
            accountStatsFlag[6] = NetMoneyBalance < Configs.InitialAccount;
            accountStatsFlag[9] = MaxDrawdown > Configs.InitialAccount / 2;

            return;
        }
Ejemplo n.º 4
0
        /// <summary>
        ///     Generate the Account Statistics in currency.
        /// </summary>
        private static void GenerateAccountStatsInMoney()
        {
            AccountStatsParam = new[]
            {
                Language.T("Intrabar scanning"),
                Language.T("Interpolation method"),
                Language.T("Ambiguous bars"),
                Language.T("Profit per day"),
                Language.T("Sharpe ratio"),
                Language.T("Max consecutive losses"),
                Language.T("Tested bars"),
                Language.T("Initial account"),
                Language.T("Account balance"),
                Language.T("Minimum account"),
                Language.T("Maximum account"),
                Language.T("Maximum drawdown"),
                Language.T("Max equity drawdown"),
                Language.T("Max equity drawdown"),
                Language.T("Gross profit"),
                Language.T("Gross loss"),
                Language.T("Sent orders"),
                Language.T("Executed orders"),
                Language.T("Traded lots"),
                Language.T("Winning trades"),
                Language.T("Losing trades"),
                Language.T("Win/loss ratio"),
                Language.T("Time in position"),
                Language.T("Charged spread"),
                Language.T("Charged rollover"),
                Language.T("Charged commission"),
                Language.T("Charged slippage"),
                Language.T("Total charges"),
                Language.T("Balance without charges"),
                Language.T("Account exchange rate")
            };

            string unit = " " + Configs.AccountCurrency;

            AccountStatsValue = new string[AccountStatsParam.Length];
            int i = 0;

            AccountStatsValue[i++] = IsScanPerformed ? Language.T("Accomplished") : Language.T("Not accomplished");
            AccountStatsValue[i++] = InterpolationMethodShortToString();
            AccountStatsValue[i++] = AmbiguousBars.ToString(CultureInfo.InvariantCulture);
            AccountStatsValue[i++] = MoneyProfitPerDay.ToString("F2") + unit;
            AccountStatsValue[i++] = SharpeRatio.ToString("F2");
            AccountStatsValue[i++] = MaxConsecutiveLosses.ToString(CultureInfo.InvariantCulture);
            AccountStatsValue[i++] = (Bars - FirstBar).ToString(CultureInfo.InvariantCulture);
            AccountStatsValue[i++] = Configs.InitialAccount.ToString("F2") + unit;
            AccountStatsValue[i++] = NetMoneyBalance.ToString("F2") + unit;
            AccountStatsValue[i++] = MinMoneyBalance.ToString("F2") + unit;
            AccountStatsValue[i++] = MaxMoneyBalance.ToString("F2") + unit;
            AccountStatsValue[i++] = MaxMoneyDrawdown.ToString("F2") + unit;
            AccountStatsValue[i++] = MaxMoneyEquityDrawdown.ToString("F2") + unit;
            AccountStatsValue[i++] = MoneyEquityPercentDrawdown.ToString("F2") + " %";
            AccountStatsValue[i++] = GrossMoneyProfit.ToString("F2") + unit;
            AccountStatsValue[i++] = GrossMoneyLoss.ToString("F2") + unit;
            AccountStatsValue[i++] = SentOrders.ToString(CultureInfo.InvariantCulture);
            AccountStatsValue[i++] = ExecutedOrders.ToString(CultureInfo.InvariantCulture);
            AccountStatsValue[i++] = TradedLots.ToString("F2");
            AccountStatsValue[i++] = WinningTrades.ToString(CultureInfo.InvariantCulture);
            AccountStatsValue[i++] = LosingTrades.ToString(CultureInfo.InvariantCulture);
            AccountStatsValue[i++] = WinLossRatio.ToString("F2");
            AccountStatsValue[i++] = TimeInPosition + " %";
            AccountStatsValue[i++] = TotalChargedMoneySpread.ToString("F2") + unit;
            AccountStatsValue[i++] = TotalChargedMoneyRollOver.ToString("F2") + unit;
            AccountStatsValue[i++] = TotalChargedMoneyCommission.ToString("F2") + unit;
            AccountStatsValue[i++] = TotalChargedMoneySlippage.ToString("F2") + unit;
            AccountStatsValue[i++] =
                (TotalChargedMoneySpread + TotalChargedMoneyRollOver + TotalChargedMoneyCommission +
                 TotalChargedMoneySlippage).ToString("F2") + unit;
            AccountStatsValue[i++] =
                (NetMoneyBalance + TotalChargedMoneySpread + TotalChargedMoneyRollOver + TotalChargedMoneyCommission +
                 TotalChargedMoneySlippage).ToString("F2") + unit;

            if (InstrProperties.PriceIn == Configs.AccountCurrency)
            {
                AccountStatsValue[i++] = Language.T("Not used");
            }
            else if (InstrProperties.InstrType == InstrumetType.Forex && Symbol.StartsWith(Configs.AccountCurrency))
            {
                AccountStatsValue[i++] = Language.T("Deal price");
            }
            else if (Configs.AccountCurrency == "USD")
            {
                AccountStatsValue[i++] = InstrProperties.RateToUSD.ToString("F4");
            }
            else if (Configs.AccountCurrency == "EUR")
            {
                AccountStatsValue[i++] = InstrProperties.RateToEUR.ToString("F4");
            }

            AccountStatsFlags     = new bool[AccountStatsParam.Length];
            AccountStatsFlags[0]  = AmbiguousBars > 0 && !IsScanPerformed;
            AccountStatsFlags[1]  = InterpolationMethod != InterpolationMethod.Pessimistic;
            AccountStatsFlags[2]  = AmbiguousBars > 0;
            AccountStatsFlags[5]  = MaxConsecutiveLosses > 6;
            AccountStatsFlags[8]  = NetMoneyBalance < Configs.InitialAccount;
            AccountStatsFlags[11] = MaxDrawdown > Configs.InitialAccount / 2;
        }