Static Report Page Composer
A tool that wants to hand a trader a readable weekly summary, backtest-run result, or symbol scan has two realistic options: dump a wall of Print() lines to the Experts tab, or build an actual page. Hand-writing that page's HTML every time means re-solving the same small problems - a table of contents whose links must stay in sync with each section's heading, a consistent stat-tile look, a simple bar chart without pulling in a JS charting library the saved file will never be able to load anyway (a static local .html has no network access once opened). SrpcMakeSection() pairs a title with an auto-generated anchor slug (SrpcSlugify()), so SrpcBuildPage()'s table of contents and each section's actual anchor id can never drift apart. SrpcBuildStatTile() produces the "big number, small label" card a summary row is usually made of; SrpcBuildBarRow() draws one horizontal bar purely with a width-percentage <div> - no canvas, no external chart library, and the percentage is clamped to [0,100] so an out-of-range caller value cannot visually overflow the row. Every style is inlined directly on each element, so the single saved .html file renders identically with zero external dependencies, exactly what a "save it and look at it later, possibly on a different machine" report needs. Notes and limitations - This is a standalone page builder, distinct from a mail-body composer - it targets a saved, browsed report file, not a message sent through the terminal's SendMail(). Its HTML escaper and layout helpers are reimplemented locally rather than shared with any other header in this catalogue, per house style (no cross-project #include) - functionally similar in shape to escaping code elsewhere, but a genuinely separate implementation here. - SrpcSlugify() truncates its input to SRPC_MAX_TITLE_FOR_SLUG (64) characters before generating an anchor id, and falls back to the literal slug "section" if a title contains no letters or digits at all (e.g. a title that is only punctuation) - two sections with titles that collapse to the same slug will share one anchor id, so keep the meaningful, alphanumeric part of each section title distinct. - SrpcBuildBarRow's bar width is purely relative to the maxValue the caller passes in - it has no concept of a shared scale across rows unless the caller passes the same maxValue to each call in a set. - FileOpen() is sandboxed to MQL4\Files (or MQL4\Files\ (or MQL5\Files\ on the native MQL5 build)Common with the commonFolder parameter) - it cannot write anywhere else on disk.
Script · MT4 · v1.0 · Free
About Static Report Page Composer
Static Report Page Composer is a script for MetaTrader 4. MQL source code included.
Files in the download: StaticReportPageComposer.mqh, StaticReportPageComposer.txt, StaticReportPageComposerDemo.mq4.
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: MT4 Script · MQL4 Source Code