Fixed problem with MG and CMM when running EOM on a weekend. The Trade date and Analysis date have been corrected to reflect the previous business day. Monthly updates.

This commit is contained in:
2025-05-31 11:58:48 -04:00
parent 7061395694
commit bbbaff3095
11 changed files with 461 additions and 441 deletions

View File

@@ -331,8 +331,9 @@ namespace MarketData.Generator.CMMomentum
CMSessionParams sessionParams = null;
Cycle = 0;
if (Utility.IsEpoch(AnalysisDate)) AnalysisDate = dateGenerator.GetPrevBusinessDay(Today());
else AnalysisDate = dateGenerator.GetPrevBusinessDay(AnalysisDate);
if (AnalysisDate.Date > Today().Date) return backTestResult;
if (Utility.IsEpoch(AnalysisDate)) AnalysisDate = Today();
TradeDate = dateGenerator.GetCurrentMonthEnd(StartDate);
if (TradeDate > AnalysisDate)
{

View File

@@ -333,8 +333,8 @@ namespace MarketData.Generator.Momentum
Cycle=0;
if(AnalysisDate.Date>Today().Date)return backTestResult;
if(Utility.IsEpoch(AnalysisDate))AnalysisDate=Today();
TradeDate=dateGenerator.GetCurrentMonthEnd(StartDate);
if(Utility.IsEpoch(AnalysisDate))AnalysisDate=dateGenerator.GetPrevBusinessDay(Today()); // Ensure AnalysisDate is not a weekend or holiday
TradeDate =dateGenerator.GetCurrentMonthEnd(StartDate);
if(TradeDate>AnalysisDate)
{
int startMonth=StartDate.Month;
@@ -662,7 +662,7 @@ namespace MarketData.Generator.Momentum
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Restoring session from '{0}'",PathSessionFileName));
MGSessionParams sessionParams=MGSessionManager.RestoreSession(PathSessionFileName);
TradeDate=sessionParams.TradeDate;
if(TradeDate.Date<AnalysisDate.Date)TradeDate=AnalysisDate;
if(TradeDate.Date<AnalysisDate.Date)TradeDate=AnalysisDate; // AnalysisDate will not fall on a weekend or holiday
StartDate=sessionParams.StartDate;
Configuration=sessionParams.Configuration;
ActivePositions=sessionParams.ActivePositions;