I'm trying to reset a dictionary (called hypo_results) when I activate a strategy in the middle of the day. Currently, the strategy runs on previous data since I have the instrument set to 24 hours.
I'm trying this with no luck:
// If this is the first tick of a new bar, start all this material
if (IsFirstTickOfBar)
{
// Set the proper time for the bar
if (ToTime(Time[0]) >= 83000 && ToTime(Time[0]) < 93000) { currentHour = 0; }
else if (ToTime(Time[0]) >= 93000 && ToTime(Time[0]) < 103000) { currentHour = 1; }
else if (ToTime(Time[0]) >= 103000 && ToTime(Time[0]) < 113000) { currentHour = 2; }
else if (ToTime(Time[0]) >= 113000 && ToTime(Time[0]) < 123000) { currentHour = 3; }
else if (ToTime(Time[0]) >= 123000 && ToTime(Time[0]) < 133000) { currentHour = 4; }
else if (ToTime(Time[0]) >= 133000 && ToTime(Time[0]) < 143000) { currentHour = 5; }
else if (ToTime(Time[0]) >= 143000) { currentHour = 6; }
tickCount = 1;
// Use this to reset all related dictionaries
if (currentHour == 0 && !dayReset)
{
hypo_results.Clear(); // Clear all results from the main dictionary
dayReset = true; // Close out the reset
}
}
Any suggestions? Is my code incorrect?

Comment