protected virtual void GenerateReportForOneColumn(SystemPerformanceSlice slice) {
			IList<Position> positionsAllReadOnly = slice.PositionsImTrackingReadOnly;  

			this.AddCurrencyValue("Net Profit", slice.NetProfitForClosedPositionsBoth, Color.Empty, Color.Empty, this.GetItemColor(slice.NetProfitForClosedPositionsBoth), FontStyle.Bold, FontStyle.Regular);
			this.AddCurrencyValue("Profit per Bar", slice.ProfitPerBarBoth, Color.Empty, Color.Empty, this.GetItemColor(slice.NetProfitForClosedPositionsBoth), FontStyle.Bold, FontStyle.Regular);
			this.AddCurrencyValue("Commission", -slice.CommissionBoth, Color.Empty, Color.Empty, this.GetItemColor(-slice.CommissionBoth), FontStyle.Regular, FontStyle.Regular);
			this.AddNumericValue("Profit Factor", slice.ProfitFactor, 2);
			this.AddNumericValue("Recovery Factor", slice.RecoveryFactor, 2);
			this.AddNumericValue("Payoff Ratio", slice.PayoffRatio, 2);

			this.AddCurrencyValue("Max Drawdown", slice.MaxDrawDown, Color.Empty, Color.Empty, this.GetItemColor(slice.MaxDrawDown), FontStyle.Regular, FontStyle.Regular);
			this.AddDateTimeValue("Max Drawdown Date", slice.MaxDrawDownLastLossDate);

			this.AddNumericValue("All Trades", slice.PositionsCountBoth, 0, Color.Gainsboro, Color.Empty, Color.Empty, FontStyle.Bold, FontStyle.Regular);
			this.AddCurrencyValue("Avg Profit", slice.AvgProfitBoth, Color.Empty, Color.Empty, this.GetItemColor(slice.AvgProfitBoth), FontStyle.Regular, FontStyle.Regular);
			this.AddPercentValue("Avg Profit %", slice.AvgProfitPctBoth, 2, Color.Empty, Color.Empty, this.GetItemColor(slice.AvgProfitPctBoth), FontStyle.Regular, FontStyle.Regular);
			this.AddNumericValue("Avg Bars Held", slice.AvgBarsHeldBoth, 2);

			this.AddNumericValue("Winners", (double)slice.PositionsCountWinners, 0, Color.Gainsboro, Color.Empty, Color.Empty, FontStyle.Bold, FontStyle.Regular);
			this.AddPercentValue("Win Rate", slice.WinRatePct, 2);
			this.AddCurrencyValue("Net Profit", slice.NetProfitWinners, Color.Empty, Color.Empty, this.GetItemColor(slice.NetProfitWinners), FontStyle.Regular, FontStyle.Regular);
			this.AddCurrencyValue("Avg Profit", slice.AvgProfitWinners, Color.Empty, Color.Empty, this.GetItemColor(slice.AvgProfitWinners), FontStyle.Regular, FontStyle.Regular);
			this.AddPercentValue("Avg Profit %", slice.AvgProfitPctWinners, 2, Color.Empty, Color.Empty, this.GetItemColor(slice.AvgProfitPctWinners), FontStyle.Regular, FontStyle.Regular);
			this.AddNumericValue("Avg Bars Held", slice.AvgBarsHeldWinners, 2);
			this.AddNumericValue("Max Consecutive Winners", (double)slice.MaxConsecWinners, 0);

			this.AddNumericValue("Losers", (double)slice.PositionsCountLosers, 0, Color.Gainsboro, Color.Empty, Color.Empty, FontStyle.Bold, FontStyle.Regular);
			this.AddPercentValue("Loss Rate", slice.LossRatePct, 2);
			this.AddCurrencyValue("Net Loss", slice.NetLossLosers, Color.Empty, Color.Empty, this.GetItemColor(slice.NetLossLosers), FontStyle.Regular, FontStyle.Regular);
			this.AddCurrencyValue("Avg Loss", slice.AvgLossLosers, Color.Empty, Color.Empty, this.GetItemColor(slice.AvgLossLosers), FontStyle.Regular, FontStyle.Regular);
			this.AddPercentValue("Avg Loss %", slice.AvgLossPctLosers, 2, Color.Empty, Color.Empty, this.GetItemColor(slice.AvgLossPctLosers), FontStyle.Regular, FontStyle.Regular);
			this.AddNumericValue("Avg Bars Held", slice.AvgBarsHeldLosers, 2);
			this.AddNumericValue("Max Consecutive Losses", (double)slice.MaxConsecLosers, 0);
		}
		public SystemPerformance(ScriptExecutor scriptExecutor) {
			if (scriptExecutor == null) {
				string msg = "we shouldn't execute strategy when this.Executor == null";
				throw new Exception(msg);
			}

			this.Executor = scriptExecutor;
			this.SliceLong			= new SystemPerformanceSlice(this, PositionLongShort.Long,		"StatsForLongPositionsOnly");
			this.SliceShort			= new SystemPerformanceSlice(this, PositionLongShort.Short,		"StatsForShortPositionsOnly");
			this.SlicesShortAndLong	= new SystemPerformanceSlice(this, PositionLongShort.Unknown,	"StatsForShortAndLongPositions");
			this.SliceBuyHold		= new SystemPerformanceSlice(this, PositionLongShort.Unknown,	"StatsForBuyHold");
		}
Пример #3
0
        public SystemPerformance(ScriptExecutor scriptExecutor)
        {
            if (scriptExecutor == null)
            {
                string msg = "we shouldn't execute strategy when this.Executor == null";
                throw new Exception(msg);
            }

            this.Executor           = scriptExecutor;
            this.SliceLong          = new SystemPerformanceSlice(this, PositionLongShort.Long, "StatsForLongPositionsOnly");
            this.SliceShort         = new SystemPerformanceSlice(this, PositionLongShort.Short, "StatsForShortPositionsOnly");
            this.SlicesShortAndLong = new SystemPerformanceSlice(this, PositionLongShort.Unknown, "StatsForShortAndLongPositions");
            this.SliceBuyHold       = new SystemPerformanceSlice(this, PositionLongShort.Unknown, "StatsForBuyHold");
        }