Custom Session Boxes With Statistics
Fixed named sessions (Asian/London/New York) do not cover every use case - a trader watching a specific overlap window, a broker's own dealing session, or a personal trading-hours block needs a session box with times they set themselves, not a preset. This indicator draws exactly one session, with a start and end hour entered directly as inputs, shaded as a growing rectangle for each day it appears - the same overnight-wrap handling (a start hour later than the end hour anchors to the day the session started, not the day it ends) as the fixed-session version already in this catalogue. What this adds is the statistics a trader actually wants while a session is still forming. Every completed session's high-low range is banked into a rolling history, and the panel shows the average of the most recent InpAverageDays completed sessions - the session's "typical" range. While today's session is live, the panel shows today's range so far as a raw number and as a percentage of that average, so "is this session already bigger than usual" is answered at a glance rather than by eyeballing box heights. It also reads today's session open against the latest close to report whether the session has broken up, down, or is still flat. Completed-session ranges are recorded only once a bar's time has passed that session's own end hour, so a still-forming session is never prematurely banked into the average with an artificially small range. Notes and limitations - The average-range statistic starts empty on a freshly attached chart and fills in as sessions complete during the loaded history and afterward - it is not a lifetime average, only of the most recent InpAverageDays completed sessions actually seen. - Session hours are broker server time exactly as the chart's own bar timestamps use it; there is no timezone conversion to the trader's local time or to a named zone such as GMT or EST. - The "broke up/down" reading compares the session's own opening price to the latest close; it says nothing about whether that move held, reversed intraday, or how far it travelled beyond that first read. - A session box's height reflects the high/low of bars on the chart's current timeframe; the same session viewed on a much higher timeframe can show a visibly different range because fewer, coarser bars are being measured. - Purely a visual/statistical overlay - no alerts or trade signals.
Indicator · MT4 · v1.0 · Free
About Custom Session Boxes With Statistics
Custom Session Boxes With Statistics is an indicator for MetaTrader 4. It has 11 settings, such as Session name, Start hour and End hour. MQL source code included.
Files in the download: CustomSessionBoxes.ex4, CustomSessionBoxes.mq4, CustomSessionBoxes.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Session name | Custom | Label used on the panel and box tags |
| Start hour | 8 | Session start hour (broker/server time, 0-23) |
| End hour | 16 | Session end hour (broker/server time, 0-23) |
| Box color | clrLightSteelBlue | Session box fill colour |
| Days back | 20 | Calendar days of boxes kept drawn |
| Average days | 10 | Completed sessions averaged for the "typical range" statistic |
| Panel corner | CORNER_LEFT_UPPER | Panel corner: 0=LU 1=RU 2=LL 3=RL |
| Panel x | 10 | Panel horizontal offset in pixels |
| Panel y | 20 | Panel vertical offset in pixels |
| Panel text color | clrWhite | Panel text colour |
| Panel font size | 9 | Panel font size |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the indicator from the Navigator onto a chart and adjust the settings.
Tags: Trading Sessions · MT4 Indicator · MQL4 Source Code