/// <summary> /// Exports the bar summary /// </summary> public void ExportBarSummary() { string stage = String.Empty; if (Data.IsProgramBeta) { stage = " " + Language.T("Beta"); } else if (Data.IsProgramReleaseCandidate) { stage = " " + "RC"; } string ff = Data.Ff; // Format modifier to print float numbers string df = Data.Df; // Format modifier to print date var sb = new StringBuilder(); sb.Append("Forex Strategy Builder v" + Data.ProgramVersion + stage + Environment.NewLine); sb.Append("Strategy name: " + Data.Strategy.StrategyName + Environment.NewLine); sb.Append("Exported on " + DateTime.Now + Environment.NewLine); sb.Append(Data.Symbol + " " + Data.PeriodString + "; Values in points" + Environment.NewLine); sb.Append("Bar Numb\t"); sb.Append("Date\t"); sb.Append("Hour\t"); sb.Append("Open\t"); sb.Append("High\t"); sb.Append("Low\t"); sb.Append("Close\t"); sb.Append("Volume\t"); sb.Append("Direction\t"); sb.Append("Lots\t"); sb.Append("Transaction\t"); sb.Append("Price\t"); sb.Append("Profit Loss\t"); sb.Append("Floating P/L\t"); sb.Append("Spread\t"); sb.Append("Rollover\t"); sb.Append("Balance\t"); sb.Append("Equity\t"); sb.Append("Interpolation" + Environment.NewLine); for (int bar = 0; bar < Data.Bars; bar++) { sb.Append((bar + 1) + "\t"); sb.Append(Data.Time[bar].ToString(df) + "\t"); sb.Append(Data.Time[bar].ToString("HH:mm") + "\t"); sb.Append(Data.Open[bar].ToString(ff) + "\t"); sb.Append(Data.High[bar].ToString(ff) + "\t"); sb.Append(Data.Low[bar].ToString(ff) + "\t"); sb.Append(Data.Close[bar].ToString(ff) + "\t"); sb.Append(Data.Volume[bar] + "\t"); if (Backtester.IsPos(bar)) { sb.Append(Backtester.SummaryDir(bar) + "\t"); sb.Append(Backtester.SummaryLots(bar) + "\t"); sb.Append(Backtester.SummaryTrans(bar) + "\t"); sb.Append(Backtester.SummaryPrice(bar).ToString(ff) + "\t"); sb.Append(Backtester.ProfitLoss(bar) + "\t"); sb.Append(Backtester.FloatingPL(bar) + "\t"); } else { sb.Append("\t\t\t\t\t\t"); } sb.Append(Backtester.ChargedSpread(bar) + "\t"); sb.Append(Backtester.ChargedRollOver(bar) + "\t"); sb.Append(Backtester.Balance(bar) + "\t"); sb.Append(Backtester.Equity(bar) + "\t"); sb.Append(Backtester.BackTestEvalToString(bar) + "\t"); sb.Append(Environment.NewLine); } string fileName = Data.Strategy.StrategyName + "-" + Data.Symbol + "-" + Data.Period.ToString(); SaveData(fileName, sb); }