Loading…

Stop Distance Advisor

A stop distance chosen from habit or a round pip number carries no information about whether it actually fits the symbol's current behaviour. Ten pips is generous on a quiet pair and reckless on a volatile one; the same number can be right on Monday and wrong by Friday if volatility has expanded. This indicator builds a distribution of adverse noise directly from price history: for every closed bar, it looks InpHorizonBars ahead and records the worst excursion a flat entry at that bar's close would have had to survive, in either direction, whichever was larger. That gives a direction-agnostic noise sample per bar, plotted as a histogram, drawn from the last InpSamplePeriod bars. InpStopPips is then ranked as a percentile inside that distribution: a stop smaller than most of the sampled noise sits at a low percentile and is graded SUICIDAL, because ordinary chop alone would likely have taken it out; a stop comfortably past most sampled noise is graded SURVIVABLE. This says nothing about whether the trade has positive expectancy - only whether the stop distance itself is a reasonable fit for how this symbol actually moves. Notes and limitations - The noise sample is direction-agnostic - it takes the worse of the up-excursion and down-excursion at each bar - so it grades the raw distance only, not whether a long or a short specifically would have survived. - InpHorizonBars is a fixed lookahead window, not a stop-hunting simulation; a trade held longer than InpHorizonBars can still be stopped out by noise this indicator did not sample. - The verdict recomputes once per closed bar, not per tick, so it reflects the noise distribution as of the last completed bar, not the current partially-formed one. - Grading is purely statistical, not predictive - a SURVIVABLE grade describes recent history, not a guarantee against an unusually large future move. - Needs InpHorizonBars + InpSamplePeriod + 2 bars of history before the histogram and verdict appear.

Indicator · MT4 · v1.0 · Free

About Stop Distance Advisor

Stop Distance Advisor is an indicator for MetaTrader 4. It has 5 settings, such as Stop pips, Horizon bars and Sample period. MQL source code included.

Files in the download: StopDistanceAdvisor.mq4, StopDistanceAdvisor.txt.

Settings

SettingDefaultWhat it does
Stop pips20.0Proposed stop distance to grade, in pips
Horizon bars10Bars ahead each noise sample looks for its worst excursion
Sample period500How many closed bars make up the noise distribution
Suicidal pct40.0Percentile at/below which the stop is graded SUICIDAL
Survivable pct70.0Percentile at/above which the stop is graded SURVIVABLE

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the indicator from the Navigator onto a chart and adjust the settings.

Download the PDF guide

Tags: MT4 Indicator · MQL4 Source Code

MetaTrader 4 & 5 indicators · PolyMaria