Loading…

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

SettingDefaultWhat it does
Notes fileChartNotes.txtFile in MQL5\Files\ (or MQL5\Files\Common\)
Use common folderfalseRead from the shared Files\Common\ folder instead
CornerCORNER_LEFT_UPPERChart corner to pin the notes block to
X offset10Horizontal offset from the corner, pixels
Y offset20Vertical offset from the corner, pixels
Font size9Text font size
Text colorclrWhiteText colour
Background colorC'25,25,25'Background rectangle colour
Max lines25Maximum lines drawn, extra lines are truncated
Live refresh seconds00 = read once and exit; >0 = keep re-reading the file every N seconds until stopped

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: Alerts · MT5 Script · MQL5 Source Code

MQL4 & MQL5 scripts · PolyMaria