Discussing the article: "MetaTrader 5 Machine Learning Blueprint (Part 14): Transaction Cost Modeling for Triple-Barrier Labels in MQL5"
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Check out the new article: MetaTrader 5 Machine Learning Blueprint (Part 14): Transaction Cost Modeling for Triple-Barrier Labels in MQL5.
Imagine building a bridge but omitting the structure's own weight from your load calculations: the design fails for a cost that was visible from the start. The same operational blindness affects many triple‑barrier labeling pipelines. Researchers commonly set min_ret to an arbitrary constant (0.5–1%) or to legacy spread/commission assumptions, then treat every historical price move above that threshold as genuine signal. The missing step is a disciplined, repeatable way to answer: what is the actual round‑trip transaction cost for this symbol, at this broker, given my strategy's typical holding period and entry hours?
Figure 1. 2-stage pipeline from broker data collection to labeling threshold
This article gives that answer. It presents a reproducible two-stage pipeline: (1) a compact MQL5 script that samples the broker's spread history, swap rates, and symbol properties and writes a structured CSV; and (2) a Python TransactionCostModel that ingests the CSV, converts all components to a common fractional‑return unit, and exposes min ret for symbol() plus diagnostic routines. The output you should expect to obtain and use is explicit: a CSV with spread percentiles and hourly means, a model object that returns per‑trade cost breakdowns, a cost‑calibrated min ret ready for get events(), and the same parameters to pass into your per‑trade P&L calculation. Note: min ret here is a labeling threshold (for training data construction), not the execution profit‑taking target an EA will place in the terminal.
Author: Patrick Murimi Njoroge