Home Support Online Tutorials Moving Average Strategy
 
Moving Average Strategy (Expert Advisor for MetaTrader) E-mail

 

Typically, two moving averages can be used to create a forex strategy (EA for MT4) with these rules:

  • Buy when the short period moving average is above the long period moving average
  • Sell when the long period moving average is above the short period moving average

On the following graph from MetaTrader Terminal, the yellow line is the short period moving average (Period=9) and the red line is the long period moving average (Period=18).

 

moving average in metatarder

 

Analizing the graph, we could rewrite the trading rules or forex signals as:

  • Buy when the yellow line is above the red line
  • Sell when the yellow line is below the red line

Instead of spending a long time coding this forex strategy, with Molanis Strategy Builder you can create a trading diagram that represents the moving average strategy in minutes. Just drag and drop two Technical Analysis blocks, one Buy block and one Sell block. Connect them and set the block parameters to get a diagram like the following:

 

moving-average-strategy

This trading diagram has two trading paths. The left one is highlighted. It goes from the START block to the END block.

One could read it as: Buy 1 lot of EURCAD (with a 100 pip Take Profit and 50 pip Stop Loss) when the short period moving average (9) is above the long period moving average (18). Remember to read the trading diagram in opposite direction to the trading flow.

The right trading path could be read as: Sell 1 lot of EURCAD (with a 100 pip Take Profit and 50 pip Stop Loss) when the long period moving average (18) is above the short period moving average (9).

 

Generating the MQL code for MetaTrader with just one click

On the Trading Diagram Menu, click on Generate MQL4 Code to get the MQL4 Code window. Molanis Strategy Builder allows you to open your expert advisor directly with MetaTrader or to save it as an MQ4 file.

 

generate mql code

 

Don't miss our video tutorial on

moving average strategy!

watch tutorial

Download the moving average ea in our examples page