About one year ago, a couple of months after getting into trading using the MetaTrader4 trading terminal, I realized that I need a tool to automate some of my actions on the FOREX market so I decided to create an expert advisor that acts as that tool which also has the possibility of entering trades automatically.
The minimum deposit for this to work is 1000 units of whatever your account currency is.
The base strategy behind this tool is getting small profits at the start of a momentum and averaging down for losing long positions or averaging up for short ones.
After using it constantly on two trading accounts for the past 8 months and getting good results I decided to publish it on the MQL5 marketplace(Average Trader on MQL5).
Settings
MagicNumber – The unique number used to internally identify trades launched by the EA on the current chart.
TradeComment – The comment to leave on the trade
TradingStyle – Conservative or aggressive. This affects the size of the order. Conservative = 0.01 and aggressive = 0.02 lots per 1000 available in balance.
TargetProfitPips – The target profit in pips for trades.
AutoSafetyTradesEnabled – A safety trade is a trade performed when averaging the price closer to the current price. Having this setting enabled allows the EA to automatically launch safety trades.
PipDeviationToOpenSafetyTrades – The distance in pips in the losing direction of the initial trade at which to launch safety trades.
MaxNumberOfTrades – The maximum number of trades the system can do when averaging.
AlertOnTradeClosed – If true then display an alert whenever a trade is complete.
BuyEnabled – If false then disable BUY trades(both on manual and automatic trades).
SellEnabled – If false then disable SELL trades(both on manual and automatic trades).
MinBalanceToStartTrade – The minimum balance required before launching a trade.
MinEquityToStartTrade – The minimum equity required before launching a trade
MaxSpreadToStartTrade – The maximum value of the spread at which a trade can be launched.
SvenSignalEnabled – This enables launching trades automatically when getting a signal from Sven.
SvenSignalNumBars – The number of previous bars to check.
SvenSignalTimeframe – The timeframe to look into.
SvenSignalReversed – If true then the signals are reversed(eg. if Sven says BUY then launch a SELL).
The Sven signal
This signal uses a simple momentum following algorithm which looks for consecutive rising or falling close prices on the given number of previous bars(aka candles) at the given timeframe(not the chart timeframe, the one set for the SvenSignalTimeframe setting).
If, for example, the given number of bars is 7 and the timeframe is 5M then when a new candle is formed on the chart it will check if there are 7 consecutive candles up to the current one on the 5M timeframe which are either going up or down. If true for either direction it will give a Buy or a Sell signal which will also be indicated on the chart.
How it works
I’m on the EURUSD chart on the 30M timeframe.
The current price is at 1.02297 and I decide that it’s a good time for a short position.
After clicking on the Sell button, a short position is opened and the take profit is set at the open price plus the given target profit of 10 pips(aka 100 points).
The volume of a trade is dependent on two things: the current balance and the trading style selected in the settings. If you selected conservative then for every 1000 units of currency in the balance the number of lots is a multiple of 0.01. For aggressive trading style the volume is 0.02 for every 1000 units(the step is incremented by 0.01 on each 500 units).
And as you can see, I was wrong and the price went in the opposite direction of my trade and because I have enabled automated safety trades it placed one at the given deviation of 30pips.
A safety trade is a trade in the same direction of the initial one which is used to average up or down. In this example it’s averaging up.
You can see the take profit target is now set for both trades on the same level which is the average trade price plus the given target of 10pips.
And after some time the price came back down and it hit my TP and the gains from the safety trade are larger than the absolute negative gains of the first one.
You can also launch safety trades manually by clicking on the Safety button(d’ooh).
Now here’s how it looks like when it listens to the Sven signal:
Also if you find yourself feeling like a pickle in a sewer you can always close all of the trades by clicking the Close Trades button and it will close everything managed by Average Trader on this chart at once.
So that’s about if for this tool. You can check it out for yourself using the free demo version on MQL5.