Manage Trades with Scripts in MT4 – The Comfortable Package

You want to take a trade with given risk parameters and have to measure the pip move, then calculate your position size and then open the order tab, clicking the volume field, and then placing the order…

Well that can cost you time and make you inconsistent, as well as it’s prone to mistakes.

A better way to manage your position size, bracket orders and overall trade management in Metatrader 4 is with SCRIPTS.

I’ve put together a really Comfortable Package so you can sit back and relax and focus on the thing that counts: trading!


Download the package here:

Comfortable Package Download

Once you have it, follow the instructions in the README.txt or read through the next paragraphs.

Copy and paste the files in the zip package (use winrar or something else) into your Metatrader 4 Folder. Apply the ‘comfortable_package’ template or drag the 2 indicators and the expert advisor of the package on your chart.

Very important is to set up your variables once by executing the ‘GlobalVariables’ script.


How much percentage of your account balance you want to risk on a single trade.


Leave this 0.0 if you want to use risk percentages or fill this out to have a currency amount of risk for each trade instead of percentage risk, e.g. 50 for $50.


The stop loss distance in points that your position size is calculated on. Check the points of your underlying by pressing Ctrl+F (cross cursor) and holding mouse down. The middle number is the point distance.


If you want to average into your position, this is the amount of trades you have to execute in order to reach the full position size on your ‘SetupStop’ distance.

Key Bindings

For the full convenience you can now key bind all the scripts by opening the navigator tab (Ctrl + N) and Right Click – ‘Set Hotkeys’.

Here’s an example of how you can do it. I like to use ‘Ctrl +’ key binds for long and ‘Alt +’ for short.

One short note: If you use scripts to execute orders, make sure you execute them only once.

Wait a moment to see if it has done something, if not, press the key bind again. You don’t want to press it two times and have double the position size in the market! Practice the scripts, using a demo account.

The Template

Look at the picture below. There are two open positions with an ‘AvgDivder’ of 3.0. This means you need to open 3 positions with the ‘AverageLong’ script for example to have the full long position size.

Here, the blue doted line shows you where your full risk is set to. The red line shows the average entry price weighted on position size, and it is also shown in the bottom right corner. Over this line you are profitable.

The ‘ModifyTP_SL_Shift_Ctrl-Click’ expert advisor lets you adjust all the stops in one place by holding Ctrl and clicking the chart where you want to place your stop loss. Shift-click is for nailing all take profits in one place. Works also for limit and stop orders.

All the Scripts


Executes a market order with ‘SetupStop’ points and your chosen risk value in % or currency.


Executes a limit order, placed 2x ATR(14) away with ‘SetupStop’ points and your chosen risk value in % or currency.


Executes a stop order, placed 2x ATR(14) away with ‘SetupStop’ points and your chosen risk value in % or currency.


In the input parameter popping up: choose the candle to put stop on and an added distance in points. If you choose 0 for the first parameter, it is the current candle, 1 for the last and so on. The risk value will be calculated with a stop distance different to the ‘SetupStop’ standard bracket.


This executes a stop, market or limit order. It depends now. For example if you want to go long: if the price is under the candle’s high, then it places a stop order, if it is over it a limit order and if too close to put a limit or stop, then it will execute market. Similar to ‘CandleMarket’ it will calculate the stop distance differently.

Metatrader 4

Leave a Reply

Your email address will not be published. Required fields are marked *

© Niclas Hummel Trading 2020 | Terms and Conditions | Privacy Policy