GAP-033: log session readiness for Gate 3
- report resolved DaysToLoad and loaded bars per series - report factor warm-up readiness without blocking startup - warn when SimSimple runs with kill switch disabled Build: clean | Tests: 500 passing | Dual-deployed: yes
This commit is contained in:
@@ -505,6 +505,7 @@ namespace NinjaTrader.NinjaScript.Strategies
|
||||
// TASK-00a: Write session provenance on realtime transition
|
||||
WriteSessionProvenance();
|
||||
|
||||
WriteHistoricalReadiness("REALTIME ELIGIBILITY");
|
||||
WriteSettingsFile();
|
||||
}
|
||||
else if (State == State.Terminated)
|
||||
@@ -950,9 +951,72 @@ namespace NinjaTrader.NinjaScript.Strategies
|
||||
FileLog(string.Format("Sizing : MinContracts={0} MaxContracts={1}", MinContracts, MaxContracts));
|
||||
FileLog(string.Format("VerboseLog : {0} FileLog: {1}", EnableVerboseLogging, EnableFileLogging));
|
||||
FileLog(string.Format("ConnectionLost : {0}", _connectionLost));
|
||||
WriteHistoricalReadiness("DATA LOADED");
|
||||
FileLog("---");
|
||||
}
|
||||
|
||||
private void WriteHistoricalReadiness(string phase)
|
||||
{
|
||||
FileLog(string.Format("Historical readiness [{0}] : BarsRequiredToTrade={1}", phase, BarsRequiredToTrade));
|
||||
|
||||
int dailyBars = 0;
|
||||
if (BarsArray == null || BarsArray.Length == 0)
|
||||
{
|
||||
FileLog(string.Format("WARNING: Historical readiness [{0}] unavailable; no data series loaded.", phase));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < BarsArray.Length; i++)
|
||||
{
|
||||
int daysToLoad = 0;
|
||||
int loadedBars = 0;
|
||||
string seriesType = "Unknown";
|
||||
|
||||
if (BarsArray[i] != null)
|
||||
{
|
||||
loadedBars = BarsArray[i].Count;
|
||||
if (BarsArray[i].BarsType != null)
|
||||
{
|
||||
daysToLoad = BarsArray[i].BarsType.DaysToLoad;
|
||||
seriesType = BarsArray[i].BarsType.GetType().Name;
|
||||
}
|
||||
}
|
||||
|
||||
FileLog(string.Format("DataSeries[{0}] : Type={1} DaysToLoad={2} HistoricalBarsLoaded={3}",
|
||||
i,
|
||||
seriesType,
|
||||
daysToLoad,
|
||||
loadedBars));
|
||||
|
||||
if (seriesType.IndexOf("DayBarsType", StringComparison.OrdinalIgnoreCase) >= 0)
|
||||
dailyBars = loadedBars;
|
||||
}
|
||||
}
|
||||
|
||||
bool narrowRangeReady = dailyBars >= 7;
|
||||
bool orbRangeReady = dailyBars >= 5;
|
||||
FileLog(string.Format("FactorWarmup : NarrowRangeFactorCalculator={0} ({1}/7 daily bars) OrbRangeVsAtrFactorCalculator={2} ({1}/5 daily bars)",
|
||||
narrowRangeReady ? "SATISFIED" : "NOT SATISFIED",
|
||||
dailyBars,
|
||||
orbRangeReady ? "SATISFIED" : "NOT SATISFIED"));
|
||||
|
||||
if (!narrowRangeReady || !orbRangeReady)
|
||||
{
|
||||
FileLog(string.Format("WARNING: Factor warm-up not satisfied before real-time order eligibility; daily bars={0}, NarrowRange requires 7, OrbRangeVsAtr requires 5. Strategy startup is not blocked.",
|
||||
dailyBars));
|
||||
}
|
||||
else
|
||||
{
|
||||
FileLog(string.Format("Factor warm-up confirmed before real-time order eligibility; daily bars={0}.", dailyBars));
|
||||
}
|
||||
|
||||
string accountName = Account != null ? Account.Name : string.Empty;
|
||||
if (!EnableKillSwitch && accountName.IndexOf("SimSimple", StringComparison.OrdinalIgnoreCase) >= 0)
|
||||
{
|
||||
FileLog(string.Format("WARNING: EnableKillSwitch=False for gate account {0}.", accountName));
|
||||
}
|
||||
}
|
||||
|
||||
private void WriteSessionFooter()
|
||||
{
|
||||
FileLog("---");
|
||||
|
||||
Reference in New Issue
Block a user