Page 1 of 3
Event blackout module before NFP and CPI
Posted: Fri Sep 18, 2026 6:09 pm
by LondonScalper
Event blackout module before NFP and CPI
I treat Tier-1 US prints as a module, not a mood. The blackout is written into the plan so I do not negotiate at 13:55 London.
Current module:
- T−30: no new risk on USD pairs / gold; flatten discretionary inventory
- T−5: platform alerts muted except calendar; hands off hotkeys
- Release + my stand-aside timer: watch spreads, do not hero-trade the first spike
- Re-entry only if spreads normalise and a post-news checklist passes (often I simply stay flat)
The module exists because “I will be careful” is not a risk control. On prop accounts the same module also prevents accidental news-window breaches.
How long is your blackout before NFP/CPI — 15, 30, 60 minutes? And do you allow a planned reversion scalp after, or is the whole session done once the print hits? Consistency beats cleverness here. The module is the same every Tier-1 Tuesday or Friday, regardless of how “obvious” the prior day’s trend felt.
Re: Event blackout module before NFP and CPI
Posted: Fri Sep 18, 2026 8:10 pm
by FTtrader
LondonScalper wrote: Fri Sep 18, 2026 6:09 pm
Event blackout module before NFP and CPI
I treat Tier-1 US prints as a module, not a mood. The blackout is written into the plan so I do not negotiate at 13:55 London.
Current module:
- T−30: no new risk on USD pairs / gold; flatten discretionary inventory
- T−5: platform alerts muted except calendar; hands off hotkeys
- Release + my stand-aside timer: watch spreads, do not hero-trade the first spike
- Re-entry only if spreads normalise and a post-news checklist passes (often I simply stay flat)
The module exists because “I will be careful” is not a risk control. On prop accounts the same module also prevents accidental news-window breaches.
How long is your blackout before NFP/CPI — 15, 30, 60 minutes? And do you allow a planned reversion scalp after, or is the whole session done once the print hits? Consistency beats cleverness here. The module is the same every Tier-1 Tuesday or Friday, regardless of how “obvious” the prior day’s trend felt.
Hello LondonScalper,
Great post. “I will be careful is not a risk control” is one of the most painfully expensive lessons a trader can learn, and hard-coding this into a module is exactly how professionals survive the macro chop. Prop firm breach rules leave zero room for subjective "feelings" about the market at 08:29 AM.
To answer your questions:
My pre-news blackout: T−60 for new intraday discretionary entries. The risk/reward rarely justifies taking a new position when liquidity providers are actively pulling their bids/offers. By T−15, it's a hard flat on any open day-trade positions.
Post-news reversion scalps: The entire session is not necessarily done, but the first 15 minutes post-print are strictly off-limits. The initial spike is often an algorithmic liquidity sweep; the "real" move (or structural reversion) usually establishes itself once the 1-minute spreads normalize and the order book refills. If the checklist isn't met by T+30 post-release, the terminal gets closed for the day.
Below is a Pine Script (v5) you can add to TradingView to formalize your module. It visually blocks out the chart during your specified pre- and post-news window and draws a status HUD on your screen. More importantly, it calculates a core in_blackout boolean that you can wrap around your existing automated strategy entries to physically prevent hotkey or script execution during the danger zone.
Re: Event blackout module before NFP and CPI
Posted: Fri Sep 18, 2026 8:10 pm
by FTtrader
Tier-1 Event Blackout Module (Pine Script v5)
Code: Select all
//@version=5
indicator("Event Blackout Module [Tier-1]", overlay=true)
// =====================================================================
// INPUTS
// =====================================================================
grp_time = "Tier-1 News Time (New York / EST)"
// Default to 08:30 AM New York time (Standard NFP/CPI time)
news_hour = input.int(8, title="News Hour", group=grp_time, minval=0, maxval=23)
news_minute = input.int(30, title="News Minute", group=grp_time, minval=0, maxval=59)
grp_rules = "Blackout Parameters"
pre_mins = input.int(30, title="T-Minus Blackout (mins)", group=grp_rules, tooltip="Flatten and block new entries")
post_mins = input.int(15, title="Post-News Stand-Aside (mins)", group=grp_rules, tooltip="Wait for spreads to normalize")
show_bg = input.bool(true, title="Highlight Blackout Window", group=grp_rules)
// =====================================================================
// TIME CALCULATIONS (Strictly anchored to NY Time)
// =====================================================================
// We use America/New_York so DST changes don't break the module
ny_hour = hour(time, "America/New_York")
ny_minute = minute(time, "America/New_York")
// Convert to minutes-from-midnight for straightforward boundary math
current_time_mins = ny_hour * 60 + ny_minute
news_time_mins = news_hour * 60 + news_minute
blackout_start = news_time_mins - pre_mins
blackout_end = news_time_mins + post_mins
// Boolean flag evaluating if current bar is in the danger zone
in_blackout = (current_time_mins >= blackout_start) and (current_time_mins <= blackout_end)
// =====================================================================
// VISUALS & HUD
// =====================================================================
// Paint the background during the blackout window
bg_color = in_blackout and show_bg ? color.new(color.red, 85) : na
bgcolor(bg_color, title="Blackout Zone")
// On-chart HUD
var table status_tbl = table.new(position.top_right, 1, 1)
if barstate.islast
table.cell(status_tbl, 0, 0,
text = in_blackout ? "MODULE ACTIVE: STAND ASIDE" : "SYSTEM ARMED: CLEAR",
bgcolor = in_blackout ? color.new(color.red, 30) : color.new(color.green, 50),
text_color = color.white,
text_size = size.small)
// =====================================================================
// STRATEGY EXPORT (For integration with other scripts)
// =====================================================================
// If integrating this into a Strategy, you would use:
// if (long_condition and not in_blackout)
// strategy.entry("Long", strategy.long)
//
// if (in_blackout)
// strategy.close_all(comment="Blackout Flatten")
plotshape(in_blackout, title="Blackout Boolean Export", display=display.none)
Re: Event blackout module before NFP and CPI
Posted: Fri Sep 18, 2026 8:11 pm
by FTtrader
How to integrate this into your workflow:
Timezone Proof: The script forces calculations into "America/New_York" time. Whether you are trading from London, Tokyo, or Sydney, 08:30 AM EST will always align perfectly without you needing to do local timezone math.
Strategy integration: If you trade via TradingView webhooks, you can merge this code into your signal generator. Wrap your entry conditions in if not in_blackout and optionally use if in_blackout to trigger a strategy.close_all() command exactly at T−30.
Visual Anchor: The background turns red and the top-right HUD flashes a warning. It acts as a final psychological circuit breaker right before you try to hero-trade that 13:55 London urge.
Re: Event blackout module before NFP and CPI
Posted: Fri Sep 18, 2026 8:12 pm
by FTtrader
To systemize this mandate, below is a refactored Pine Script (v5) designed for strict adherence. It establishes a visual exclusion zone and, crucially, generates a boolean state (in_blackout) that can be integrated into your execution logic to mechanically override manual hotkeys or automated entry signals.
Tier-1 Event Risk Mitigation Module (Pine Script v5)
Code: Select all
//@version=5
indicator("Risk Mitigation: Event Blackout [Tier-1]", overlay=true)
// =====================================================================
// PARAMETERS & THRESHOLDS
// =====================================================================
grp_time = "Macro Event Time (EST/EDT Anchor)"
// Default to 08:30 AM New York (Standard NFP/CPI baseline)
news_hour = input.int(8, title="Release Hour", group=grp_time, minval=0, maxval=23)
news_minute = input.int(30, title="Release Minute", group=grp_time, minval=0, maxval=59)
grp_rules = "Operational Window"
pre_mins = input.int(30, title="T-Minus Moratorium (mins)", group=grp_rules, tooltip="Initiate hard-flatten; block new exposure")
post_mins = input.int(15, title="Post-Release Stand-Aside (mins)", group=grp_rules, tooltip="Allow price discovery; wait for spread normalization")
show_bg = input.bool(true, title="Display Visual Exclusion Zone", group=grp_rules)
// =====================================================================
// TEMPORAL LOGIC (Anchored to NY to bypass local DST variances)
// =====================================================================
ny_hour = hour(time, "America/New_York")
ny_minute = minute(time, "America/New_York")
// Convert to absolute minutes from midnight for boundary enforcement
current_time_mins = ny_hour * 60 + ny_minute
news_time_mins = news_hour * 60 + news_minute
blackout_start = news_time_mins - pre_mins
blackout_end = news_time_mins + post_mins
// Boolean evaluation: True if current bar falls within the restricted window
in_blackout = (current_time_mins >= blackout_start) and (current_time_mins <= blackout_end)
// =====================================================================
// VISUAL TELEMETRY
// =====================================================================
// Render visual exclusion zone on the chart
bg_color = in_blackout and show_bg ? color.new(color.maroon, 85) : na
bgcolor(bg_color, title="Restricted Zone")
// On-chart status dashboard
var table status_tbl = table.new(position.top_right, 1, 1)
if barstate.islast
table.cell(status_tbl, 0, 0,
text = in_blackout ? "RESTRICTED: TIER-1 BLACKOUT" : "EXECUTION ENABLED: STANDARD LIQUIDITY",
bgcolor = in_blackout ? color.new(color.maroon, 20) : color.new(color.teal, 50),
text_color = color.white,
text_size = size.small)
// =====================================================================
// ALGORITHMIC EXPORT / STRATEGY INTEGRATION
// =====================================================================
// Institutional integration example for Strategy scripts:
//
// if (valid_long_setup and not in_blackout)
// strategy.entry("Long_Exec", strategy.long)
//
// if (in_blackout)
// strategy.close_all(comment="Risk Mitigation: Tier-1 Flatten")
//
plotshape(in_blackout, title="Blackout State Export", display=display.none)
Re: Event blackout module before NFP and CPI
Posted: Fri Sep 18, 2026 8:12 pm
by FTtrader
Implementation Directives:
Timezone Invariance: The logic forces the temporal calculations into "America/New_York". This ensures your 08:30 AM EST events align immaculately regardless of your execution server's local timezone, insulating the module against unexpected daylight saving time shifts.
Algorithmic Integration: If you are executing via TradingView webhooks to a prop-firm terminal, inject this boolean directly into your entry wrappers. Wrapping signal generation in if not in_blackout mathematically eliminates the possibility of an accidental breach.
Behavioral Circuit Breaker: The maroon background and upper-right telemetry serve as a visual override. When the institutional order flow algorithms are weaponized during that 13:55 London window, the UI formally reminds you that capital preservation is currently the only active mandate.
Re: Event blackout module before NFP and CPI
Posted: Fri Sep 18, 2026 8:13 pm
by FTtrader
When coding for MT4/MT5, there is a critical infrastructural difference: MetaTrader relies on Broker Server Time, not your local computer time or a globally anchored timezone like TradingView’s "America/New_York". Brokers operate on varying timezones (typically EET, GMT+2/+3). Therefore, a professional MetaTrader module must be parameterized using your specific broker's server time to ensure flawless execution.
Modern MQL4 (MT4) and MQL5 (MT5) share the same underlying compiler structure for time structs. Below is a unified, institutional-grade logic block that functions seamlessly in both environments.
You can inject this directly into your Expert Advisor (EA).
Re: Event blackout module before NFP and CPI
Posted: Fri Sep 18, 2026 8:14 pm
by FTtrader
Tier-1 Event Risk Mitigation Module (MQL4 / MQL5)
Code: Select all
//+------------------------------------------------------------------+
//| Risk Mitigation: Event Blackout Module [Tier-1] |
//| Compatibility: MT4 (MQL4) & MT5 (MQL5) |
//+------------------------------------------------------------------+
#property strict
// =====================================================================
// OPERATIONAL PARAMETERS
// =====================================================================
// CRITICAL: Set this to your BROKER'S SERVER TIME, not your local time.
// E.g., If NFP is 08:30 NY time, and your broker is GMT+3, this is 15:30.
input int NewsHour_ServerTime = 15; // Release Hour (Broker Server Time)
input int NewsMinute = 30; // Release Minute
input int PreMins = 30; // T-Minus Moratorium (mins)
input int PostMins = 15; // Post-Release Stand-Aside (mins)
input bool EnableHUD = true; // Display On-Chart Telemetry
// =====================================================================
// CORE BOOLEAN STATE: EXCLUSION ZONE LOGIC
// =====================================================================
bool IsBlackoutActive() {
datetime currentTime = TimeCurrent(); // Broker server time
MqlDateTime tm;
TimeToStruct(currentTime, tm);
// Construct the exact timestamp of today's macro event
tm.hour = NewsHour_ServerTime;
tm.min = NewsMinute;
tm.sec = 0;
datetime eventTime = StructToTime(tm);
// Calculate exclusion zone boundaries (converted to seconds)
datetime blackoutStart = eventTime - (PreMins * 60);
datetime blackoutEnd = eventTime + (PostMins * 60);
// Return true if the current server tick falls within the restricted window
if(currentTime >= blackoutStart && currentTime <= blackoutEnd) {
return true;
}
return false;
}
// =====================================================================
// VISUAL TELEMETRY (HUD)
// =====================================================================
void UpdateStatusHUD(bool isRestricted) {
if(!EnableHUD) return;
string objName = "Blackout_HUD";
// Initialize object if it doesn't exist
if(ObjectFind(0, objName) < 0) {
ObjectCreate(0, objName, OBJ_LABEL, 0, 0, 0);
ObjectSetInteger(0, objName, OBJPROP_CORNER, CORNER_RIGHT_UPPER);
ObjectSetInteger(0, objName, OBJPROP_XDISTANCE, 20);
ObjectSetInteger(0, objName, OBJPROP_YDISTANCE, 20);
ObjectSetInteger(0, objName, OBJPROP_FONTSIZE, 10);
ObjectSetString(0, objName, OBJPROP_FONT, "Arial");
}
// Update state visuals
if(isRestricted) {
ObjectSetString(0, objName, OBJPROP_TEXT, "RESTRICTED: TIER-1 BLACKOUT");
ObjectSetInteger(0, objName, OBJPROP_COLOR, clrRed);
} else {
ObjectSetString(0, objName, OBJPROP_TEXT, "EXECUTION ENABLED: NORMAL");
ObjectSetInteger(0, objName, OBJPROP_COLOR, clrMediumSeaGreen);
}
}
// =====================================================================
// EA INTEGRATION (Place inside your OnTick function)
// =====================================================================
void OnTick() {
// 1. Evaluate the current system state
bool blackoutState = IsBlackoutActive();
// 2. Update chart telemetry
UpdateStatusHUD(blackoutState);
// 3. ENFORCE HARD-FLATTEN PROTOCOL
if(blackoutState) {
// If you have open positions, trigger your closing loop here
// FlattenInventory();
// Return immediately. Do not process further EA logic.
return;
}
// 4. STANDARD EXECUTION LOGIC
// If the compiler reaches this point, the market is outside the blackout window.
// Proceed with normal signal evaluation and order execution.
// ...
}
Re: Event blackout module before NFP and CPI
Posted: Fri Sep 18, 2026 8:14 pm
by FTtrader
Implementation Directives for MT4/MT5:
The return; Gatekeeper: Notice the return; command inside the OnTick() loop when the blackout is active. This is the mechanical override. By halting the tick processor, it guarantees that no subsequent signal-generation or execution logic can fire during the exclusion zone. It physically disables the EA's ability to pull the trigger.
Server Time Alignment (Crucial): Before each Tier-1 week, verify your broker's current server time offset. A common institutional failure point is forgetting that US DST and European DST shift on different weekends. If NFP is 08:30 EST, verify exactly what time that maps to on your MetaTrader "Market Watch" clock, and input that into NewsHour_ServerTime.
Hard-Flatten Integration: Replace the commented // FlattenInventory(); with your EA's specific loop for closing market orders. During the first tick of the T−30 window, the system will evaluate blackoutState as true, forcefully liquidate open risk, and lock the terminal out of the market until T+15.
Re: Event blackout module before NFP and CPI
Posted: Fri Sep 18, 2026 8:18 pm
by FTtrader
Tailoring this strictly for the MQL4 compiler allows us to utilize MT4’s native order management functions to actively hunt and flatten inventory. This version transforms the module from a passive visual alert into an active, autonomous execution blocker.
This script includes a robust liquidation loop that handles both open positions and pending orders, utilizing the mandatory reverse-iteration method required by MT4's order indexing system.
Tier-1 Event Risk Mitigation Module (Native MQL4)
Code: Select all
//+------------------------------------------------------------------+
//| Risk Mitigation: Event Blackout Module [Tier-1] |
//| Compiler: MQL4 Strict (MetaTrader 4) |
//+------------------------------------------------------------------+
#property strict
// =====================================================================
// OPERATIONAL PARAMETERS
// =====================================================================
input string _grp1 = "--- Event Time (Broker Server Time) ---";
input int NewsHour_ServerTime = 15; // Release Hour (Match Market Watch)
input int NewsMinute = 30; // Release Minute
input string _grp2 = "--- Operational Window ---";
input int PreMins = 30; // T-Minus Moratorium (mins)
input int PostMins = 15; // Post-Release Stand-Aside (mins)
input string _grp3 = "--- Execution Risk Controls ---";
input bool FlattenOnTrigger = true; // Auto-flatten open & pending orders
input int SlippagePoints = 30; // Maximum slippage tolerance (points)
input int MagicNumberFilter = 0; // 0 = Flatten all on this symbol, >0 = specific EA
// Internal state flag to prevent server spam during the blackout
bool hasFlattenedThisCycle = false;
// =====================================================================
// CORE TEMPORAL LOGIC
// =====================================================================
bool IsBlackoutActive() {
datetime currentServerTime = TimeCurrent();
// Convert current time to absolute minutes of the current day for boundary math
int currentMinsOfDay = TimeHour(currentServerTime) * 60 + TimeMinute(currentServerTime);
int newsMinsOfDay = NewsHour_ServerTime * 60 + NewsMinute;
int blackoutStart = newsMinsOfDay - PreMins;
int blackoutEnd = newsMinsOfDay + PostMins;
if(currentMinsOfDay >= blackoutStart && currentMinsOfDay <= blackoutEnd) {
return true;
}
// Reset the flatten flag once we are completely clear of the blackout window
if(currentMinsOfDay > blackoutEnd) {
hasFlattenedThisCycle = false;
}
return false;
}
// =====================================================================
// HARD-FLATTEN PROTOCOL
// =====================================================================
void FlattenInventory() {
if(!FlattenOnTrigger || hasFlattenedThisCycle) return;
int totalOrders = OrdersTotal();
if(totalOrders == 0) {
hasFlattenedThisCycle = true;
return;
}
// MANDATORY MT4 LOGIC: Always iterate backwards when deleting/closing orders.
// Index shifting will cause missed closes if iterating forwards.
for(int i = totalOrders - 1; i >= 0; i--) {
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
// Filter for current chart symbol and magic number (if specified)
if(OrderSymbol() == Symbol() && (MagicNumberFilter == 0 || OrderMagicNumber() == MagicNumberFilter)) {
int type = OrderType();
bool result = false;
RefreshRates();
// Liquidate active market exposure
if(type == OP_BUY) {
result = OrderClose(OrderTicket(), OrderLots(), Bid, SlippagePoints, clrRed);
}
else if(type == OP_SELL) {
result = OrderClose(OrderTicket(), OrderLots(), Ask, SlippagePoints, clrRed);
}
// Purge pending limit/stop orders (critical for prop firm rules)
else if(type > OP_SELL) {
result = OrderDelete(OrderTicket(), clrOrange);
}
if(!result) {
Print("Risk Protocol Error: Failed to close ticket #", OrderTicket(), ". Error code: ", GetLastError());
}
}
}
}
// If we successfully cleared inventory, flag it so we don't spam the broker server
if(OrdersTotal() == 0 || MagicNumberFilter > 0) {
hasFlattenedThisCycle = true;
Print("Risk Protocol: Inventory successfully flattened at T-", PreMins);
}
}
// =====================================================================
// VISUAL TELEMETRY
// =====================================================================
void UpdateStatusHUD(bool isRestricted) {
string objName = "Blackout_HUD_MT4";
if(ObjectFind(0, objName) < 0) {
ObjectCreate(0, objName, OBJ_LABEL, 0, 0, 0);
ObjectSetInteger(0, objName, OBJPROP_CORNER, CORNER_RIGHT_UPPER);
ObjectSetInteger(0, objName, OBJPROP_XDISTANCE, 15);
ObjectSetInteger(0, objName, OBJPROP_YDISTANCE, 20);
ObjectSetInteger(0, objName, OBJPROP_FONTSIZE, 11);
ObjectSetString(0, objName, OBJPROP_FONT, "Trebuchet MS");
ObjectSetInteger(0, objName, OBJPROP_SELECTABLE, false);
}
if(isRestricted) {
ObjectSetString(0, objName, OBJPROP_TEXT, " MODULE ACTIVE: TIER-1 BLACKOUT ");
ObjectSetInteger(0, objName, OBJPROP_COLOR, clrWhite);
// Fallback for background color simulation in standard labels
ObjectSetInteger(0, objName, OBJPROP_BGCOLOR, clrMaroon);
} else {
ObjectSetString(0, objName, OBJPROP_TEXT, " SYSTEM ARMED: CLEAR ");
ObjectSetInteger(0, objName, OBJPROP_COLOR, clrLimeGreen);
ObjectSetInteger(0, objName, OBJPROP_BGCOLOR, clrBlack);
}
}
// =====================================================================
// EA TICK PROCESSOR
// =====================================================================
void OnTick() {
bool blackoutState = IsBlackoutActive();
UpdateStatusHUD(blackoutState);
// 1. GATEKEEPER TRIGGER
if(blackoutState) {
// Execute flatten protocol on the first tick of the T-30 window
FlattenInventory();
// Hard override: Return immediately. No EA entry logic can process below this line.
return;
}
// 2. STANDARD EXECUTION LOGIC GOES BELOW
// e.g., if(RSI < 30) OrderSend(...);
}