Per Signal Cost Threshold Overlay
A signal that "worked" by two pips after costs is a losing trade, not a win - but most crossover indicators never show the actual cost bar a signal has to clear. This overlay marks each Close-vs-SMA cross with an arrow and a "need X.X pips" label computed from the account's real trading costs: the live spread, read every tick via MarketInfo(MODE_SPREAD), plus a user-supplied per-lot commission figure converted into an equivalent price distance using MarketInfo(MODE_TICKVALUE) and MarketInfo(MODE_TICKSIZE) - so a 5-digit forex pair, a JPY cross and a metal all convert correctly through one formula with no hardcoded contract size anywhere. Commission itself has no honest answer: MQL4's MarketInfo() has no commission mode at all, unlike spread, so it genuinely cannot be read live from the terminal and is a required input instead - stated plainly rather than pretending it can be discovered programmatically. What the tool gets right without guessing is the conversion math, which is where a hardcoded contract-size assumption would otherwise quietly break on anything but a standard 100,000-unit forex lot. The displayed cost also uses today's live spread applied uniformly to every signal shown, including older ones on the chart, because MT4 keeps no historical spread record to look up instead - again stated directly rather than implied to be a historically accurate reconstruction. Notes and limitations - Non-repainting: arrows and labels are placed on confirmed crosses using completed bar values. - Commission cannot be read from the terminal in MQL4 and must be entered manually; an incorrect InpCommissionPerLot produces an incorrect cost threshold. - The spread used is always today's live spread, applied to every signal on the chart regardless of when it fired - not a historically accurate per-bar spread, which MT4 does not retain. - This shows the cost floor a move must clear, not a trading recommendation - it does not judge whether a given signal is otherwise a good idea.
Indicator · MT5 · v1.0 · Free
About Per Signal Cost Threshold Overlay
Per Signal Cost Threshold Overlay is an indicator for MetaTrader 5 based on Moving Average. It draws buy and sell arrows on the chart. It has 4 settings, such as Ma period, Commission per lot and Commission is round trip. MQL source code included.
Files in the download: PerSignalCostThreshold.ex5, PerSignalCostThreshold.mq5, PerSignalCostThreshold.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Ma period | 20 | SMA period the base rule crosses against |
| Commission per lot | 7.0 | Round-trip commission per lot, in account currency (broker-quoted, not readable via SymbolInfo) |
| Commission is round trip | true | True if InpCommissionPerLot already covers open+close, false if it is per side |
| Label color | clrDarkSlateGray | Text label colour |
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: Moving Average · Buy/Sell Arrows · MT5 Indicator · MQL5 Source Code