Discipline Guard [CrestAlgo]Discipline Guard
🔍 What This Indicator Does
Every trader has sessions they should avoid. The post-lunch chop. The pre-market noise. The late-night revenge trade window. You know these windows exist because your journal proves it. The problem is remembering in the moment.
Discipline Guard is a behavioral guardrail that visually obscures the chart during user-defined time windows where you have identified that you tend to underperform. It serves as a pattern-interrupt: a deliberate visual barrier between you and a trade you should not be taking.
This is not a signal indicator. It does not tell you what to trade. It tells you when to stop.
🛑 How It Works — The Four Stages
The indicator uses a progressive warning system so you are never caught off guard mid-position:
Stage 1 — Early Warning (15 minutes before window)
A subtle amber tint appears on the chart background. This is your cue to begin winding down any open positions and stop scanning for new setups.
Stage 2 — Approaching (5 minutes before window)
The amber tint deepens and a warning label appears above the current bar showing the window name. Final warning before the blackout begins.
Stage 3 — Active Block (during the window)
The chart is covered with a configurable-opacity dark overlay and a centered message. The default reads "NO-TRADE ZONE — SCHEDULED PAUSE" but you can customize it to anything. This is the core of the indicator — making it psychologically harder to enter a trade during your known bad window.
Stage 4 — Recovery (5 minutes after window ends)
The overlay fades gradually back to a clean chart. This gives you a moment to recalibrate before re-engaging.
The progressive ramp can be toggled off if you prefer an instant blackout with no lead-in.
🌍 Per-Window Timezone Support
Each window has its own timezone selector with 14 options covering all major trading sessions:
America/New_York (default), America/Chicago, America/Los_Angeles, Europe/London, Europe/Amsterdam, Europe/Frankfurt, Asia/Tokyo, Asia/Hong_Kong, Asia/Singapore, Asia/Shanghai, Asia/Dubai, Australia/Sydney, UTC, and Chart (uses the symbol's exchange timezone).
This means you can configure one window for the NY lunch chop in Eastern time and another for the London close in GMT on the same chart. Each window resolves its own day-of-week and time-of-day independently.
⚙️ Configuration
Up to 5 independent no-trade windows can be configured. Each window has:
Enable/Disable toggle
Custom label (e.g., "Post-Lunch Slump", "Pre-FOMC", "Revenge Trade Zone")
Timezone selector (14 options)
Day-of-week checkboxes (Mon through Sun)
Start and end time in 24-hour HHMM-HHMM format
Visual settings (global):
Blackout color (default: near-black #0A0A0A)
Blackout opacity (40-95%, default 70%)
Warning tint color (default: amber)
Warning symbol (🛑 🚫 ⛔ ❌ 🔒 ⚠️)
Custom blackout message text
Message font size (Small / Medium / Large / Huge)
Progressive ramp toggle (on/off)
Historical display:
Show Historical Windows toggle (off by default — keeps your chart clean)
Realtime Range (how many bars back from current to shade, default 48)
🔔 Alerts
Two alert conditions are available:
Window approaching (fires when Stage 2 begins, 5 minutes before the blackout)
Window active (fires when Stage 3 begins)
To set an alert: right-click the indicator name on your chart → "Add alert on Discipline Guard."
🕐 Timeframe Compatibility
This indicator works on all timeframes and all markets (futures, stocks, forex, crypto, commodities, indices).
For the full four-stage progressive warning to render correctly, use on timeframes of 15 minutes or less. On higher timeframes (1H, 4H, Daily), the warning stages may collapse onto a single bar since each bar spans more time than the 15-minute lead-in window. The blackout itself works correctly on all timeframes.
Practical guidance:
1m to 5m: Full progressive ramp renders smoothly. Ideal for day traders and scalpers.
15m: Warning stages may render on only 1 bar each. Still functional.
1H and above: Use with progressive ramp disabled (instant blackout mode). The blackout still activates at the correct time.
📐 Default Configuration
Window 1 is enabled out of the box:
Label: "NY Post-Lunch Slump"
Timezone: America/New_York
Time: 13:00 – 13:30 ET
Days: Monday through Friday
This targets the well-known low-volume, choppy lunch period in US equity index futures trading. Adjust or disable it to match your own trading journal findings.
Windows 2-5 are pre-configured with common session labels (NY Pre-Open, London Lunch, Tokyo Fix, Custom) but disabled by default. Enable and adjust them to fit your own discipline rules.
⚠️ Limitations
This indicator enforces time-based discipline rules. It does not analyze price action, volume, or any market data beyond the current bar's timestamp.
The timing logic is derived from bar timestamps, not a separate wall clock. On inactive symbols where bars do not print continuously, the warning stages may not appear if no bar falls within the warning window.
Windows that cross midnight in their configured timezone (e.g., 23:30 to 00:30) require both days to be enabled in the day-of-week settings. Each day is evaluated independently.
The blackout is a visual overlay only. It does not prevent order execution or interact with your broker in any way. You can still place trades during a blackout if you choose to. The decision is always yours.
⚖️ Disclaimer
This indicator is a behavioral visualization tool for educational and informational purposes only. It does not constitute financial, investment, or trading advice. It does not generate trade signals, recommendations, or any form of market analysis.
No representation is made that using this tool will improve trading performance, reduce losses, or produce any specific result. Trading discipline is a personal responsibility. This tool provides a visual reminder; it does not guarantee behavioral change.
Trading futures, options, and other financial instruments involves substantial risk of loss and is not appropriate for all investors. Past performance is not indicative of future results.
Penunjuk Pine Script®






















