Stop Placement Tradeoff Table
Most stop-placement advice picks one number and defends it. In reality a tight stop and a wide stop are not competing for the same job - they trade a bigger lot for the same risk against a lower chance of surviving normal noise, and neither side of that trade is free. This script does not resolve the tradeoff. It measures it, one candidate distance at a time, and prints the numbers so the decision is made with the actual figures in front of you rather than a rule of thumb. For every candidate stop distance in the input list, the lot size is computed from MODE_TICKVALUE and MODE_TICKSIZE so the fixed risk budget converts to a position size correctly on any symbol, gold and JPY crosses included - never a hardcoded pip value. The breakeven move is reported both in price and in pips, showing how far the market needs to travel past entry before the trade covers its own spread. Distances that fall inside the broker's stop level are flagged, and distances where the risk budget cannot even buy the minimum lot are reported as such rather than silently rounded up to a bigger risk than requested. The survival rate is the part worth reading carefully. For every historical bar in the lookback window, the script asks: if a stop this many pips away had been placed at that bar's close, would it have been hit before price moved the target distance the other way, within the forward window? That produces an honest base rate for how often a given stop distance gets touched by ordinary noise on this symbol and timeframe, before any entry logic is even considered. It is not a strategy backtest - it assumes every bar is a valid entry point, ignores spread on entry, and tests one fixed direction throughout the run - and the notes section says so plainly. Its value is comparative: a stop distance whose survival rate barely improves over one half its size is telling you something about the symbol's noise floor that a single-number rule cannot. Notes and limitations - The survival rate is a base rate for the symbol and timeframe, not a backtest of any entry strategy. It assumes every historical bar is a valid entry, which no real strategy does, and it does not account for spread on entry or slippage on the stop itself. - It tests one direction at a time (InpAssumeBuySide). A symbol with directional bias in the lookback window will show different survival rates for buys versus sells; run both if the difference matters to you. - Overlapping samples are not independent - adjacent bars share most of their forward window, so the sample count overstates how much genuinely new information the survival rate is built from. Treat it as indicative, not as a statistically rigorous estimate. - A stop distance below the broker's MODE_STOPLEVEL is flagged in the table but the row is still computed; a real order at that distance would be rejected by the server. - This is a read-only measurement tool. It does not place, modify or close any order.
Script · MT5 · v1.0 · Free
About Stop Placement Tradeoff Table
Stop Placement Tradeoff Table is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 7 settings, such as Risk money, Stop distances pips and Target pips. MQL source code included.
Files in the download: StopPlacementTradeoffTable.ex5, StopPlacementTradeoffTable.mq5, StopPlacementTradeoffTable.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Risk money | 100.0 | Fixed risk budget per trade, account currency |
| Stop distances pips | 5,10,15,20,30,50 | Comma separated candidate stop distances, pips |
| Target pips | 20.0 | Favourable move used to define "survived", pips |
| Bars forward | 48 | Bars to look forward when testing survival |
| Lookback bars | 2000 | Bars of history to sample for the survival rate |
| Timeframe | PERIOD_CURRENT | Timeframe to sample history from |
| Assume buy side | true | Direction assumed for the survival simulation |
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 → Scripts.
- 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 script onto a chart to run it once.
Tags: Trailing Stop & Break-even · Risk & Lot Size · Alerts · MT5 Script · MQL5 Source Code