Loading…

Strip All Stops And Targets

WARNING FIRST, because this script deserves one: after it runs, nothing on the server will close the stripped positions automatically. No stop loss means no protection against a gap, a lost connection, a dead terminal or a weekend. Do not run it unless something else - an exit-managing EA, or you, awake and at the screen - is explicitly taking over that job. There are legitimate reasons to want a bare book. Some experts manage exits entirely internally and treat server-side stops as interference, closing at their own signals and misbehaving when a hard stop fires first; their vendors tell you to run them without stops, and clearing a hand-built book by hand before attaching one is slow and error-prone. Some traders clear levels before a news window on the argument that resting stops are visible targets. Whether those are good ideas is a strategy question; this script's job is to execute the instruction honestly and to make sure it was actually an instruction, which is what the confirmation prompt is for. It states how many positions are affected and that they will be left without protection, and nothing is touched until it is answered. The inputs choose what goes. Strip only the stops, only the targets, or both - the default. Whichever level is not being stripped is passed through the modification unchanged, so stripping targets never disturbs a stop and the other way round. One trap the implementation handles: removing a level is still a modification, and the broker's freeze level applies to modifications. A stop the market is about to hit sits inside the freeze distance and cannot be removed - which is exactly the moment a naive script hammers the server with retries and reports failure without saying why. Here it is checked first and reported as a skip with the reason, and the summary says in plain words that those levels are still in place. The MQL5 version does not trust the retcode alone: after every modification it reads the levels back from the position and only counts the removal when they are actually gone. Notes and limitations - The script removes protection. It does not add anything in its place, it does not check that your EA is attached and running, and it cannot undo the removal afterwards. Re-applying levels is a separate script. - A level inside the broker's freeze distance is not removed. Run the script again once the market has moved away, or accept that a stop about to trigger is doing its job. - Levels frozen or refused are still in place afterwards, and the summary says so. Read it before assuming the book is bare. - Pending orders are untouched on both platforms. - If an EA re-applies stops on its next tick, the book will not stay bare. The script does not fight it. - There is no dry-run mode; the confirmation prompt with its exact count is the dry run. Cancel it if the number surprises you.

Script · MT4 · v1.0 · Free

About Strip All Stops And Targets

Strip All Stops And Targets is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 7 settings, such as Strip stops, Strip targets and Current symbol only. MQL source code included.

Files in the download: StripAllStops.ex4, StripAllStops.mq4, StripAllStops.txt.

Settings

SettingDefaultWhat it does
Strip stopstrueRemove stop losses
Strip targetstrueRemove take profits
Current symbol onlyfalseRestrict to this chart's symbol
Magic filter-1Only this magic (-1 means every magic)
Max retries5Attempts per position before giving up
Retry wait ms500Pause between attempts, milliseconds
Confirm firsttrueAsk for confirmation before stripping

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 → Scripts.
  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 script onto a chart to run it once.

Download the PDF guide

Tags: Alerts · MT4 Script · MQL4 Source Code

MQL4 & MQL5 scripts · PolyMaria