Ejemplo n.º 1
0
        /// <summary>
        /// Exports the bar summary
        /// </summary>
        public void ExportBarSummary()
        {
            string stage = String.Empty;

            if (Data.IsProgramBeta)
            {
                stage = " " + Language.T("Beta");
            }
            else if (Data.IsProgramRC)
            {
                stage = " " + "RC";
            }

            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.ToString() + Environment.NewLine);
            sb.Append(Data.Symbol + " " + Data.PeriodString + "; Values in pips" + 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).ToString() + "\t");
                sb.Append(Data.Time[bar].ToString(sDF) + "\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].ToString() + "\t");
                if (Backtester.IsPos(bar))
                {
                    sb.Append(Backtester.SummaryDir(bar).ToString() + "\t");
                    sb.Append(Backtester.SummaryLots(bar).ToString() + "\t");
                    sb.Append(Backtester.SummaryTrans(bar).ToString() + "\t");
                    sb.Append(Backtester.SummaryPrice(bar).ToString(FF) + "\t");
                    sb.Append(Backtester.ProfitLoss(bar).ToString() + "\t");
                    sb.Append(Backtester.FloatingPL(bar).ToString() + "\t");
                }
                else
                {
                    sb.Append("\t\t\t\t\t\t");
                }
                sb.Append(Backtester.ChargedSpread(bar).ToString() + "\t");
                sb.Append(Backtester.ChargedRollOver(bar).ToString() + "\t");
                sb.Append(Backtester.Balance(bar).ToString() + "\t");
                sb.Append(Backtester.Equity(bar).ToString() + "\t");
                sb.Append(Backtester.BackTestEval(bar) + "\t");
                sb.Append(Environment.NewLine);
            }

            string fileName = Data.Strategy.StrategyName + "-" + Data.Symbol.ToString() + "-" + Data.Period.ToString();

            SaveData(fileName);
            return;
        }