tfmt5.com

Dual Moving Average Expert Advisor

.mq5 file for $99

This Expert Advisor in .mq5 format has fully commented code to let you test, customize, and automate a two moving average (MA) trading system in MetaTrader 5. This dual moving average system is not in the market at all times. Entries occur in the direction of the MA cross when the price closes to the outside of the fast/short moving average. Positions exit when the price closes back on the inside of the fast/short moving average.

A quick visual example to show approximate entry and exit areas (arrows manually added):
2 Moving Average EA Example
Note: The default input values are not optimized. Demo the EA for free or buy a compiled version (.ex5 file - cannot see or modify the EA code) at the MQL Market. Adjust the inputs to find the optimized combination for your risk tolerance and to maximize profitability. Trend Following systems are designed around long term probabilities. Although Trend Following systems have lower win rates, profitability comes from large trends as Trend Following cuts losses short and lets winners run. Test on a portfolio of symbols as profits from trending symbols will offset the small losses and provide profits when other symbols are not trending.

Customizable Variables

Markets

Trade on any pair and any timeframe. Place the expert advisor on a chart and it will use the currency pair and timeframe of the chart. Choppy and sideways markets will cause more whipsaws while markets that trend will produce more profitable trades.

Entry

Basic entry criteria checks the direction of the moving average cross and that the bar is completely outside of the fast moving average. Additional entry criteria confirms that the previous bar's fast moving average has improved over the moving average of the bar before. For an example we'll use a daily chart with 5 and 20 day moving averages. Long positions would occur when the 5 day MA is above the 20 day MA, yesterday's low is above the 5 day MA, and yesterday's 5 day MA is above the 5 day MA of the day before yesterday. Short positions would occur when the 5 day MA is below the 20 day MA, yesterday's high is below the 5 day MA, and yesterday's 5 day MA is below the 5 day MA of the day before yesterday. This 3 part criteria confirms the price direction through the direction of the MA cross, that the previous bar's price action is outside of the fast MA, and that the previous bar's MA has improved from the prior bar's MA. If you set the Max Unit variable above 1, additional entries will occur and pyramid in ATR increments specified by the ATR between Pyramids variable.

Position Sizing

This expert advisor uses Percent Volatility position sizing. Verify the tick value, minimum and maximum lot sizes, size of lot increments, etc to confirm each position will not exceed your set risk percentage. Using the stop level, if the position is stopped out, the position size is calculated to only lose the amount risked through the Risk Percent variable. The calculation looks at how many dollars are at risk, how many pips are in the distance from the entry to the stop and the value of that distance.

Stop

The stop is set using multiples of the ATR. Basing the stop on the ATR allows the stop to be placed out of the normal price range and account for volatility. If you choose 2 times the 14 day ATR, the stop on long positions would happen if the price touches or goes below the entry price minus ( 2 * ATR ). The stop on short positions would occur if the price touches or goes above the entry price plus ( 2 * ATR ). The stop is set when the position is entered. The stop accounts for gaps in price and is not set as a pending order. A position is only stopped out if the price reaches or exceeds the stop level. If you use the pyramiding option, the stop will change to be in line with the latest entry price when a new position is added.

Exit

Positions are closed when the price closes to the opposite side of the fast/short moving average. In other words, it exits when the price closes back inside the fast moving average to the side of the slower moving average. For long positions, the exit occurs when the price closes below the fast moving average. For short positions, the exit occurs when the price closes above the fast moving average.

Delivery

Once you complete checkout through Paypal, you will receive an automated email with the download link. The email will go to the email address that is on file with Paypal - make sure Paypal has your current and correct email address. The download link will be active for 24 hours so please download as soon as you get the link. The expert advisor comes as the MQL5 code so you will have to save it in the correct folder, read through the notes in the code, and compile it. After compiling it, start testing and finding your profitable variables. Use the installation tips page to get the file saved and compiled so you can start testing today.