Friday flat-by rule: my cut-off clock and why I keep it rigid
-
LondonScalper
- Posts: 407
- Joined: Sat Sep 05, 2026 7:54 am
Friday flat-by rule: my cut-off clock and why I keep it rigid
Evergreen Friday process — not about this week’s calendar.
I keep a hard flat-by clock on Fridays. For my desk that’s 15:30 London for new risk, and flat of discretionary scalps shortly after. The exact minute matters less than not moving it because a setup “still looks good.”
Why rigid
Friday afternoon liquidity thins, spreads behave badly on crosses, and my decision quality drops once I’m tired and protective of the week. A soft “I’ll stop soon” always becomes one more ticket. A written cut-off does not.
What still allowed after the clock
• Managing an already-open position to a planned exit (rare; I prefer flat earlier)
• Logging the day
• Checking weekend maintenance / swap notes
What is not allowed: “small” revenge size, picking up metals because Asia might gap, or widening the clock by thirty minutes “just this once.”
I treat the cut-off like a news blackout — pre-committed, not negotiated. If the week is green, the rule protects the week. If the week is red, the rule stops me digging.
Anyone else use a fixed Friday clock rather than “when it feels quiet”? Interested in where you draw the line for XAU versus majors.
I keep a hard flat-by clock on Fridays. For my desk that’s 15:30 London for new risk, and flat of discretionary scalps shortly after. The exact minute matters less than not moving it because a setup “still looks good.”
Why rigid
Friday afternoon liquidity thins, spreads behave badly on crosses, and my decision quality drops once I’m tired and protective of the week. A soft “I’ll stop soon” always becomes one more ticket. A written cut-off does not.
What still allowed after the clock
• Managing an already-open position to a planned exit (rare; I prefer flat earlier)
• Logging the day
• Checking weekend maintenance / swap notes
What is not allowed: “small” revenge size, picking up metals because Asia might gap, or widening the clock by thirty minutes “just this once.”
I treat the cut-off like a news blackout — pre-committed, not negotiated. If the week is green, the rule protects the week. If the week is red, the rule stops me digging.
Anyone else use a fixed Friday clock rather than “when it feels quiet”? Interested in where you draw the line for XAU versus majors.
Re: Friday flat-by rule: my cut-off clock and why I keep it rigid
Hi LondonScalper,LondonScalper wrote: Sat Sep 12, 2026 8:44 pm Evergreen Friday process — not about this week’s calendar.
I keep a hard flat-by clock on Fridays. For my desk that’s 15:30 London for new risk, and flat of discretionary scalps shortly after. The exact minute matters less than not moving it because a setup “still looks good.”
Why rigid
Friday afternoon liquidity thins, spreads behave badly on crosses, and my decision quality drops once I’m tired and protective of the week. A soft “I’ll stop soon” always becomes one more ticket. A written cut-off does not.
What still allowed after the clock
• Managing an already-open position to a planned exit (rare; I prefer flat earlier)
• Logging the day
• Checking weekend maintenance / swap notes
What is not allowed: “small” revenge size, picking up metals because Asia might gap, or widening the clock by thirty minutes “just this once.”
I treat the cut-off like a news blackout — pre-committed, not negotiated. If the week is green, the rule protects the week. If the week is red, the rule stops me digging.
Anyone else use a fixed Friday clock rather than “when it feels quiet”? Interested in where you draw the line for XAU versus majors.
Your approach to a hard Friday cut-off is one of the most effective structural defenses a trader can build. Willpower is a depleting resource, and by Friday afternoon, decision fatigue guarantees that a soft "I'll stop soon" turns into forced, low-quality setups.
Treating it like a pre-committed news blackout removes the negotiation entirely.
Regarding your question about XAU versus FX Majors:
XAU (Gold): Drawing the line at 15:30 London is excellent for metals, and many institutional traders pull liquidity even slightly earlier (right after the 15:00 London PM fix). After 15:30, XAU order books thin out significantly. If you take a scalp here, you are entirely at the mercy of random algorithmic sweeps or widening spreads going into the NY afternoon.
FX Majors: Majors like EURUSD or GBPUSD will still see a massive spike in volume at 16:00 London due to the WM/Refinitiv (WMR) fix. However, this is institutional rebalancing flow—it is notoriously choppy, spikes in both directions, and doesn't respect technical levels. By being flat at 15:30, you completely side-step the 16:00 fix volatility and protect your week.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: Friday flat-by rule: my cut-off clock and why I keep it rigid
Here is a Pine Script (v5) that visually enforces your "Evergreen Friday Process." It paints the background of your chart to clearly mark the "No Trade Zone" starting exactly at 15:30 London time, acting as a visual barrier against taking new risk.
Friday Hard Cut-Off Pine Script
Friday Hard Cut-Off Pine Script
Code: Select all
//@version=5
indicator("Friday Hard Cut-off (No Trade Zone)", overlay=true)
// --- USER INPUTS ---
cutoffHour = input.int(15, title="Cut-off Hour (24h format)", minval=0, maxval=23)
cutoffMinute = input.int(30, title="Cut-off Minute", minval=0, maxval=59)
tz = input.string("Europe/London", title="Timezone")
// --- TIME LOGIC ---
// Fetch current time components based on the London timezone
currentDay = dayofweek(time, tz)
currentHour = hour(time, tz)
currentMinute = minute(time, tz)
// Check if today is Friday and if current time is past the cut-off
isFriday = (currentDay == dayofweek.friday)
pastCutoff = (currentHour > cutoffHour) or (currentHour == cutoffHour and currentMinute >= cutoffMinute)
// Define the restricted zone
noTradeZone = isFriday and pastCutoff
// Detect the exact candle where the cut-off triggers
triggerCandle = noTradeZone and not noTradeZone[1]
// --- VISUAL ENFORCEMENT ---
// 1. Paint the background dim red to signal "No New Risk"
bgcolor(noTradeZone ? color.new(color.red, 85) : na, title="No Trade Zone Background")
// 2. Drop a prominent label at the exact cut-off minute
plotshape(triggerCandle, style=shape.labeldown, location=location.abovebar, color=color.red, text="FLAT\nBY\nCLOCK", textcolor=color.white, size=size.small)
// --- STRATEGY INTEGRATION (Optional) ---
// If you ever convert this to a 'strategy()' script rather than an 'indicator()',
// you can uncomment the code below to auto-liquidate your paper/live positions at 15:30:
//
// if triggerCandle
// strategy.close_all(comment="Friday Hard Stop Reached")Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: Friday flat-by rule: my cut-off clock and why I keep it rigid
How to use this script:
Open TradingView, go to the Pine Editor tab at the bottom.
Delete any existing code, paste the script above, and click Add to Chart.
What it does: Every Friday at exactly 15:30 London time, the chart background will turn red, and a "FLAT BY CLOCK" label will print above the candle. The red background will remain until the market closes for the weekend, reminding you that no new risk is allowed, regardless of how good a setup looks.
Settings: If you ever need to adjust the time (e.g., dropping it to 15:00 for XAU), you can change it directly in the indicator settings menu without touching the code.
Open TradingView, go to the Pine Editor tab at the bottom.
Delete any existing code, paste the script above, and click Add to Chart.
What it does: Every Friday at exactly 15:30 London time, the chart background will turn red, and a "FLAT BY CLOCK" label will print above the candle. The red background will remain until the market closes for the weekend, reminding you that no new risk is allowed, regardless of how good a setup looks.
Settings: If you ever need to adjust the time (e.g., dropping it to 15:00 for XAU), you can change it directly in the indicator settings menu without touching the code.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: Friday flat-by rule: my cut-off clock and why I keep it rigid
To elevate this to an institutional-grade tool, the script needs to move beyond a simple background color and act as a comprehensive risk-management module.
A professional implementation requires dynamic asset detection (automatically applying different rules for XAU vs. FX), a heads-up display (HUD) for real-time state tracking, and automated alerts so you don't have to watch the clock manually.
Here is the upgraded Pine Script (v5).
A professional implementation requires dynamic asset detection (automatically applying different rules for XAU vs. FX), a heads-up display (HUD) for real-time state tracking, and automated alerts so you don't have to watch the clock manually.
Here is the upgraded Pine Script (v5).
Code: Select all
//@version=5
indicator("Institutional Friday Cut-Off Manager", overlay=true, max_labels_count=50)
// ==============================================================================
// 1. INPUTS & CONFIGURATION
// ==============================================================================
grp_time = "⏰ Cut-Off Specifications (London Time)"
tz = input.string("Europe/London", title="Timezone", group=grp_time)
cutoffHour_FX = input.int(15, title="FX Cut-off Hour", minval=0, maxval=23, group=grp_time)
cutoffMin_FX = input.int(30, title="FX Cut-off Minute", minval=0, maxval=59, group=grp_time)
cutoffHour_XAU = input.int(15, title="XAU Cut-off Hour", minval=0, maxval=23, group=grp_time, tooltip="Institutions often pull metal liquidity earlier than FX.")
cutoffMin_XAU = input.int(00, title="XAU Cut-off Minute", minval=0, maxval=59, group=grp_time)
warningMins = input.int(30, title="Pre-Warning Window (Mins)", minval=5, group=grp_time)
grp_ui = "🖥️ Dashboard & Visuals"
showDash = input.bool(true, title="Show Status HUD", group=grp_ui)
dashPos = input.string(position.top_right, title="HUD Position", options=[position.top_right, position.bottom_right, position.top_left, position.bottom_left], group=grp_ui)
bgToggle = input.bool(true, title="Paint 'No Trade' Background", group=grp_ui)
// ==============================================================================
// 2. DYNAMIC ASSET DETECTION & TIME LOGIC
// ==============================================================================
// Auto-detect if the chart is a metal to apply stricter liquidity rules
isMetals = syminfo.type == "metal" or str.contains(syminfo.tickerid, "XAU") or str.contains(syminfo.tickerid, "GOLD")
activeHour = isMetals ? cutoffHour_XAU : cutoffHour_FX
activeMin = isMetals ? cutoffMin_XAU : cutoffMin_FX
// Time calculations
currDay = dayofweek(time, tz)
isFriday = currDay == dayofweek.friday
currHour = hour(time, tz)
currMin = minute(time, tz)
currTimeInMins = (currHour * 60) + currMin
cutoffTimeInMins = (activeHour * 60) + activeMin
minsToCutoff = cutoffTimeInMins - currTimeInMins
// Define operational states
isWarning = isFriday and (minsToCutoff <= warningMins) and (minsToCutoff > 0)
isCutoff = isFriday and (currTimeInMins >= cutoffTimeInMins)
// Detect state transitions for alerts & labels
triggerWarning = isWarning and not isWarning[1]
triggerCutoff = isCutoff and not isCutoff[1]
// ==============================================================================
// 3. VISUAL ENFORCEMENT & ALERTS
// ==============================================================================
// Background coloring
stateColor = isCutoff ? color.new(color.red, 85) : isWarning ? color.new(color.orange, 90) : na
bgcolor(bgToggle ? stateColor : na, title="Cut-off Background")
// Chart Labels at exact trigger minute
plotshape(triggerCutoff, style=shape.labeldown, location=location.abovebar, color=color.red, text="HARD CUT-OFF\nNO NEW RISK", textcolor=color.white, size=size.small)
// Automated Alerts
if triggerWarning
alert("Friday Risk Manager: 30 minutes to hard cut-off. Manage open positions.", alert.freq_once_per_bar)
if triggerCutoff
alert("Friday Risk Manager: HARD CUT-OFF REACHED. No new risk allowed.", alert.freq_once_per_bar)
// ==============================================================================
// 4. HEADS-UP DISPLAY (HUD)
// ==============================================================================
var table hud = table.new(dashPos, 2, 4, bgcolor=color.new(color.gray, 90), border_width=1, border_color=color.gray)
if barstate.islast and showDash
// Table Headers
table.cell(hud, 0, 0, "Asset Class", text_color=color.gray, text_size=size.small)
table.cell(hud, 1, 0, isMetals ? "METALS" : "FX MAJOR", text_color=color.white, text_size=size.small, text_halign=text.align_right)
table.cell(hud, 0, 1, "Cut-off Time", text_color=color.gray, text_size=size.small)
table.cell(hud, 1, 1, str.tostring(activeHour, "00") + ":" + str.tostring(activeMin, "00") + " LDN", text_color=color.white, text_size=size.small, text_halign=text.align_right)
// Dynamic Status Row
table.cell(hud, 0, 2, "Status", text_color=color.gray, text_size=size.small)
statusText = not isFriday ? "NORMAL" : isCutoff ? "LOCKED" : isWarning ? "WINDING DOWN" : "ACTIVE"
statusColor = not isFriday ? color.gray : isCutoff ? color.red : isWarning ? color.orange : color.green
table.cell(hud, 1, 2, statusText, text_color=statusColor, text_size=size.small, text_halign=text.align_right)
// Countdown Row (Only visible on Fridays before cut-off)
table.cell(hud, 0, 3, isFriday and not isCutoff ? "Mins Remaining" : "", text_color=color.gray, text_size=size.small)
table.cell(hud, 1, 3, isFriday and not isCutoff ? str.tostring(minsToCutoff) : "", text_color=statusColor, text_size=size.small, text_halign=text.align_right)Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: Friday flat-by rule: my cut-off clock and why I keep it rigid
Key Professional Upgrades
Dynamic Asset Detection: The script automatically reads the chart you are on. If it detects XAU or a metals classification, it automatically applies a stricter 15:00 cut-off (adjustable in settings). If you flip to EURUSD, it seamlessly shifts the cut-off to 15:30.
The 30-Minute Warning Window: Going cold turkey at 15:30 often leaves traders scrambling if they are in an active scalp. This script introduces an "orange zone" 30 minutes prior. It shifts your mindset from "seeking setups" to "managing open exits."
Real-Time Status HUD: A clean, non-intrusive table sits in the corner of your chart. It confirms which asset profile is active, displays the exact target time, and provides a live minute-countdown until the desk is locked.
Server-Side Alerts: You can now link this to TradingView's alert system. Set an alert for the indicator, and it will push a notification to your phone or desktop at the 30-minute warning and exactly at the cut-off, allowing you to step away from the screens entirely.
Dynamic Asset Detection: The script automatically reads the chart you are on. If it detects XAU or a metals classification, it automatically applies a stricter 15:00 cut-off (adjustable in settings). If you flip to EURUSD, it seamlessly shifts the cut-off to 15:30.
The 30-Minute Warning Window: Going cold turkey at 15:30 often leaves traders scrambling if they are in an active scalp. This script introduces an "orange zone" 30 minutes prior. It shifts your mindset from "seeking setups" to "managing open exits."
Real-Time Status HUD: A clean, non-intrusive table sits in the corner of your chart. It confirms which asset profile is active, displays the exact target time, and provides a live minute-countdown until the desk is locked.
Server-Side Alerts: You can now link this to TradingView's alert system. Set an alert for the indicator, and it will push a notification to your phone or desktop at the 30-minute warning and exactly at the cut-off, allowing you to step away from the screens entirely.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: Friday flat-by rule: my cut-off clock and why I keep it rigid
To elevate this script to the level of a proprietary trading firm's Risk Management module, we must transition it from a passive timer to an active Chief Risk Officer (CRO) protocol.
Institutional risk tools do not just track time; they track context, map known volatility events, and surface predefined rules precisely when decision fatigue peaks.
Here is the ultimate iteration. It introduces Weekly PnL Context (tightening the belt if you are already green), visualizes the WMR Fix Danger Zone so you can see the chop you are avoiding, and dynamically alters the HUD to display your specific Rules of Engagement once the cut-off triggers.
Enterprise Friday Risk Protocol
Institutional risk tools do not just track time; they track context, map known volatility events, and surface predefined rules precisely when decision fatigue peaks.
Here is the ultimate iteration. It introduces Weekly PnL Context (tightening the belt if you are already green), visualizes the WMR Fix Danger Zone so you can see the chop you are avoiding, and dynamically alters the HUD to display your specific Rules of Engagement once the cut-off triggers.
Enterprise Friday Risk Protocol
Code: Select all
//@version=5
indicator("Enterprise Friday Risk Protocol", overlay=true, max_labels_count=50, max_boxes_count=50)
// ==============================================================================
// 1. DESK CONFIGURATION & PNL CONTEXT
// ==============================================================================
grp_desk = "🏢 Risk Desk Parameters"
weekStatus = input.string("Neutral", title="Current Week Status", options=["Green (Protect)", "Red (Stop Digging)", "Neutral"], group=grp_desk, tooltip="If Green, the system automatically pulls the cut-off forward by 15 mins to protect the week.")
tz = input.string("Europe/London", title="Timezone", group=grp_desk)
grp_asset = "📊 Asset Liquidity Profiles (London Time)"
cutoffHour_FX = input.int(15, title="FX Cut-off", minval=0, maxval=23, group=grp_asset, inline="fx")
cutoffMin_FX = input.int(30, title=":", minval=0, maxval=59, group=grp_asset, inline="fx")
cutoffHour_XAU = input.int(15, title="XAU Cut-off", minval=0, maxval=23, group=grp_asset, inline="xau")
cutoffMin_XAU = input.int(00, title=":", minval=0, maxval=59, group=grp_asset, inline="xau")
warningMins = input.int(30, title="Wind-down Window (Mins)", minval=5, group=grp_asset)
grp_ui = "🖥️ HUD & Visuals"
showDash = input.bool(true, title="Enable Dynamic HUD", group=grp_ui)
showWMR = input.bool(true, title="Highlight 16:00 WMR Fix (Danger Zone)", group=grp_ui)
// ==============================================================================
// 2. DYNAMIC ASSET & TIME PROCESSING
// ==============================================================================
// Auto-detect asset class
isMetals = syminfo.type == "metal" or str.contains(syminfo.tickerid, "XAU") or str.contains(syminfo.tickerid, "GOLD")
baseHour = isMetals ? cutoffHour_XAU : cutoffHour_FX
baseMin = isMetals ? cutoffMin_XAU : cutoffMin_FX
// Apply Weekly PnL Guardrail: If Green, cut-off is pulled forward 15 mins
protectFactor = weekStatus == "Green (Protect)" ? 15 : 0
// Time logic
currDay = dayofweek(time, tz)
isFriday = currDay == dayofweek.friday
currHour = hour(time, tz)
currMin = minute(time, tz)
currTimeInMins = (currHour * 60) + currMin
cutoffTimeInMins = (baseHour * 60) + baseMin - protectFactor
minsToCutoff = cutoffTimeInMins - currTimeInMins
// Define operational states
isWarning = isFriday and (minsToCutoff <= warningMins) and (minsToCutoff > 0)
isCutoff = isFriday and (currTimeInMins >= cutoffTimeInMins)
isWMR = isFriday and (currHour == 16 and currMin <= 15) // WMR Fix Window (16:00 - 16:15)
// Triggers for one-time events
triggerWarning = isWarning and not isWarning[1]
triggerCutoff = isCutoff and not isCutoff[1]
// ==============================================================================
// 3. CHART VISUALS & DANGER ZONES
// ==============================================================================
// Tri-State Background
stateColor = isCutoff ? color.new(#b71c1c, 85) : isWarning ? color.new(#f57c00, 90) : na
bgcolor(stateColor, title="Desk Status Background")
// WMR Fix Volatility Block (Visualizing what you are avoiding)
bgcolor(showWMR and isWMR ? color.new(color.gray, 80) : na, title="WMR Fix Danger Zone")
// Cut-off execution label
if triggerCutoff
labelText = weekStatus == "Green (Protect)" ? "PROFIT LOCKED\nNO NEW RISK" : "DESK CLOSED\nNO NEW RISK"
label.new(bar_index, high, text=labelText, color=color.new(#b71c1c, 0), textcolor=color.white, style=label.style_label_down, yloc=yloc.abovebar, size=size.normal)
// ==============================================================================
// 4. DYNAMIC RULE-BASED HUD
// ==============================================================================
// The HUD expands and changes context based on whether the desk is open or closed.
var table hud = table.new(position.top_right, 2, 7, bgcolor=color.new(#1e222d, 10), border_width=1, border_color=#434651)
if barstate.islast and showDash
// --- Standard Header ---
table.cell(hud, 0, 0, "ASSET PROFILE", text_color=#8a91a5, text_size=size.small, text_halign=text.align_left)
table.cell(hud, 1, 0, isMetals ? "METALS (XAU)" : "FX MAJOR", text_color=color.white, text_size=size.small, text_halign=text.align_right)
table.cell(hud, 0, 1, "DESK CUT-OFF", text_color=#8a91a5, text_size=size.small, text_halign=text.align_left)
// Format cut-off time for display, accounting for the 15-min protection shift
displayHour = math.floor(cutoffTimeInMins / 60)
displayMin = cutoffTimeInMins % 60
table.cell(hud, 1, 1, str.tostring(displayHour, "00") + ":" + str.tostring(displayMin, "00") + " LDN", text_color=color.white, text_size=size.small, text_halign=text.align_right)
// --- Dynamic Status ---
table.cell(hud, 0, 2, "STATUS", text_color=#8a91a5, text_size=size.small, text_halign=text.align_left)
statusText = not isFriday ? "NORMAL" : isCutoff ? "LOCKED" : isWarning ? "WINDING DOWN" : "ACTIVE"
statusColor = not isFriday ? color.gray : isCutoff ? #ff5252 : isWarning ? #ffaa00 : #00e676
table.cell(hud, 1, 2, statusText, text_color=statusColor, text_size=size.small, text_halign=text.align_right)
// --- Active Trading View (Pre Cut-off) ---
if not isCutoff and isFriday
table.cell(hud, 0, 3, "TIME REMAINING", text_color=#8a91a5, text_size=size.small, text_halign=text.align_left)
table.cell(hud, 1, 3, str.tostring(minsToCutoff) + " MIN", text_color=statusColor, text_size=size.small, text_halign=text.align_right)
table.cell(hud, 0, 4, "WEEK CONTEXT", text_color=#8a91a5, text_size=size.small, text_halign=text.align_left)
table.cell(hud, 1, 4, weekStatus, text_color=color.white, text_size=size.small, text_halign=text.align_right)
// Clear unused rows
table.cell(hud, 0, 5, ""), table.cell(hud, 1, 5, "")
table.cell(hud, 0, 6, ""), table.cell(hud, 1, 6, "")
// --- Locked Desk View (Post Cut-off Protocol Display) ---
else if isCutoff
// When cut-off hits, the HUD transforms to display your exact rules.
table.cell(hud, 0, 3, "PROTOCOL", text_color=#ff5252, text_size=size.small, text_halign=text.align_left)
table.cell(hud, 1, 3, "HARD BLACKOUT", text_color=#ff5252, text_size=size.small, text_halign=text.align_right)
table.cell(hud, 0, 4, "✅ ALLOWED", text_color=#00e676, text_size=size.small, text_halign=text.align_left)
table.cell(hud, 1, 4, "• Manage Open to Exit\n• Log the Day\n• Swap Notes", text_color=color.white, text_size=size.small, text_halign=text.align_right)
table.cell(hud, 0, 5, "❌ DENIED", text_color=#ff5252, text_size=size.small, text_halign=text.align_left)
table.cell(hud, 1, 5, "• Revenge Size\n• Asia Gap Metals\n• +30 Min Extension", text_color=color.white, text_size=size.small, text_halign=text.align_right)
table.cell(hud, 0, 6, "RATIONALE", text_color=#8a91a5, text_size=size.small, text_halign=text.align_left)
table.cell(hud, 1, 6, weekStatus == "Green (Protect)" ? "Protect the Week." : "Stop Digging.", text_color=color.white, text_size=size.small, text_halign=text.align_right)Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: Friday flat-by rule: my cut-off clock and why I keep it rigid
Pro-Grade Additions Explained
Contextual Guardrails (Green vs. Red Week): In the settings menu, you can now set your "Current Week Status" to Green, Red, or Neutral. If you mark it as Green, the script automatically pulls your hard cut-off forward by 15 minutes. It forces you to protect the PnL and eliminates the temptation of the final "victory lap" trade.
WMR Fix "Danger Zone" Mapping: Between 16:00 and 16:15 London time, a dark gray block is painted on the chart. This is the WM/Refinitiv Fix window. By visually mapping this zone after your cut-off, it serves as psychological reinforcement—you can literally watch the erratic, institutional rebalancing chop happen in the gray box while you sit safely flat.
State-Shifting HUD (The Rule Enforcer): While the desk is active, the HUD is minimal, showing your countdown timer and week context. The moment 15:30 hits, the HUD transforms. It wipes the timer and replaces it with your exact written rules:
ALLOWED: Manage Open to Exit, Log the Day.
DENIED: Revenge Size, Asia Gap. You do not have to rely on memory; your exact trading plan is permanently burned into the screen until the market closes.
Institutional Styling: The UI code uses bespoke hex colors (e.g., #1e222d background, #8a91a5 text) that match professional dark-mode trading terminals, moving away from TradingView's basic default colors.
To update, simply replace the previous code in the Pine Editor. Every Friday morning, open the indicator settings, select if you are Green or Red for the week, and let the protocol dictate the afternoon.
Contextual Guardrails (Green vs. Red Week): In the settings menu, you can now set your "Current Week Status" to Green, Red, or Neutral. If you mark it as Green, the script automatically pulls your hard cut-off forward by 15 minutes. It forces you to protect the PnL and eliminates the temptation of the final "victory lap" trade.
WMR Fix "Danger Zone" Mapping: Between 16:00 and 16:15 London time, a dark gray block is painted on the chart. This is the WM/Refinitiv Fix window. By visually mapping this zone after your cut-off, it serves as psychological reinforcement—you can literally watch the erratic, institutional rebalancing chop happen in the gray box while you sit safely flat.
State-Shifting HUD (The Rule Enforcer): While the desk is active, the HUD is minimal, showing your countdown timer and week context. The moment 15:30 hits, the HUD transforms. It wipes the timer and replaces it with your exact written rules:
Institutional Styling: The UI code uses bespoke hex colors (e.g., #1e222d background, #8a91a5 text) that match professional dark-mode trading terminals, moving away from TradingView's basic default colors.
To update, simply replace the previous code in the Pine Editor. Every Friday morning, open the indicator settings, select if you are Green or Red for the week, and let the protocol dictate the afternoon.
Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: Friday flat-by rule: my cut-off clock and why I keep it rigid
Moving this from TradingView to MetaTrader requires a fundamental shift in architecture. MetaTrader relies on Broker Time (which is usually GMT+2 or GMT+3), and unlike TradingView, market data (ticks) can completely stop during thin Friday afternoons.
To ensure your cut-off executes exactly on the minute, even if volume is dead and no price ticks are arriving, we must build this as a Timer-Driven Indicator rather than a tick-driven one.
Below are the complete, professional-grade source codes for both MT4 and MT5.
Important: The Broker Time Conversion
You must input the cut-off hours in your Broker's Timezone (the time shown at the bottom of your MT4/MT5 chart), not London time.
If your broker is GMT+3 (standard for most MT brokers like IC Markets, FTMO, Pepperstone), London 15:30 is 17:30 Broker Time.
1. MetaTrader 4 (MQL4) Code
How to install:
1.) Open MT4 > Press F4 to open MetaEditor.
2.) In the Navigator, right-click Indicators > New Indicator. Name it FridayRiskManager.
3.) Delete all default code, paste the code below, and click Compile.
To ensure your cut-off executes exactly on the minute, even if volume is dead and no price ticks are arriving, we must build this as a Timer-Driven Indicator rather than a tick-driven one.
Below are the complete, professional-grade source codes for both MT4 and MT5.
Important: The Broker Time Conversion
You must input the cut-off hours in your Broker's Timezone (the time shown at the bottom of your MT4/MT5 chart), not London time.
If your broker is GMT+3 (standard for most MT brokers like IC Markets, FTMO, Pepperstone), London 15:30 is 17:30 Broker Time.
1. MetaTrader 4 (MQL4) Code
How to install:
1.) Open MT4 > Press F4 to open MetaEditor.
2.) In the Navigator, right-click Indicators > New Indicator. Name it FridayRiskManager.
3.) Delete all default code, paste the code below, and click Compile.
Code: Select all
//+------------------------------------------------------------------+
//| FridayRiskManager.mq4 |
//| Enterprise Friday Risk Protocol |
//+------------------------------------------------------------------+
#property copyright "Risk Desk Protocol"
#property indicator_chart_window
#property indicator_buffers 0
#property strict
enum ENUM_WEEK_STATUS {
STATUS_NEUTRAL=0, // Neutral
STATUS_GREEN=1, // Green (Protect)
STATUS_RED=2 // Red (Stop Digging)
};
input string Grp1 = "--- Risk Desk Parameters ---";
input ENUM_WEEK_STATUS InpWeekStatus = STATUS_NEUTRAL; // Current Week Status
input string Grp2 = "--- Cut-offs (BROKER TIME) ---";
input int InpCutoffHour_FX = 17; // FX Cut-off Hour
input int InpCutoffMin_FX = 30; // FX Cut-off Minute
input int InpCutoffHour_XAU = 17; // XAU Cut-off Hour
input int InpCutoffMin_XAU = 0; // XAU Cut-off Minute
input int InpWarningMins = 30; // Wind-down Window (Mins)
input string Grp3 = "--- Visuals ---";
input color ColorWarning = clrDarkOrange; // Warning Color
input color ColorLocked = clrFireBrick; // Locked Color
bool isMetals;
int baseHour, baseMin, protectFactor;
int state = 0; // 0=Normal, 1=Warning, 2=Cutoff
int OnInit() {
EventSetTimer(1); // Run every second to catch exact minute
string sym = Symbol();
isMetals = (StringFind(sym, "XAU") >= 0 || StringFind(sym, "GOLD") >= 0);
baseHour = isMetals ? InpCutoffHour_XAU : InpCutoffHour_FX;
baseMin = isMetals ? InpCutoffMin_XAU : InpCutoffMin_FX;
protectFactor = (InpWeekStatus == STATUS_GREEN) ? 15 : 0;
return(INIT_SUCCEEDED);
}
void OnDeinit(const int reason) {
EventKillTimer();
ObjectsDeleteAll(0, "FriRisk_");
ChartRedraw();
}
int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) {
return(rates_total);
}
void OnTimer() {
datetime now = TimeCurrent();
MqlDateTime dt;
TimeToStruct(now, dt);
if(dt.day_of_week != 5) {
ObjectsDeleteAll(0, "FriRisk_");
ChartRedraw();
return; // Not Friday
}
int currMins = (dt.hour * 60) + dt.min;
int cutoffMins = (baseHour * 60) + baseMin - protectFactor;
int minsRemaining = cutoffMins - currMins;
int prevState = state;
if(currMins >= cutoffMins) state = 2;
else if(minsRemaining <= InpWarningMins && minsRemaining > 0) state = 1;
else state = 0;
// Alerts
if(state == 1 && prevState == 0) Alert("Friday Risk: " + IntegerToString(InpWarningMins) + " mins to hard cut-off. Manage open positions.");
if(state == 2 && prevState == 1) {
Alert("HARD CUT-OFF REACHED. No new risk allowed.");
PlaySound("timeout.wav");
}
DrawHUD(state, minsRemaining, cutoffMins);
DrawBackground(state);
ChartRedraw();
}
void DrawLabel(string name, string text, color clr, int x, int y) {
if(ObjectFind(0, name) < 0) {
ObjectCreate(0, name, OBJ_LABEL, 0, 0, 0);
ObjectSetInteger(0, name, OBJPROP_CORNER, CORNER_RIGHT_UPPER);
ObjectSetInteger(0, name, OBJPROP_BACK, false);
ObjectSetString(0, name, OBJPROP_FONT, "Arial");
ObjectSetInteger(0, name, OBJPROP_FONTSIZE, 9);
}
ObjectSetString(0, name, OBJPROP_TEXT, text);
ObjectSetInteger(0, name, OBJPROP_COLOR, clr);
ObjectSetInteger(0, name, OBJPROP_XDISTANCE, x);
ObjectSetInteger(0, name, OBJPROP_YDISTANCE, y);
}
void DrawHUD(int currentState, int minsLeft, int cutoff) {
int x1 = 150, x2 = 10, yStart = 20, yGap = 15;
string assetTxt = isMetals ? "METALS (XAU)" : "FX MAJOR";
string timeTxt = IntegerToString(cutoff / 60, 2, '0') + ":" + IntegerToString(cutoff % 60, 2, '0') + " BRK";
string statusTxt = currentState == 2 ? "LOCKED" : (currentState == 1 ? "WINDING DOWN" : "ACTIVE");
color statusClr = currentState == 2 ? clrRed : (currentState == 1 ? clrOrange : clrLimeGreen);
DrawLabel("FriRisk_L1_L", "ASSET PROFILE", clrGray, x1, yStart);
DrawLabel("FriRisk_L1_R", assetTxt, clrWhite, x2, yStart);
DrawLabel("FriRisk_L2_L", "DESK CUT-OFF", clrGray, x1, yStart + yGap);
DrawLabel("FriRisk_L2_R", timeTxt, clrWhite, x2, yStart + yGap);
DrawLabel("FriRisk_L3_L", "STATUS", clrGray, x1, yStart + yGap*2);
DrawLabel("FriRisk_L3_R", statusTxt, statusClr, x2, yStart + yGap*2);
if(currentState < 2) {
DrawLabel("FriRisk_L4_L", "TIME REMAINING", clrGray, x1, yStart + yGap*3);
DrawLabel("FriRisk_L4_R", IntegerToString(minsLeft) + " MIN", statusClr, x2, yStart + yGap*3);
string weekTxt = (InpWeekStatus == STATUS_GREEN) ? "Green (Protect)" : ((InpWeekStatus == STATUS_RED) ? "Red (Stop Dig)" : "Neutral");
DrawLabel("FriRisk_L5_L", "WEEK CONTEXT", clrGray, x1, yStart + yGap*4);
DrawLabel("FriRisk_L5_R", weekTxt, clrWhite, x2, yStart + yGap*4);
ObjectDelete(0, "FriRisk_L6_L"); ObjectDelete(0, "FriRisk_L6_R");
ObjectDelete(0, "FriRisk_L7_L"); ObjectDelete(0, "FriRisk_L7_R");
} else {
DrawLabel("FriRisk_L4_L", "PROTOCOL", clrRed, x1, yStart + yGap*3);
DrawLabel("FriRisk_L4_R", "HARD BLACKOUT", clrRed, x2, yStart + yGap*3);
DrawLabel("FriRisk_L5_L", "[+] ALLOWED", clrLimeGreen, x1, yStart + yGap*4);
DrawLabel("FriRisk_L5_R", "Manage Open, Log Day", clrWhite, x2, yStart + yGap*4);
DrawLabel("FriRisk_L6_L", "[-] DENIED", clrRed, x1, yStart + yGap*5);
DrawLabel("FriRisk_L6_R", "Revenge Size, Ext.", clrWhite, x2, yStart + yGap*5);
DrawLabel("FriRisk_L7_L", "RATIONALE", clrGray, x1, yStart + yGap*6);
DrawLabel("FriRisk_L7_R", InpWeekStatus == STATUS_GREEN ? "Protect Week" : "Stop Digging", clrWhite, x2, yStart + yGap*6);
}
}
void DrawBackground(int currentState) {
if(currentState == 0) { ObjectDelete(0, "FriRisk_BG"); return; }
datetime now = TimeCurrent();
MqlDateTime dt; TimeToStruct(now, dt);
dt.hour = 0; dt.min = 0; dt.sec = 0;
datetime startOfDay = StructToTime(dt);
datetime eod = startOfDay + 86400; // Midnight
if(ObjectFind(0, "FriRisk_BG") < 0) {
ObjectCreate(0, "FriRisk_BG", OBJ_RECTANGLE, 0, now, 0, eod, 0);
ObjectSetInteger(0, "FriRisk_BG", OBJPROP_BACK, true);
ObjectSetInteger(0, "FriRisk_BG", OBJPROP_FILL, true);
}
ObjectSetInteger(0, "FriRisk_BG", OBJPROP_TIME1, now - 3600); // Stretch slightly left
ObjectSetInteger(0, "FriRisk_BG", OBJPROP_TIME2, eod);
ObjectSetDouble(0, "FriRisk_BG", OBJPROP_PRICE1, ChartGetDouble(0, CHART_PRICE_MAX));
ObjectSetDouble(0, "FriRisk_BG", OBJPROP_PRICE2, ChartGetDouble(0, CHART_PRICE_MIN));
ObjectSetInteger(0, "FriRisk_BG", OBJPROP_COLOR, currentState == 2 ? ColorLocked : ColorWarning);
}Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.
Re: Friday flat-by rule: my cut-off clock and why I keep it rigid
2. MetaTrader 5 (MQL5) Code
How to install:
1.) Open MT5 > Press F4 to open MetaEditor.
2.) In the Navigator, right-click Indicators > New Indicator. Name it FridayRiskManager.
3.) Delete all default code, paste the code below, and click Compile.
How to install:
1.) Open MT5 > Press F4 to open MetaEditor.
2.) In the Navigator, right-click Indicators > New Indicator. Name it FridayRiskManager.
3.) Delete all default code, paste the code below, and click Compile.
Code: Select all
//+------------------------------------------------------------------+
//| FridayRiskManager.mq5 |
//| Enterprise Friday Risk Protocol |
//+------------------------------------------------------------------+
#property copyright "Risk Desk Protocol"
#property indicator_chart_window
#property indicator_plots 0
enum ENUM_WEEK_STATUS {
STATUS_NEUTRAL=0, // Neutral
STATUS_GREEN=1, // Green (Protect)
STATUS_RED=2 // Red (Stop Digging)
};
input group "--- Risk Desk Parameters ---"
input ENUM_WEEK_STATUS InpWeekStatus = STATUS_NEUTRAL; // Current Week Status
input group "--- Cut-offs (BROKER TIME) ---"
input int InpCutoffHour_FX = 17; // FX Cut-off Hour
input int InpCutoffMin_FX = 30; // FX Cut-off Minute
input int InpCutoffHour_XAU = 17; // XAU Cut-off Hour
input int InpCutoffMin_XAU = 0; // XAU Cut-off Minute
input int InpWarningMins = 30; // Wind-down Window (Mins)
input group "--- Visuals ---"
input color ColorWarning = clrDarkOrange; // Warning Color
input color ColorLocked = clrFireBrick; // Locked Color
bool isMetals;
int baseHour, baseMin, protectFactor;
int state = 0;
int OnInit() {
EventSetTimer(1);
string sym = Symbol();
isMetals = (StringFind(sym, "XAU") >= 0 || StringFind(sym, "GOLD") >= 0);
long calcMode = SymbolInfoInteger(sym, SYMBOL_TRADE_CALC_MODE);
if(calcMode == SYMBOL_CALC_MODE_FOREX_NO_LEVERAGE) isMetals = false; // Fallback check
baseHour = isMetals ? InpCutoffHour_XAU : InpCutoffHour_FX;
baseMin = isMetals ? InpCutoffMin_XAU : InpCutoffMin_FX;
protectFactor = (InpWeekStatus == STATUS_GREEN) ? 15 : 0;
return(INIT_SUCCEEDED);
}
void OnDeinit(const int reason) {
EventKillTimer();
ObjectsDeleteAll(0, "FriRisk_");
ChartRedraw();
}
int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) {
return(rates_total);
}
void OnTimer() {
datetime now = TimeCurrent();
MqlDateTime dt;
TimeToStruct(now, dt);
if(dt.day_of_week != 5) {
ObjectsDeleteAll(0, "FriRisk_");
ChartRedraw();
return;
}
int currMins = (dt.hour * 60) + dt.min;
int cutoffMins = (baseHour * 60) + baseMin - protectFactor;
int minsRemaining = cutoffMins - currMins;
int prevState = state;
if(currMins >= cutoffMins) state = 2;
else if(minsRemaining <= InpWarningMins && minsRemaining > 0) state = 1;
else state = 0;
if(state == 1 && prevState == 0) Alert("Friday Risk: " + IntegerToString(InpWarningMins) + " mins to hard cut-off. Manage open positions.");
if(state == 2 && prevState == 1) {
Alert("HARD CUT-OFF REACHED. No new risk allowed.");
PlaySound("timeout.wav");
}
DrawHUD(state, minsRemaining, cutoffMins);
DrawBackground(state);
ChartRedraw();
}
void DrawLabel(string name, string text, color clr, int x, int y) {
if(ObjectFind(0, name) < 0) {
ObjectCreate(0, name, OBJ_LABEL, 0, 0, 0);
ObjectSetInteger(0, name, OBJPROP_CORNER, CORNER_RIGHT_UPPER);
ObjectSetInteger(0, name, OBJPROP_BACK, false);
ObjectSetString(0, name, OBJPROP_FONT, "Arial");
ObjectSetInteger(0, name, OBJPROP_FONTSIZE, 9);
}
ObjectSetString(0, name, OBJPROP_TEXT, text);
ObjectSetInteger(0, name, OBJPROP_COLOR, clr);
ObjectSetInteger(0, name, OBJPROP_XDISTANCE, x);
ObjectSetInteger(0, name, OBJPROP_YDISTANCE, y);
}
void DrawHUD(int currentState, int minsLeft, int cutoff) {
int x1 = 150, x2 = 10, yStart = 20, yGap = 15;
string assetTxt = isMetals ? "METALS (XAU)" : "FX MAJOR";
string timeTxt = IntegerToString(cutoff / 60, 2, '0') + ":" + IntegerToString(cutoff % 60, 2, '0') + " BRK";
string statusTxt = currentState == 2 ? "LOCKED" : (currentState == 1 ? "WINDING DOWN" : "ACTIVE");
color statusClr = currentState == 2 ? clrRed : (currentState == 1 ? clrOrange : clrLimeGreen);
DrawLabel("FriRisk_L1_L", "ASSET PROFILE", clrGray, x1, yStart);
DrawLabel("FriRisk_L1_R", assetTxt, clrWhite, x2, yStart);
DrawLabel("FriRisk_L2_L", "DESK CUT-OFF", clrGray, x1, yStart + yGap);
DrawLabel("FriRisk_L2_R", timeTxt, clrWhite, x2, yStart + yGap);
DrawLabel("FriRisk_L3_L", "STATUS", clrGray, x1, yStart + yGap*2);
DrawLabel("FriRisk_L3_R", statusTxt, statusClr, x2, yStart + yGap*2);
if(currentState < 2) {
DrawLabel("FriRisk_L4_L", "TIME REMAINING", clrGray, x1, yStart + yGap*3);
DrawLabel("FriRisk_L4_R", IntegerToString(minsLeft) + " MIN", statusClr, x2, yStart + yGap*3);
string weekTxt = (InpWeekStatus == STATUS_GREEN) ? "Green (Protect)" : ((InpWeekStatus == STATUS_RED) ? "Red (Stop Dig)" : "Neutral");
DrawLabel("FriRisk_L5_L", "WEEK CONTEXT", clrGray, x1, yStart + yGap*4);
DrawLabel("FriRisk_L5_R", weekTxt, clrWhite, x2, yStart + yGap*4);
ObjectDelete(0, "FriRisk_L6_L"); ObjectDelete(0, "FriRisk_L6_R");
ObjectDelete(0, "FriRisk_L7_L"); ObjectDelete(0, "FriRisk_L7_R");
} else {
DrawLabel("FriRisk_L4_L", "PROTOCOL", clrRed, x1, yStart + yGap*3);
DrawLabel("FriRisk_L4_R", "HARD BLACKOUT", clrRed, x2, yStart + yGap*3);
DrawLabel("FriRisk_L5_L", "[+] ALLOWED", clrLimeGreen, x1, yStart + yGap*4);
DrawLabel("FriRisk_L5_R", "Manage Open, Log Day", clrWhite, x2, yStart + yGap*4);
DrawLabel("FriRisk_L6_L", "[-] DENIED", clrRed, x1, yStart + yGap*5);
DrawLabel("FriRisk_L6_R", "Revenge Size, Ext.", clrWhite, x2, yStart + yGap*5);
DrawLabel("FriRisk_L7_L", "RATIONALE", clrGray, x1, yStart + yGap*6);
DrawLabel("FriRisk_L7_R", InpWeekStatus == STATUS_GREEN ? "Protect Week" : "Stop Digging", clrWhite, x2, yStart + yGap*6);
}
}
void DrawBackground(int currentState) {
if(currentState == 0) { ObjectDelete(0, "FriRisk_BG"); return; }
datetime now = TimeCurrent();
MqlDateTime dt; TimeToStruct(now, dt);
dt.hour = 0; dt.min = 0; dt.sec = 0;
datetime startOfDay = StructToTime(dt);
datetime eod = startOfDay + 86400;
if(ObjectFind(0, "FriRisk_BG") < 0) {
ObjectCreate(0, "FriRisk_BG", OBJ_RECTANGLE, 0, now, 0, eod, 0);
ObjectSetInteger(0, "FriRisk_BG", OBJPROP_BACK, true);
ObjectSetInteger(0, "FriRisk_BG", OBJPROP_FILL, true);
}
ObjectSetInteger(0, "FriRisk_BG", OBJPROP_TIME1, now - 3600);
ObjectSetInteger(0, "FriRisk_BG", OBJPROP_TIME2, eod);
ObjectSetDouble(0, "FriRisk_BG", OBJPROP_PRICE1, ChartGetDouble(0, CHART_PRICE_MAX));
ObjectSetDouble(0, "FriRisk_BG", OBJPROP_PRICE2, ChartGetDouble(0, CHART_PRICE_MIN));
ObjectSetInteger(0, "FriRisk_BG", OBJPROP_COLOR, currentState == 2 ? ColorLocked : ColorWarning);
}Preserve your own money. Scale with the market's money. Exponential growth is the ultimate key.