The idea behind our expert advisor.
Before digging into cracking our code we have to explain the idea behind our expert advisor. 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 look at it.
We use two EMA indicators, the first one is the EMA of 8 days (sort EMA) and the second one is the EMA of 13 days (long EMA).
Note: using exactly these EMAs or any other thought in this lesson is not a recommendation of mine, they are for educational purpose only.
Our expert advisor will enter the market when the short EMA line crosses the long EMA line, the relative locations of the lines will determine the order type:
If the short EMA is above the long EMA we 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 ends up below the long EMA.
And will close the sell order when the short EMA crosses the long EMA and the short EMA ends up above the long EMA.
Our order (buy or sell) will also be automatically closed when the Take profit or the Stop loss points of profit/loss are reached.