Aklamavo ICT KillZones
- Indicatori
- Sylvester Aklamavo
- Versione: 1.0
This MetaTrader 5 indicator plots ICT Killzone session markers on the chart using vertical lines. It draws the start and end times for three institutional trading sessions—Asian, London, and New York—for a user-defined number of recent historical days.
No buffers or plots are used; instead, the indicator relies entirely on chart objects (OBJ_VLINE).
The indicator allows full customization of each killzone segment:
General
-
DaysToDisplay : number of past days to draw killzones for.
Asian Killzone Parameters
-
AsianStartHour , AsianEndHour
-
AsianColor , AsianWidth
London Killzone Parameters
-
LondonStartHour , LondonEndHour
-
LondonColor , LondonWidth
New York Killzone Parameters
-
NYStartHour , NYEndHour
-
NYColor , NYWidth
These inputs determine:
-
Where vertical lines are positioned.
-
Their color coding.
-
Their thickness on the chart.
2.1 GetSessionTime()
This function converts a date at midnight into a precise timestamp for a given session hour.
Steps:
-
Convert the day’s datetime to an MqlDateTime struct.
-
Replace hour/minute/seconds with the session parameters.
-
Convert back to a datetime.
This is how session start/end timestamps are computed reliably.
2.2 DrawLine()
Creates or updates a vertical line object on the chart.
-
Uses ObjectCreate() only if the object does not already exist.
-
Sets:
-
Color ( OBJPROP_COLOR )
-
Style ( STYLE_SOLID )
-
Width ( OBJPROP_WIDTH )
-
Background and Ray properties (disabled).
-
The line is always redrawn at the given timestamp.
3. Drawing Killzones3.1 DrawKillzonesForDay()
This function draws six vertical lines per day:
| Killzone | Line 1 | Line 2 |
|---|---|---|
| Asian | Start | End |
| London | Start | End |
| New York | Start | End |
It uses:
-
GetSessionTime() → computes timestamps
-
DrawLine() → draws each vertical line
-
Unique object names → include the day index i
Example:
-
KZ_Asian_Start_0
-
KZ_London_End_2
-
KZ_NY_Start_4
This ensures no name collisions.
4. Indicator Initialization (OnInit)Actions performed:
-
Deletes all existing vertical line objects to avoid duplicates.
-
Determines today's midnight timestamp.
-
Loops DaysToDisplay times:
-
For each previous day, calculates day_start = today_start - i*86400 .
-
Calls DrawKillzonesForDay(day_start, i) .
-
Finally, ChartRedraw() is called to refresh the drawing immediately.
5. Runtime Calculation ( OnCalculate )The indicator does not need to compute anything per tick or per candle, because all work is done in OnInit() . Therefore:
This makes the indicator very lightweight and CPU-efficient.
