Friday, 18 August 2017

Free Metatrader 4 Trailing Stop EA

Here's a nifty little trailing stop EA that you can use for free. In fact in our Mt4 programming lessons we're going to be building it ourselves but for those who can't wait here's the finished article.

The Legal Bit
Please note that this EA is supplied "as is" and no warranty is made, either expressly or implicitly as to its behavior. Please do your own due diligence on a demo account before using it on a live account and you use it at your own risk.




Inputs

The TrailTypeOptions selects which trail type to use.
1 is an N-bar hi/lo trail - so e.g. 5 bar trailing low for a long position or 10 bar trailing high for a short
2 is an SMA trail, so trailing at the price of a simple moving average
3 is an EMA trail so trailing at the price of an exponential moving average

The TrailLength is the trail length to use. For the N-bar hi/lo trail this is the number of bars back for your trail. For the other options it's the moving average length

The StopOffset is how far beyond the calculated point to put your stop. So if you're running a short 10 bar trailing high stop then you might want to place your stop a couple of pips above the 10 bar high to allow for the spread etc. NB this is specified in points - the minimum price movement so if you input 20 then this is 2 pips (for a market that is quoted in pipettes).

If StopOnClose is set to true then the position will only be closed out if the market closes beyond the stop level. NB use this carefully as you don't have a stop in the market at all in this case and if you should lose your internet connection then the EA won't be able to close your position.




For help on how to install it in Mt4 see this post here
For help on how to apply it to your chart see this post here

No comments:

Post a Comment