Draw Daily Weekly Monthly Opens
The daily, weekly and monthly open are the reference prices most intraday traders check first - where is price relative to where the day, the week and the month started. Reading them off the higher timeframes by hand means switching charts three times before every session. This script pulls all three onto whatever chart it is run on, at any timeframe, using iOpen() against D1, W1 and MN1. Each level is drawn as a ray, not a full horizontal line, starting from the exact moment the period opened rather than stretching back through history. That matters for the monthly line in particular - a full-width line would cut through four or five weeks of earlier price action that the current month's open had nothing to do with. A ray that starts where the period actually began keeps the chart honest about when the level came into existence. The other decision is what happens when history is not ready. iOpen() on a timeframe the terminal has not finished downloading returns exactly 0.0, and a naive script draws a line at the bottom of the chart and calls it a day. This one checks for that and refuses the individual level instead - it is common on a freshly opened MN1 or W1 series on a chart that was never scrolled back far enough to trigger the download. The other two levels are still drawn; only the one that is missing data is skipped, and the log says which. Notes and limitations - A level that is unavailable stays unavailable until its timeframe's history has loaded - re-running the script does not force a download, it only re-checks what is already there. - The weekly open follows the platform's own definition of where a trading week starts, which can differ slightly by broker around a Sunday session. - Lines are not updated tick by tick after being drawn - if the day, week or month rolls over while the chart is open, run the script again to move the rays to the new period's open. - This draws reference levels only; it does not alert on price crossing them.
Script · MT5 · v1.0 · Free
About Draw Daily Weekly Monthly Opens
Draw Daily Weekly Monthly Opens is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 5 settings, such as Color daily, Color weekly and Color monthly. MQL source code included.
Files in the download: DrawPeriodOpens.ex5, DrawPeriodOpens.mq5, DrawPeriodOpens.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Color daily | clrDodgerBlue | Colour for the daily open |
| Color weekly | clrOrange | Colour for the weekly open |
| Color monthly | clrMagenta | Colour for the monthly open |
| Label font size | 8 | Label font size |
| Cleanup first | true | Delete this script's previous lines first |
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: Trading Sessions · Alerts · MT5 Script · MQL5 Source Code