Mastering MA Trend 2: Your Go-To EA for MetaTrader 5

Mike 2025.04.04 19:53 21 0 0
Attachments

If you're diving into the world of automated trading, let me introduce you to the latest version of MA Trend. This Expert Advisor (EA) has taken strides with the addition of a new parameter: Type Trading restrictions.

Type Trading Restrictions

  • Only BUY - This option allows you to open only BUY positions.
  • Only SELL - Here, you can only open SELL positions.
  • BUY and SELL - This is the most flexible option, allowing both BUY and SELL positions.

MA Trend operates using the iMA (Moving Average) indicator and comes packed with various settings to tailor your trading experience:

Key Settings

  • Only One Position - Limits you to holding a single position in the market at any given time.
  • Reverse - This flips the trading signals if you want to go against the trend.
  • Close Opposite - This feature automatically closes any opposite positions when a new trading signal is generated.

How Trading Signals Are Formed

With default settings, trading signals are generated based on the following criteria:

If the current ASK price is higher than the indicator value on bar #1, it's a signal to open a BUY position.

If the current BID price is lower than the indicator value on bar #1, it's a signal to open a SELL position.

Behind the Scenes: MQL5 Code

Here's how this works in MQL5 code:

      if(m_symbol.Ask()>ma[1])
         m_need_open_buy=true;
      else if(m_symbol.Bid()<ma[1])
         m_need_open_sell=true;

Practical Example: Position Handling

Let’s look at how the Only One Position feature affects trade execution:

MA Trend Example 1

In this example, with Only One Position set to true, Reverse to false, and Close Opposite to true: a BUY position was opened. Later, when a signal for a SELL position came in, the EA first closed the BUY position (since it's the opposite) before opening the new SELL position.

MA Trend Example 2

With MA Trend, you can streamline your trading strategy and make more informed decisions. So why not give it a spin and see how it can enhance your trading game?

List
Comments 0