Integration with the News Filter
In your previous JSON fetching logic, simply pass the extracted date string into this function before assigning it to the danger window variable:
Code: Select all
// Inside CNewsFilter::FetchCalendar() after parsing the JSON node
string json_date_string = "2026-10-01T10:00:00-04:00"; // Extracted from JAson
m_next_danger_time = ParseISO8601ToBrokerTime(json_date_string);
PrintFormat("Next High-Impact Event localized to Broker Time: %s", TimeToString(m_next_danger_time));
A note on Daylight Saving Time (DST) gaps: Europe and the United States shift their clocks on different weekends. Because this function calculates the instantaneous broker offset dynamically, checking a Friday event on Monday during that weird 2-week DST gap might calculate 1 hour off. However, because your EA continuously refreshes the data, as the broker server rolls over the DST boundary, the dynamic TimeTradeServer() offset instantly recalculates, and your 30-minute danger window will snap to perfect accuracy before the actual event fires.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.