Trade Duration Versus Norm Bar
A trade that has been open for six hours means different things depending on what your own trading normally looks like - six hours is nothing for a system that holds winners for days, and a clear overstay for a scalping approach that usually resolves in minutes. This panel builds that norm from your own closed-order history rather than from a fixed number, scanning past trades and averaging the holding time of winners and losers separately. Winners and losers are kept as two separate norms deliberately, not blended into one "average trade duration". Many approaches let winners run and cut losers early (or vice versa), so a currently profitable open trade is judged against how long winners typically take, while a currently losing one is judged against how long losers typically take - blending them into a single average would produce a norm that fits neither case. An open trade whose age exceeds InpOverstayMultiple times the relevant norm is flagged OVERSTAYED in the panel, a simple and adjustable threshold rather than a statistical claim about significance. Notes and limitations The norm is only as good as the history behind it - a new account, a magic filter that excludes most trades, or InpCurrentSymbolOnly on a rarely-traded symbol can all leave too few closed trades to be meaningful; the panel shows "n/a" for a norm with zero samples rather than a fabricated number. Scratch trades (net profit/swap/commission exactly zero) are excluded from both norms, since they are neither a win nor a loss to learn a duration from. History is rescanned in full on every refresh rather than incrementally, which keeps the numbers correct if a record is later corrected but means a very large history plus a short InpRefreshSecs can be relatively CPU-heavy; raise the interval on accounts with tens of thousands of closed orders.
Indicator · MT5 · v1.0 · Free
About Trade Duration Versus Norm Bar
Trade Duration Versus Norm Bar is an indicator for MetaTrader 5. It has 9 settings, such as Magic filter, Current symbol only and Overstay multiple. MQL source code included.
Files in the download: TradeDurationNormBar.ex5, TradeDurationNormBar.mq5, TradeDurationNormBar.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Magic filter | -1 | Only use/show orders with this magic number, -1 = show all |
| Current symbol only | true | Restrict both history and open trades to this chart's symbol |
| Overstay multiple | 1.5 | Age beyond this multiple of the norm is flagged OVERSTAYED |
| Max history orders | 2000 | Safety cap on how many closed trades are scanned per refresh |
| Refresh secs | 3 | Panel refresh interval, seconds |
| Corner | CORNER_LEFT_UPPER | Panel corner |
| X offset | 10 | Horizontal offset, pixels |
| Y offset | 20 | Vertical offset, pixels |
| Font size | 9 | Panel font size |
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 → Indicators.
- 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 indicator from the Navigator onto a chart and adjust the settings.
Tags: Scalping · MT5 Indicator · MQL5 Source Code