Hi folks,
Today we will discuss and test a simple expert advisor I've created for the purpose of this article and called it EMA_CROSS.
Download: StrategyTesterResult.zip (88.87 KB)
Download: EMA_CROSS.zip (1.31 KB)
The Expert advisor is a program wrote in MQL4 (we are studying MQL4 huh?) uses your favorite indicators and trade methods to automate your orders.
It can buy, sell and modify the orders for you. It enables you to drink a cup of tea and save the salary you gave out to your employee or the bunch of flowers you bring to your assistant wife.
Any expert advisor has to decide when to enter the market and when to exit.
And the idea behind any expert advisor is what the entering and exiting conditions are?
Our expert advisor is a simple one and the idea behind it is a simple too, let’s see it.
We use two EMAs indicators, the first one is the EMA of 10 days (sort EMA) and the
second one is the EMA of 80 days (long EMA).
Note: You can change the values of those two EMAs to the values you are comfortable with. I have chosen those values after running a lot of optimization testes which had changed those values and I’ve picked the best two EMAs as above.
Our expert advisor will enter the market when the short EMA line crosses the long
EMA line, the direction of each lines will determine the order type:
If the short EMA is above the long EMA will buy (long).
If the short EMA is below the long EMA we will sell (short).
We will open only one order at the same time.
Our expert advisor will close the buy order when the short EMA crosses the long EMA
and the short EMA is below the long EMA.
And will close the sell order when the short EMA crosses the long EMA and the short
EMA is above the long EMA.
Our order (buy or sell) will automatically be closed too when the Take profit or the Stop
loss points are reached.
Beside entering (opening) and exiting (closing) the market (positions) our expert advisor
has the ability to modify existing positions based on the idea of Trailing stop point.
You can change the values of the Trailing stop but it’s recommended to keep the default value 35.
You can use these timeframes 15M, 30M, 1H, 4H and 1D. The recommended timeframe is 4H.