See detailed instructions here:
I have a spreadsheet that I use to manage how large of a position to put on based on how much I want to risk, the currency being traded, and the stop loss. However, it's inconvenient to switch back and forth between MT and this during a live trading opportunity, so I've decided to create an expert advisor to do this work for me from within MT, visually on the screen.
When you attach the indicator, you will have the following options:
- percent of your balance you wish to risk on a trade
- whether your order will be a market or limit order
- external account information -- this is for use if you have a non-MT broker and still use MT for charts, and don't want to use your MT account balance for calculations
- color of the stop loss/limit lines which is created (see below)
After you OK the options, a stop loss line will be created on your chart. For long trades, this will obviously be below the price, and for shorts, it will be above. Set the line to where your stop loss will be for the trade. Note that after you move the line, the values displayed telling you how many lots to trade will not be updated until another tick comes in, so be sure a tick occurs after you move the line!
Note that the stop loss value and calculations take into account the spread, which on shorter TF trades can be very significant. Remember that when going long, you buy not at the bid price, which is the default price displayed in MT, but rather at the ask, so if the spread is 5 pips and your line appears to be 15 pips below the price, the SL is actually 20.
Though I have not yet tested it, this should also work work accounts whose deposit currency is not USD. It should work with EUR-based accounts for sure, and most others, though there is definitely code missing to make it truly work for all currencies. If anyone finds that it does not work with theirs, I will certainly update it.
Hopefully this will be useful to MT4 users. Position sizing is so important in trading but often overlooked, probably because people just don't really know that there are many different ways to calculate it, or how to calculate it at all. My hope is that this indicator takes some of the focus off of calculations and lets you focus on good trade setups and exits!
(If anyone wants modifications or has a feature request, let me know and I'll do my best)