Previous page: Part 1 : Get started.

Tutorial - Part 2: Indicators

Last update: 22 April 2023

Now we're going to add indicators to this EA.

Indicators supply the EA with the information it needs to make trading decisions, both for opening aan order and closing an order. Indicators are added to the EA by you, thereby creating a library (or a 'list') of information for your EA. This list of indicators is a centralized place of information which your EA will use. Once the EA uses these indicators for trading decisions and you edit an indicator, by changing the indicator's parameters, it will affect all of the EA's trading decisions which are referencing this indicator.

To add an indicator, click 'Add' on your indicators list.

click add indicator
Click the 'Add' button to add an indicator to your EA.

You're offered to choose from all standard MetaTrader indicators sorted by alphabet. If you have uploaded your own custom indicators these will also be available at the top of the list. The number and variety of indicators you can add is unlimited.

It's a common scenario that you'll want to use the same indicator multiple times, with different parameter values. To achieve this, you will add the indicator multiple times, with different values and a different name per indicator. For example, you can name one indicator 'EMA 5' and another indicator 'EMA 10'. Set the 'Period' parameters of the first indicator to the value 5 and the same parameters for the second indicator to value 10.

For our EA, we're going to add the "Moving Average" indicator. In fact, we will add this indicator 2 times. Do you remember our goal for your EA, stated in the beginning of this Tutorial? We're using 2 different variants of EMA.
Now, find the "Moving Average" indicator in the list:

add MA indicator
Add the standard "Moving Average" indicator from the list to this EA.

After selecting the indicator, you will see all the parameters of the indicator. You should be familiar with these parameters, because these are the same parameters as shown in MetaTrader when adding an indicator to the chart. The values you enter here will be the values your EA will use for this indicator, at every trading decision which is referencing this indicator.

enter indicator parameters
Enter the indicator's parameters.

This is how we've setup the indicators (parameters not mentioned keep their default value):

  • Moving average: Name '5 EMA', Timeframe 'PERIOD_H4', Period '5', Method 'EMA', Applied price 'Close'
  • Moving average: Name '10 EMA', Timeframe 'PERIOD_H4', Period '10', Method 'EMA', Applied price 'Close'
  • Stochastic Oscillator: Name 'Stochastic', Timeframe 'PERIOD_H4', K period '10', D period '3', Slowing '3', Method: SMA, Price field: Low/ High, Mode: Main
  • Relative Strength Index: Name 'RSI', Timeframe 'PERIOD_H4', Period: 9, Apply to: Close
  • MACD: Name 'MACD', Fast EMA: 12, Slow EMA: 26, SMA: 9, Applied price: Close, Mode: Main
  • Parabolic SAR: Name 'PSAR', Step: 0.02, Maximum: 0.2

After you've set up all indicators, you should have a list of indicators which looks like this:

list of indicators
All 6 indicators used by this EA.

We've now added all indicators and now we can move on to the next part.

Next: Part 3 : Signals.
Or if you want to use custom indicator(s) instead: Part 2(B) : Custom Indicators.