Loading…

Opening Range Level Drawer

An opening range strategy needs the range drawn correctly before anything else about it can be judged. This script marks the high and low of a chosen window, in GMT so it means the same thing on every broker's server clock, for as many recent days as you ask for, and extends each level forward so a breakout is easy to see forming. The window is read straight from the bars already loaded on the chart the script is run on, not from a separate minute-data fetch. That keeps it fast and dependency-free, but it also means the resolution of the range is whatever timeframe the chart is showing. A 30-minute opening range read off an H1 chart is really "the H1 bar nearest the open", not a genuine 30-minute high and low - put the script on M5 or lower when the window is narrow. Optional extension targets are projected above the high and below the low at chosen multiples of the range itself (1x and 1.618x by default), the same "measured move" logic many opening-range breakout traders already use by hand, drawn automatically for every day in the lookback instead of one at a time. Notes and limitations - Resolution matches the chart's own timeframe, not the window width - see the full description above. - A day with no bars inside the window (weekend, holiday, or a window older than the loaded history) is silently skipped and counted in the summary rather than drawn with a false zero range. - The broker-to-GMT offset is read once per run by comparing TimeGMT() with TimeCurrent(). It is a snapshot of the current clock difference, not tracked across the lookback, so a wall can drift by an hour around a daylight-saving change on either side. - This is a drawing aid only - it does not detect a breakout, generate a signal, or place any order.

Script · MT4 · v1.0 · Free

About Opening Range Level Drawer

Opening Range Level Drawer is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 11 settings, such as Window start gmt, Window minutes and Days back. MQL source code included.

Files in the download: OpeningRangeLevelDrawer.ex4, OpeningRangeLevelDrawer.mq4, OpeningRangeLevelDrawer.txt.

Settings

SettingDefaultWhat it does
Window start gmt8Window open, GMT hour (0-23) - e.g. 8 for London
Window minutes30Width of the opening window, minutes
Days back10How many days back to mark
Extend hours6Hours the OR lines / targets are drawn forward
Show extensionstrueDraw breakout extension targets
Extension multiple11.0First extension, multiples of the OR range
Extension multiple21.618Second extension, multiples of the OR range
Show labelstrueDraw price labels on each line
High colorclrDodgerBlueOpening range high colour
Low colorclrOrangeRedOpening range low colour
Extension colorclrGoldenrodExtension target colour

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 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: Breakout · Trading Sessions · Alerts · MT4 Script · MQL4 Source Code

MQL4 & MQL5 scripts · PolyMaria