How To Remove A MT4 Script From A Metatrader Chart

Metatrader (MT4) scripts are designed as run once programs. After it runs once, the MT4 script should gracefully exit. However, not all MT4 scripts are written for graceful exit. When you run into one of these "night of the living dead" MT4 scripts, you can follow the simple procedures outlined in this short article.

Stopping a Runaway MT4 Script

To stop a runaway Metatrader script dead in its tracks, there are three main approaches. First you can take the preferred approach and select the Remove Script menu item (from the right click menu) as is shown in the picture to the left. Just right click on the chart then select "Remove Script" from the menu. You may need to select "Remove Script" more than once if the script doesn't unload right away. If that doesn't work, don't despair. There are other options.

Second you can try modifying the script by right clicking on the script name in the Navigator window. Once the MetaEditor opens up you can try to compile the script. There should be a button at the top about 3rd from the right on the toobar that says "Compile" and has a green check mark.

If you don't see the Compile button, you can also find Compile under the MetaEditor File menu or by pressing F5 within the MetaEditor.

Clicking the compile button should force the MT4 script to stop processing but is not guaranteed to work. There is one final option if you are batting 0 for 2.

Third, you can take the approach that should work every time, but is the biggest nuisance. You can simply exit the Metatraer terminal, and then reload the program. Since Metatrader Scripts are run-once programs, the script should not be in memory when the page is reloaded. And as option 3.5 if all has failed, you can try option 3 and move the offending script out of your ..\experts\scripts folder or as a last resort, send the undead script to the dustbin! So there you have it! Three (and a half) simple and effective methods for removing a script from a Metatrader chart. Remember to read Two Things every MT4 trader ought to know about MT4 scripts.

If you enjoyed this MT4 help tutorial, you might also enjoy reading a MQL4 Code Tutorial for Metatrader. Every trader needs to learn at least some MQL4 in order to perform the simple operations of modifying code inputs, commenting out a line of code and understanding how to read the code to know if it is executing your MT4 Indicators, Metatrader expert advisors and MT4 scripts properly.

Follow patrickmwhite on Twitter

For updates