Chart Notes Pinner
OBJ_LABEL has no native multi-line text support in MQL4, so this script splits the notes file on line breaks and draws one stacked label per line, behind a sized OBJ_RECTANGLE_LABEL background so the text stays legible over candles rather than blending into whatever colour happens to be underneath it. The background is sized from the longest line and the line count actually read, so a short two-line note and a long twenty-line checklist both get a tightly fitted block rather than a fixed oversized one. Because a script's own chart objects outlive the script once it exits, the notes stay pinned to the chart after a single run - there is no need to keep the script attached just to keep the text visible. An optional live-refresh mode is included for a notes file the user keeps editing while the chart stays open: set InpLiveRefreshSeconds above zero and the script keeps running, re-reading the file on that interval and updating the pinned block, until it is removed from the chart. Notes and limitations - The background sizing uses a rough fixed-width character estimate, not the font's actual rendered metrics (MQL4 exposes no text- measurement function) - a very wide line in a proportional font can slightly overflow the estimated background width. - With InpLiveRefreshSeconds at 0, the pinned notes do not update automatically if the file changes later; re-run the script to refresh, or use the live-refresh mode instead. - The notes remain on the chart as ordinary chart objects even after the script itself stops (with live refresh) or finishes (single read) - remove them manually via the chart's Objects list, or run the script again with an empty notes file, to clear them.
Script · MT5 · v1.0 · Free
About Chart Notes Pinner
Chart Notes Pinner is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 10 settings, such as Notes file, Use common folder and Corner. MQL source code included.
Files in the download: ChartNotesPinner.ex5, ChartNotesPinner.mq5, ChartNotesPinner.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Notes file | ChartNotes.txt | File in MQL5\Files\ (or MQL5\Files\Common\) |
| Use common folder | false | Read from the shared Files\Common\ folder instead |
| Corner | CORNER_LEFT_UPPER | Chart corner to pin the notes block to |
| X offset | 10 | Horizontal offset from the corner, pixels |
| Y offset | 20 | Vertical offset from the corner, pixels |
| Font size | 9 | Text font size |
| Text color | clrWhite | Text colour |
| Background color | C'25,25,25' | Background rectangle colour |
| Max lines | 25 | Maximum lines drawn, extra lines are truncated |
| Live refresh seconds | 0 | 0 = read once and exit; >0 = keep re-reading the file every N seconds until stopped |
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: Alerts · MT5 Script · MQL5 Source Code