Loading…

Tag Taxonomy Manager

A flat list of trade tags can answer "how did trades tagged X do", but answering "how did every strategy variant UNDER X do combined" means re-scanning the whole journal again for every parent tag at report time. That cost grows with every report you ever run against the same data. This header pays it once, at record time, instead. TTM_RecordTrade takes a "/"-delimited path such as "Breakout/London" or "MeanReversion/NewYork", creates any missing segments as taxonomy nodes, and walks the resulting node chain from leaf to root incrementing trade count, win count and net profit on every node along the way. A parent node's stats are therefore always the exact sum of everything recorded under it - "Breakout" total trades always equals "Breakout/London" plus "Breakout/NewYork" plus any other session tagged under it - with no separate rollup step and no risk of the rollup drifting out of sync with the leaf-level records. The whole taxonomy lives in one fixed-size node array (TTM_MAX_NODES) inside a single TTM_Taxonomy struct, rather than a struct holding a dynamic array per node - MQL4 has no safe assignment/copy semantics for a struct containing a dynamic array member, and a hand-maintained trading tag taxonomy is naturally small (tens of tags, not thousands), so the fixed-capacity trade-off costs nothing in practice. Notes and limitations - TTM_MAX_NODES (128) bounds the whole taxonomy across all trades - raise it in the header if a journal genuinely needs more distinct tag nodes. - Tag matching is exact-string, case-sensitive, per path segment - "London" and "london" are different nodes. - There is no tag rename/merge/delete function - the taxonomy is append-only for the lifetime of a TTM_Taxonomy variable. Call TTM_Reset to start over. - Net profit rollup assumes each recorded value is that trade's own realised profit for the currency/units the caller is tracking in - the header performs no currency conversion.

Script · MT5 · v1.0 · Free

About Tag Taxonomy Manager

Tag Taxonomy Manager is a script for MetaTrader 5. MQL source code included.

Files in the download: TagTaxonomyManager.mq5.mqh, TagTaxonomyManager.txt, TagTaxonomyManagerDemo.ex5, TagTaxonomyManagerDemo.mq5.

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: Breakout · Trading Sessions · MT5 Script · MQL5 Source Code

MQL4 & MQL5 scripts · PolyMaria