Skip to content

Use indicator in Trading Signal

The plans for finding modes helped you find your mode(s). Now use the indicator in your Buy and Sell signals. The procedure is the same for every type of indicator.

In short:

  • Check all modes you intend to use when you add the indicator: modes not selected are filtered out to prevent clutter.
  • Arrow: buy when the Up arrow mode is Not Equal to EMPTY.
  • Color: buy when the color mode has the value of green, for example Equal 1.
  • Line: buy when it crosses a level or another line, with Up Cross.
  • Use Shift 1 for a signal on the last closed bar.

Depending on the type of indicator, the signal is slightly different:

When you add the indicator to your EA, make sure all the modes you intend to use are checked. Each checked mode is an operand in the signal editor, as Name | Mode.

Modes (lines/arrows) with four checked modes: Mode 0 Low/High, Mode 1 High/Low, Mode 2 Open, Mode 3 CloseModes (lines/arrows) with four checked modes: Mode 0 Low/High, Mode 1 High/Low, Mode 2 Open, Mode 3 Close
All four modes of Heiken Ashi are selected to be used by this EA.
Operand picker on Indicator with the operands Heiken Ashi Close, High/Low, Low/High and OpenOperand picker on Indicator with the operands Heiken Ashi Close, High/Low, Low/High and Open
In the signal editor each selected mode is an operand: Heiken Ashi | Close, Heiken Ashi | High/Low, ...

How to set your signal for an arrow indicator

Section titled “How to set your signal for an arrow indicator”

Now that you’ve found your modes, renamed them and selected them when adding your indicator, create the condition(s) that make your EA open and close orders.

How arrows work:

  • MetaTrader paints an arrow on the chart when a mode gets a value. The arrow is placed at the value of this mode.
  • An Up arrow is often painted a little under the bar and a Down arrow a little above it. That’s why the value of the mode is always a bit above or below the price.
  • The value itself doesn’t matter: you only want to know if the arrow is painted. In other words: buy or sell when the mode has a value, meaning it’s not empty.

The Open Buy signal for an arrow indicator has 1 condition:

Up arrow | S1 Not Equal EMPTY (a Constant without a value): the last closed bar has an Up arrow.

Open Buy condition: half-trend-buy-sell-indicator, Arrow Up, S1, Not Equal, EMPTYOpen Buy condition: half-trend-buy-sell-indicator, Arrow Up, S1, Not Equal, EMPTY
The Open Buy signal of the template Half Trend Buy Sell Indicator MT4 EA: buy when the 'Arrow Up' mode is not equal to EMPTY.

Do the same for Open Sell, with the ‘Down arrow’ mode. Optionally, copy the Open Buy signal to Close Sell and the Open Sell signal to Close Buy (see Copy a signal). This way, the EA switches between buying and selling whenever the arrows change from buy to sell and vice versa.

Once you’re done, your first version of your EA is ready and you can export it. For a full tutorial, see how to run your first EA together.

How to set your signal for a color indicator

Section titled “How to set your signal for a color indicator”

When MetaTrader paints a line on the chart, you may be interested in the color of the line or in the change from one color to another. There are two cases:

  • 2 modes, one for each color (a Green and a Red mode): Open Buy when Green | S1 Not Equal EMPTY, the same as for arrows.
  • 1 mode with the color as a value (-1 is red, 1 is green, sometimes 0 is gray): Open Buy when Color | S1 Equal 1.

Which case you have, you found out in the plan for finding modes: compare what you see on the chart with the Data Window or the Buffer Reader export.

Open Buy conditions: zero-lag-moving-average, Color, S1, Equal, 1; and Ask Above zero-lag-moving-average, Value, S1Open Buy conditions: zero-lag-moving-average, Color, S1, Equal, 1; and Ask Above zero-lag-moving-average, Value, S1
The Open Buy signal of the template Zero Lag Moving Average Indicator MT4 EA: buy when the 'Color' mode is equal to 1, and Ask is above the line.

For Open Sell, select the same indicator mode, but check if the value is -1. Optionally, copy the Open Buy signal to Close Sell and the Open Sell signal to Close Buy, so the EA switches whenever the color changes from red to green and vice versa.

Once you’re done, your first version of your EA is ready and you can export it. For a full tutorial, see how to run your first EA together.

How to set your signal for a line crossing a level

Section titled “How to set your signal for a line crossing a level”

An oscillator such as RSI or Stochastic moves between fixed levels. A common signal is the moment the line crosses a level, for example RSI leaving the oversold zone:

RSI | S1 Up Cross 30: the RSI crossed above 30 on the last closed bar.

  • For Open Sell, use the opposite: RSI | S1 Down Cross 70.
  • Up Cross is true only on the bar of the cross. To buy as long as the line is above the level, use Above instead. See Operators.
  • Use a Constant with an Input Name for the level, so you can optimize it in MetaTrader.

How to set your signal for two crossing lines

Section titled “How to set your signal for two crossing lines”

A fast and a slow line crossing each other is a classic signal, for example two moving averages. Add the indicator twice, with different settings and names (MA 7 and MA 30), then:

MA 7 | S1 Up Cross MA 30 | S1: the fast average crossed above the slow one on the last closed bar.

  • For Open Sell: MA 7 | S1 Down Cross MA 30 | S1.
  • Indicators with two lines of their own, such as MACD (Main and Signal), work the same way: check both modes and compare them.

Using Shift when Adding Your Indicator to a Signal

Section titled “Using Shift when Adding Your Indicator to a Signal”

Every indicator in a condition has a Shift (Bar): Shift 0 is the indicator’s value on the current bar, Shift 1 on the previous bar, Shift 2 on the bar before the previous bar, and so forth.

  • Select the Shift of the bar at which you want to buy or sell.
  • To avoid buying on an arrow on the current bar, which can still disappear (repainting), use Shift 1.
  • Many arrow indicators don’t paint the current bar at all.

When our analyzer finds that a Shift never has a value, or may repaint, the picker shows a mark with a Use Shift N link. We strive for accuracy, but please do your own research: we can’t guarantee this informational warning at all times. Read more in Shift (Bar).

MetaTrader is a registered trademark of MetaQuotes Ltd. EA Builder Pro is not affiliated with MetaQuotes.