Previous: Part 2 : Indicators.

Tutorial - Part 3: Signals

Last update: 4 January 2023

With the indicators added to your EA, your EA will not yet open or close any orders. You only made the indicators (and their inputs) known to your EA. So, next task will be to create the signals, which consists out of one or multiple conditions, which define when the EA will open and close orders.

First, choose which signal you will be creating first. We strongly suggest you start by creating the 'Open Buy' signal and create the other signals when you've verified a buy order is opened at the correct moment. Only then, you should create the other signal(s). We suggest you do this, to keep the complexity of creating and adjusting signals as low as possible while you're still learning. We also will do just this, so we start by creating the Open Buy signal.

The 4 types of signals are:

Open Buy; when this signal activates, your EA will open a buy order.
Open Sell; when this signal activates, your EA will open a sell order.
Close Buy; when this signal activates, your EA will close your buy order(s), unless the Open Buy signal is (still) active.
Close Sell; when this signal activates, your EA will close your sell order(s), unless the Open Sell signal is (still) active.

To create the Open Buy signal, click 'Open Buy' in your EA's main screen.

click open buy
Click the 'Open Buy' Signal of your EA.

If you've chosen the 'Empty template' in Part 1 (EA Builder Pro - Getting started) of this tutorial, then you'll now see an almost empty screen. This is because the signal is still without conditions. We're going to have to add the condition(s), which forms the Signal, ourselves.

You are probably seeing this:

an empty open buy signal
Clicking the menu Icon.

To start adding conditions, click the 'menu icon', which looks like 3 dark dots in a vertical position. Once you've clicked it, we're going to choose 'Condition'. Repeat this step 3 more times, so that you've got 4 conditions added to the signal in total, which all look the same.

Remember our Open Buy signal from the Tutorial introduction page? Let's rephrase the Open buy signal:

  • 4-bar EMA is rising
  • 12-bar EMA is above the 23-bar EMA
  • 50-bar EMA crosses the channel's high upwards
  • Price closes below the channel's high

Now let's adjust each condition so that the conditions match the description of the Open Buy signal:

1. The 4-bar EMA is rising
To check if the EMA is rising we simply need to compare the previous value of the EMA line with the current value of the EMA line. When the value is increasing, it is rising. To check if the line is increasing, we need to check if the current value is bigger than (>) the previous value.

4 bar EMA is rising
Current (Shift 0) is bigger than previous (Shift 1), meaning it's rising

2. The 12-bar EMA is above the 23-bar EMA
To check if the EMA (12) is above the EMA (23), we will compare these two indicators to eachother. if the value of EMA (12) is bigger than (>) the value of EMA (23), then the line of the EMA (12) is above the line of the EMA (23).

12 bar EMA is above 23 bar EMA
12-bar EMA is bigger than 23-bar EMA

3. The 50-bar EMA crosses the channel's high upwards
Crossing upwards means that the previous position of the line of EMA (50) was under the channel's high, but the current position of the line of EMA (50) is above the line of the channel's high.
To create this crossover check, you have to change the 'Comparison' operator by clicking the arrow icon and choose 'crossover', then select the correct type of crossover, which is the arrow up cross up, since we're checking for a crossover upwards.

50 bar EMA crossover high channel
50-bar EMA crossover high channel

4. The price closes below the channel's high
To check if the price closes below the channel's high, you will need to compare the previous bar's Close price to the High channels' price. To do so, you have to enter Shift 1 on both sides of the condition, because a price closes on the previous bar, not on the current bar (Shift 0), which is still forming. We're also selecting Shift 1 for the High channel, because we will want to compare the Close price of the previous bar to the High channels' price of the same bar.

price closes below channel high
Close price bar below the high channel on the previous bar

We've now created the first signal. Now it's time to test the signal, so we're going to:

  1. Export the EA.
  2. Place the EA in the 'Experts' folder (which happens automatically on MT5 when clicking the downloaded file).
  3. Run the EA.
  4. Verify a Buy order was opened at the correct moment.

When verifying if the order was opened at the correct moment, always use a backtest in 'visual mode'. This is necessary, because when using conditions on the current bar (Shift 0), the bar is still forming, which means that if you are trying to verify the order's open moment at a later time (and thus the bar already being formed or having progressed further), the MA's line may have moved in the meanwhile. That's why you always need to pause the backtest the moment the order is opened.

Now that we've got the first Signal working, we'll also be creating the other signals:

Open Sell

close sell
The Open Sell signal

Close Buy

The Close Signals are slightly different to the open signals. The Close Signal consists out of 2 conditions of which either is true, which is why we're using the 'OR' operator, instead of the 'AND' operator. Also, we're using the Ask and Bid functions for the Close Signals for the first time. To access the Functions, use the arrow-icon to change to 'Functions' mode.

(Optional) You can copy/ paste signals or invert them, by using the menu icon to the right of the signal. Try it! It will speed up your EA building.

close buy
The Close Buy signal

Close Sell

close sell
The Close Sell signal

If you want to know more about Signals and what they're capable of, please check the in-dept Signals documentation.

You've now created the EA's Open- and Close signals, which means that your EA will already trade automatically. However, there's more. There are all kinds of ways to change the behaviour of your EA. These are the so called 'Modules' which we will also use for our EA.

Next: Part 4 : Modules.