PROTECTED SOURCE SCRIPT
Madblock

User Instructions for the "Madblock" Indicator (Pine Script v6 – TradingView)
This script creates a daily "Madblock" zone based on the high and low of the 15:30–15:45 NY time period (previous day’s final 15 minutes of regular trading hours for US equities/indices). It then generates optional entry signals the following trading day when price breaks this zone while respecting additional filters (EMAs, time window, signal spacing, and daily limit).
1. How to Add the Script to Your Chart
1. Open TradingView (tradingview.com).
2. Open any chart (preferably ES, NQ, SPX, SPY, or another instrument with US trading hours).
3. Click Pine Editor at the bottom.
4. Delete any existing code and paste the entire script provided.
5. Click Add to Chart (or Save → Add to Chart).
6. The indicator will appear as “Madblock”.
2. Input Settings (customizable in the indicator’s settings panel)
| Input | Default | Description |
|-----------------------|---------|-------------------------------------------------------------------------------------------------|
| Show Madblock Boxes | true | Displays the purple Madblock zones on the chart. Uncheck to hide boxes but keep signals. |
| Box Color | Purple | Color of the Madblock rectangle and background. |
| Transparency | 80 | Background transparency of the box (0 = opaque, 100 = fully transparent). |
| Enable Madblock Signals | true | Turns the long/short entry signals on or off. |
| Show 50 EMA (15m & 30m) | true | Displays the 50-period EMA from the 15-minute and 30-minute timeframes (yellow & orange lines). |
3. What the Indicator Does – Core Functionality
**A. Madblock Zone Creation (Previous Day)**
- Every day at 15:30 NY time → a new box is started using the high/low of that 15:30 candle.
- At 15:45 NY time → the box is finalized by taking the maximum high and minimum low of both the 15:30 and 15:45 candles.
- The box is drawn from 15:30 that day until 17:00 the next trading day (skips weekend automatically).
- This finalized zone becomes the reference levels for the next trading day’s signals.
**B. Signal Generation (Current Trading Day)**
Signals can only appear between 09:45 and 15:59 NY time (no signals in the first 15 minutes after 09:30 open).
Long Signal (green triangle below bar, text “MB”)
- Price closes above yesterday’s Madblock high
- Price is above both the 15-min 50 EMA and 30-min 50 EMA
- At least 4 bars have passed since the previous signal
- Maximum 3 signals per day (long + short combined)
Short Signal (orange triangle above bar, text “MB”)
- Price closes below yesterday’s Madblock low
- Price is below both the 15-min 50 EMA and 30-min 50 EMA
- Same spacing and daily limit rules as long signals
4. Recommended Chart Settings
- Timeframe: 15-minute charts work best.
- Session: Use “Extended Hours” turned OFF (regular trading hours only) for most accurate appearance.
- Time zone: Ensure your chart is set to New York time (or Exchange time for US instruments).
5. Important Notes & Limitations
- The script requires at least two full trading days of history to display boxes and generate signals correctly.
- On Mondays the box is created from the previous Friday’s 15:30–15:45 period.
- Boxes are capped at 500 (TradingView limit); old boxes automatically disappear as new ones are created.
- Signals are purely mechanical and for educational/informational purposes only. No guarantee of profitability.
6. Quick Checklist for Daily Use
1. Confirm chart time zone is America/New_York.
2. Verify yesterday’s purple Madblock zone is visible (15:30–17:00 stretch).
3. Look for “MB” triangles only after 09:45 and before 16:00.
4. Maximum of three signals (combined long + short) per session.
That is all you need to start using the Madblock indicator effectively. Adjust the input settings to match your preferred visual style or to disable elements you do not need.
This script creates a daily "Madblock" zone based on the high and low of the 15:30–15:45 NY time period (previous day’s final 15 minutes of regular trading hours for US equities/indices). It then generates optional entry signals the following trading day when price breaks this zone while respecting additional filters (EMAs, time window, signal spacing, and daily limit).
1. How to Add the Script to Your Chart
1. Open TradingView (tradingview.com).
2. Open any chart (preferably ES, NQ, SPX, SPY, or another instrument with US trading hours).
3. Click Pine Editor at the bottom.
4. Delete any existing code and paste the entire script provided.
5. Click Add to Chart (or Save → Add to Chart).
6. The indicator will appear as “Madblock”.
2. Input Settings (customizable in the indicator’s settings panel)
| Input | Default | Description |
|-----------------------|---------|-------------------------------------------------------------------------------------------------|
| Show Madblock Boxes | true | Displays the purple Madblock zones on the chart. Uncheck to hide boxes but keep signals. |
| Box Color | Purple | Color of the Madblock rectangle and background. |
| Transparency | 80 | Background transparency of the box (0 = opaque, 100 = fully transparent). |
| Enable Madblock Signals | true | Turns the long/short entry signals on or off. |
| Show 50 EMA (15m & 30m) | true | Displays the 50-period EMA from the 15-minute and 30-minute timeframes (yellow & orange lines). |
3. What the Indicator Does – Core Functionality
**A. Madblock Zone Creation (Previous Day)**
- Every day at 15:30 NY time → a new box is started using the high/low of that 15:30 candle.
- At 15:45 NY time → the box is finalized by taking the maximum high and minimum low of both the 15:30 and 15:45 candles.
- The box is drawn from 15:30 that day until 17:00 the next trading day (skips weekend automatically).
- This finalized zone becomes the reference levels for the next trading day’s signals.
**B. Signal Generation (Current Trading Day)**
Signals can only appear between 09:45 and 15:59 NY time (no signals in the first 15 minutes after 09:30 open).
Long Signal (green triangle below bar, text “MB”)
- Price closes above yesterday’s Madblock high
- Price is above both the 15-min 50 EMA and 30-min 50 EMA
- At least 4 bars have passed since the previous signal
- Maximum 3 signals per day (long + short combined)
Short Signal (orange triangle above bar, text “MB”)
- Price closes below yesterday’s Madblock low
- Price is below both the 15-min 50 EMA and 30-min 50 EMA
- Same spacing and daily limit rules as long signals
4. Recommended Chart Settings
- Timeframe: 15-minute charts work best.
- Session: Use “Extended Hours” turned OFF (regular trading hours only) for most accurate appearance.
- Time zone: Ensure your chart is set to New York time (or Exchange time for US instruments).
5. Important Notes & Limitations
- The script requires at least two full trading days of history to display boxes and generate signals correctly.
- On Mondays the box is created from the previous Friday’s 15:30–15:45 period.
- Boxes are capped at 500 (TradingView limit); old boxes automatically disappear as new ones are created.
- Signals are purely mechanical and for educational/informational purposes only. No guarantee of profitability.
6. Quick Checklist for Daily Use
1. Confirm chart time zone is America/New_York.
2. Verify yesterday’s purple Madblock zone is visible (15:30–17:00 stretch).
3. Look for “MB” triangles only after 09:45 and before 16:00.
4. Maximum of three signals (combined long + short) per session.
That is all you need to start using the Madblock indicator effectively. Adjust the input settings to match your preferred visual style or to disable elements you do not need.
نص برمجي محمي
تم نشر هذا النص البرمجي كمصدر مغلق. However, you can use it freely and without any limitations – learn more here.
إخلاء المسؤولية
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
نص برمجي محمي
تم نشر هذا النص البرمجي كمصدر مغلق. However, you can use it freely and without any limitations – learn more here.
إخلاء المسؤولية
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.