This article is part of a series. Here are the other parts:
- Part 1: MT4 EA Forex Course: Intro
- Part 2: MT4 EA Forex Course: our first forex expert advisor
- Part 3: MT4 EA Forex Course: trailing stops
- Part 4: MT4 EA Forex Course: buy and sell
- Part 5: MT4 EA Forex Course: ATR stops and position sizing (this page)
Welcome to the fifth part of our MetaTrader4 Expert Advisor course! If you haven’t done so, please have a look at the previous instalments.
We’ve been doing pretty well with our expert advisor. We created a fully functioning EA that can make buy and sell orders, and also can trail our stops. However, up until now, we’ve always used a fixed stop loss of 50 pips.
That might often be ok but what if you want a dynamic stop loss? In order to better reflect the market dynamics, we could use a volatility indicator such as ATR (Average True Range) to determine our stop-loss.
When we use dynamic stop loss distances, we still want to keep our risk per trade the same. We do this using dynamic position sizing. In other words, we will change the lot size per trade to reflect our desire to use a 1% stop loss. Let’s see how we can add this to our Wall-E expert advisor!