Loading…

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

SettingDefaultWhat it does
Htf timeframePERIOD_H4Higher timeframe to outline
Candle count30How many HTF candles back (max)
Bull colorclrDodgerBlueUp-candle outline colour
Bear colorclrOrangeRedDown-candle outline colour
Line width2Outline width (1-5)
Show wickstrueDraw high/low wick segments
Object prefixHTFCO_Prefix for objects this script draws

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the script onto a chart to run it once.

Download the PDF guide

Tags: Multi-Timeframe (MTF) · Alerts · MT5 Script · MQL5 Source Code

MQL4 & MQL5 scripts · PolyMaria