I'm trying to determine the High and Low during the Globex session.
When the session starts, it resets the High and Low, this works fine.
Now I want the High and Low to be updated as the session moves forward...
In my code below it doesn't trigger when the time is between GlobexStart and GlobexEnd. (The bolded section doesn't run)
Any ideas why this happens?
Thanks
// Globex High and Low Level logic DateTime dt = Time[0]; GlobexSessionStartTime = new DateTime(dt.Year, dt.Month, dt.Day, GlobexStartTime.Hour, GlobexStartTime.Minute, GlobexStartTime.Second); GlobexSessionEndTime = new DateTime(dt.Year, dt.Month, dt.Day, GlobexEndTime.Hour, GlobexEndTime.Minute, GlobexEndTime.Second); // Globex ends on a new day, so add 1 day to draw the lines correctly GlobexSessionEndTime = GlobexSessionEndTime.AddDays(1); // Initialize and Calculate the High and Low during the Globex Session if (Times[0][0] == GlobexSessionStartTime) { Print(string.Format("{0} Globex Session Starts Now.", Time[0])); Print(string.Format("{0} Globex Session Start Time for Today: {1} ", Time[0], GlobexSessionStartTime)); Print(string.Format("{0} Globex Session Open Price for Today: {1} ", Time[0], Open[0])); Print(string.Format("{0} Globex Session End Time for Today: {1} ", Time[0], GlobexSessionEndTime)); GlobexHigh = High[0]; Print(string.Format("{0} Globex High set to first High of Today: {1} ", Time[0], GlobexHigh)); GlobexLow = Low[0]; Print(string.Format("{0} Globex Low set to first Low of Today: {1} ", Time[0], GlobexLow)); } [B]// When to Globex session is active run the code below... if ((Times[0][0] >= GlobexSessionStartTime) && (Times[0][0] >= GlobexSessionEndTime)) { Print(string.Format("{0} Globex Session is active...", Time[0])); if (High[0] > GlobexHigh) { GlobexHigh = High[0]; Print(string.Format("{0} New Globex High found: {1} ", Time[0], GlobexHigh)); } if (Low[0] > GlobexLow) { GlobexLow = Low[0]; Print(string.Format("{0} New Globex Low found: {1} ", Time[0], GlobexLow)); } }[/B]
Comment