forked from AyandaTRL/Indicators
# ICT Macros (MetaTrader 5)
| |
| |
`ICTMacros.mq5` is a MetaTrader 5 chart indicator that draws **ICT macro windows**
| |
for the **Asia**, **London** and **New York** sessions directly on the price chart.
| |
| |
Each macro window is drawn as a rectangle covering the high/low range of the bars
| |
inside the window, with an optional 50% midline, start/end vertical lines and a
| |
text label. Everything is a normal chart object, so the zones stay on the chart,
| |
can be styled by the indicator inputs, and are removed automatically when the
| |
indicator is deleted.
| |
| |
The indicator is a **visualisation tool only**: it draws no signals, exposes no
| |
buffers, and never places or manages trades.
| |
| |
---
| |
| |
## Files
| |
| |
| File | Description |
| |
| --- | --- |
| |
| `ICTMacros/ICTMacros.mq5` | Indicator source code (MQL5, MetaTrader 5 build 3400+). |
| |
| `ICTMacros/README.md` | This document. |
| |
| |
The compiled `ICTMacros.ex5` is build output and is intentionally not committed (see `.gitignore`).
| |
| |
---
| |
| |
## What is an ICT macro window?
| |
| |
ICT macro windows are short time slices inside a trading session where
| |
institutional order flow is often expected (for example the London open macro,
| |
or the New York AM session macros). This indicator converts the windows from
| |
**New York local time** into broker server time and highlights them per day.
| |
| |
Default windows (New York local time):
| |
| |
| Session | Default windows |
| |
| --- | --- |
| |
| London | `02:33-03:00;04:03-04:30` |
| |
| New York | `08:50-09:10;09:50-10:10;10:50-11:10;11:50-12:10;13:10-13:40;15:15-15:45` |
| |
| Asia | *(empty by default)* |
| |
| |
The Asia list is empty on purpose: paste your own Asia windows into
| |
`InpAsiaMacros` and the Asia toggle starts working immediately.
| |
| |
---
| |
| |
## Installation
| |
| |
1. Copy `ICTMacros/ICTMacros.mq5` into `MQL5/Indicators/` of your MetaTrader 5 data folder
| |
(MetaEditor: **File → Open Data Folder**).
| |
2. Compile it in MetaEditor (**F7**), or copy a prebuilt `ICTMacros.ex5`.
| |
3. In MetaTrader 5 open **Navigator → Indicators → ICTMacros** and attach it to a
| |
chart (M1 to M15 is recommended).
| |
| |
No DLLs, no external files and no network access are used.
| |
| |
---
| |
| |
## Inputs
| |
| |
### Sessions
| |
| Input | Default | Description |
| |
| --- | --- | --- |
| |
| `InpShowAsia` | `true` | Draw Asia macros. |
| |
| `InpShowLondon` | `true` | Draw London macros. |
| |
| `InpShowNewYork` | `true` | Draw New York macros. |
| |
| |
### Macro windows (New York local time, format `HH:MM-HH:MM;...`)
| |
| Input | Default | Description |
| |
| --- | --- | --- |
| |
| `InpAsiaMacros` | *(empty)* | Asia window list. |
| |
| `InpLondonMacros` | `02:33-03:00;04:03-04:30` | London window list. |
| |
| `InpNYMacros` | `08:50-09:10;09:50-10:10;10:50-11:10;11:50-12:10;13:10-13:40;15:15-15:45` | New York window list. |
| |
| |
A window whose end time is not later than its start time is treated as
| |
**crossing midnight** (for example `23:30-00:15`).
| |
| |
### Time base
| |
| Input | Default | Description |
| |
| --- | --- | --- |
| |
| `InpTimeBase` | `ICT_TB_NEWYORK` | Reference zone of the window lists: New York local, broker server, or GMT. |
| |
| `InpServerOffsetMode` | `ICT_SRV_AUTO` | Detect the broker server offset automatically, or use the manual value. |
| |
| `InpManualServerGmtOffset` | `0.0` | Server GMT offset in hours, used when the manual mode is selected. |
| |
| |
### Display
| |
| Input | Default | Description |
| |
| --- | --- | --- |
| |
| `InpDrawBox` | `true` | Draw the macro box. |
| |
| `InpFillBox` | `false` | Fill the box (opaque, drawn behind the bars). |
| |
| `InpMidline` | `false` | Draw the 50% midline of the window. |
| |
| `InpVerticalLines` | `true` | Draw vertical lines at window start and end. |
| |
| `InpShowLabels` | `true` | Draw the window label. |
| |
| `InpLabelFontSize` | `8` | Label font size. |
| |
| `InpAsiaColor` | `clrKhaki` | Asia colour. |
| |
| `InpLondonColor` | `clrSteelBlue` | London colour. |
| |
| `InpNewYorkColor` | `clrTomato` | New York colour. |
| |
| `InpLiveBox` | `true` | Refresh the window that is currently open. |
| |
| |
### History / limits
| |
| Input | Default | Description |
| |
| --- | --- | --- |
| |
| `InpHistoryDays` | `20` | Past days to draw (`0` = current day only, capped at 200). |
| |
| `InpMaxObjects` | `2000` | Safety cap on objects created per rebuild. |
| |
| `InpCleanStaleObjects` | `true` | Remove leftover `ICTMacros_` objects from former runs. |
| |
| |
### Diagnostics
| |
| Input | Default | Description |
| |
| --- | --- | --- |
| |
| `InpVerboseLog` | `true` | Print time base, offset and object diagnostics to the Experts log. |
| |
| |
---
| |
| |
## Time handling
| |
| |
* Chart bars are in **broker server time**; the configured windows are converted
| |
**New York local → UTC → server time**.
| |
* **US DST rules are implemented inside the indicator** (second Sunday of March
| |
→ first Sunday of November), so EST/EDT is handled without external data.
| |
* The server/UTC offset is auto-detected as
| |
`TimeTradeServer() - TimeGMT()` rounded to 5 minutes, or taken from
| |
`InpManualServerGmtOffset` when `ICT_SRV_MANUAL` is selected.
| |
* `TimeGMT()` depends on the accuracy of the local PC clock. If that clock is not
| |
reliable, switch `InpServerOffsetMode` to `ICT_SRV_MANUAL`.
| |
* The detected offset is re-checked on every new bar, so broker DST switches are
| |
picked up without reloading the indicator.
| |
| |
---
| |
| |
## Behaviour and object naming
| |
| |
* Object prefix: `ICTMacros_`. Names follow
| |
`ICTMacros_<Session>_<index>_<YYYYMMDD>` with `_mid`, `_S`, `_E` and `_L`
| |
suffixes for the midline, start line, end line and label.
| |
* Only objects created by this program are ever deleted; foreign objects are
| |
left untouched.
| |
* Boxes are rebuilt on `OnInit` and on every **new bar**; only the currently open
| |
window is refreshed intrabar (`InpLiveBox`), so closed windows never move.
| |
* A window is skipped when no bars exist for it (weekend, holiday, data gap), and
| |
a later window of the day appears once its first bar has formed.
| |
* The rectangle top/bottom are the high/low of the bars inside the window;
| |
`tEnd` is clamped to the window end.
| |
| |
---
| |
| |
## Limitations
| |
| |
* Chart objects only — there are no indicator buffers, so nothing is available to
| |
`iCustom()` or to an Expert Advisor.
| |
* MT5 chart objects have no alpha transparency: a filled box is opaque (it is
| |
drawn behind the bars). Outline-only is the default, and is the recommended
| |
setting on busy charts.
| |
* Best on M1–M15. On coarse timeframes a window can cover 0 or 1 bar, and the
| |
indicator logs a warning when the period is above 30 minutes.
| |
* The object count grows with `InpHistoryDays`; watch `InpMaxObjects` on long
| |
histories.
| |
* Window definitions are plain text inputs, so a typo silently drops only the
| |
malformed entry — check the Experts log (`InpVerboseLog = true` prints the
| |
parsed window count per session).
| |
| |
---
| |
| |
## Requirements
| |
| |
* MetaTrader 5 (MQL5), compiled with a recent MetaEditor build.
| |
* Any symbol and timeframe; no additional files required.
| |
| |
---
| |
| |
## Disclaimer
| |
| |
This indicator is provided for educational and analytical purposes. It draws
| |
time-based zones only, produces no trading signals, and does not trade. Nothing
| |
in this repository is financial advice, and past behaviour of any market window
| |
does not guarantee future results.
|