/// <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; }
/// <summary> /// Sets the additional stats in pips. /// </summary> static void SetAdditioanlStats() { string unit = " " + Language.T("pips"); additionalStatsParamName = new string[] { Language.T("Initial account"), Language.T("Account balance"), Language.T("Net profit"), Language.T("Gross profit"), Language.T("Gross loss"), Language.T("Profit factor"), Language.T("Annualized profit"), Language.T("Minimum account"), Language.T("Minimum account date"), Language.T("Maximum account"), Language.T("Maximum account date"), Language.T("Absolute drawdown"), Language.T("Maximum drawdown"), Language.T("Maximum drawdown date"), Language.T("Historical bars"), Language.T("Tested bars"), Language.T("Bars with trades"), Language.T("Bars with trades") + " %", Language.T("Number of trades"), Language.T("Winning trades"), Language.T("Losing trades"), Language.T("Win/loss ratio"), Language.T("Maximum profit"), Language.T("Average profit"), Language.T("Maximum loss"), Language.T("Average loss"), Language.T("Expected payoff") }; int totalWinTrades = winningLongTrades + winningShortTrades; int totalLossTrades = losingLongTrades + losingShortTrades; int totalTrades = totalWinTrades + totalLossTrades; additionalStatsValueTotal = new string[] { "0" + unit, NetBalance.ToString() + unit, NetBalance.ToString() + unit, Math.Round(grossProfit).ToString() + unit, Math.Round(grossLoss).ToString() + unit, (grossLoss == 0 ? "N/A" : Math.Abs(grossProfit / grossLoss).ToString("F2")), Math.Round(((365f / Data.Time[Data.Bars - 1].Subtract(Data.Time[0]).Days) * NetBalance)).ToString() + unit, MinBalance.ToString() + unit, minBalanceDate.ToShortDateString(), MaxBalance.ToString() + unit, maxBalanceDate.ToShortDateString(), Math.Abs(MinBalance).ToString() + unit, Math.Round(maxDrawdown).ToString() + unit, maxDrawdownDate.ToShortDateString(), Data.Bars.ToString(), (Data.Bars - Data.FirstBar).ToString(), barsWithPos.ToString(), (100f * barsWithPos / (Data.Bars - Data.FirstBar)).ToString("F2") + "%", totalTrades.ToString(), totalWinTrades.ToString(), totalLossTrades.ToString(), (1f * totalWinTrades / (totalWinTrades + totalLossTrades)).ToString("F2"), Math.Round(Math.Max(maxLongWin, maxShortWin)).ToString() + unit, Math.Round(grossProfit / totalWinTrades).ToString() + unit, Math.Round(Math.Min(maxLongLoss, maxShortLoss)).ToString() + unit, Math.Round(grossLoss / totalLossTrades).ToString() + unit, (1f * NetBalance / totalTrades).ToString("F2") + unit }; additionalStatsValueLong = new string[] { "0" + unit, NetLongBalance.ToString() + unit, NetLongBalance.ToString() + unit, Math.Round(grossLongProfit).ToString() + unit, Math.Round(grossLongLoss).ToString() + unit, (grossLongLoss == 0 ? "N/A" : Math.Abs(grossLongProfit / grossLongLoss).ToString("F2")), Math.Round(((365f / Data.Time[Data.Bars - 1].Subtract(Data.Time[0]).Days) * NetLongBalance)).ToString() + unit, MinLongBalance.ToString() + unit, minLongBalanceDate.ToShortDateString(), MaxLongBalance.ToString() + unit, maxLongBalanceDate.ToShortDateString(), Math.Round(Math.Abs(minLongBalance)).ToString() + unit, Math.Round(maxLongDrawdown).ToString() + unit, maxLongDrawdownDate.ToShortDateString(), Data.Bars.ToString(), (Data.Bars - Data.FirstBar).ToString(), barsWithLongPos.ToString(), (100f * barsWithLongPos / (Data.Bars - Data.FirstBar)).ToString("F2") + "%", totalLongTrades.ToString(), winningLongTrades.ToString(), losingLongTrades.ToString(), (1f * winningLongTrades / (winningLongTrades + losingLongTrades)).ToString("F2"), Math.Round(maxLongWin).ToString() + unit, Math.Round(grossLongProfit / winningLongTrades).ToString() + unit, Math.Round(maxLongLoss).ToString() + unit, Math.Round(grossLongLoss / losingLongTrades).ToString() + unit, (1f * NetLongBalance / (winningLongTrades + losingLongTrades)).ToString("F2") + unit }; additionalStatsValueShort = new string[] { "0" + unit, NetShortBalance.ToString() + unit, NetShortBalance.ToString() + unit, Math.Round(grossShortProfit).ToString() + unit, Math.Round(grossShortLoss).ToString() + unit, (grossShortLoss == 0 ? "N/A" : Math.Abs(grossShortProfit / grossShortLoss).ToString("F2")), Math.Round(((365f / Data.Time[Data.Bars - 1].Subtract(Data.Time[0]).Days) * NetShortBalance)).ToString() + unit, MinShortBalance.ToString() + unit, minShortBalanceDate.ToShortDateString(), MaxShortBalance.ToString() + unit, maxShortBalanceDate.ToShortDateString(), Math.Round(Math.Abs(minShortBalance)).ToString() + unit, Math.Round(maxShortDrawdown).ToString() + unit, maxShortDrawdownDate.ToShortDateString(), Data.Bars.ToString(), (Data.Bars - Data.FirstBar).ToString(), barsWithShortPos.ToString(), (100f * barsWithShortPos / (Data.Bars - Data.FirstBar)).ToString("F2") + "%", totalShortTrades.ToString(), winningShortTrades.ToString(), losingShortTrades.ToString(), (1f * winningShortTrades / (winningShortTrades + losingShortTrades)).ToString("F2"), Math.Round(maxShortWin).ToString() + unit, Math.Round(grossShortProfit / winningShortTrades).ToString() + unit, Math.Round(maxShortLoss).ToString() + unit, Math.Round(grossShortLoss / losingShortTrades).ToString() + unit, (1f * NetShortBalance / (winningShortTrades + losingShortTrades)).ToString("F2") + unit }; }