Higher Timeframe Candle Outliner
Reading H4 or Daily structure while trading on M15 usually means switching timeframes back and forth, or running a permanent multi timeframe indicator that recalculates on every tick. This script takes a simpler approach for traders who just want a visual reference: it draws a fixed number of higher timeframe candle outlines - one rectangle per body plus an optional wick - directly onto the current chart's time axis, then exits. Nothing keeps running afterwards. Each outline spans the exact time range the higher timeframe candle covers, computed from that timeframe's own open times rather than a fixed pixel width, so the outlines line up correctly regardless of which lower timeframe they are drawn over. Re-running the script first removes its own previously drawn objects, so switching symbol or timeframe and running it again does not leave stale outlines behind. Notes and limitations This is a one-shot script, not an indicator - it does not update as new higher timeframe candles form; rerun it to refresh. If the higher timeframe's history is not yet loaded for the requested candle count, fewer candles are drawn than requested rather than failing outright - scroll that timeframe into view once beforehand if this matters. Outlines are ordinary chart objects (OBJ_RECTANGLE/OBJ_TREND) and can be deleted like any other, or removed in bulk by rerunning with a smaller InpCandleCount after enabling "delete all objects" manually, since this script only ever deletes its own previous set, never a different prefix.
Script · MT5 · v1.0 · Free
About Higher Timeframe Candle Outliner
Higher Timeframe Candle Outliner is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 7 settings, such as Htf timeframe, Candle count and Bull color. MQL source code included.
Files in the download: HtfCandleOutliner.ex5, HtfCandleOutliner.mq5, HtfCandleOutliner.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Htf timeframe | PERIOD_H4 | Higher timeframe to outline |
| Candle count | 30 | How many HTF candles back (max) |
| Bull color | clrDodgerBlue | Up-candle outline colour |
| Bear color | clrOrangeRed | Down-candle outline colour |
| Line width | 2 | Outline width (1-5) |
| Show wicks | true | Draw high/low wick segments |
| Object prefix | HTFCO_ | Prefix for objects this script draws |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Multi-Timeframe (MTF) · Alerts · MT5 Script · MQL5 Source Code