MAXD Documentation

MAXD is an Expert Advisor (EA) that utilizes the Moving Average (MA) and MACD indicators to implement a trading strategy. The default settings are optimized for the XAUUSD asset on the M15 time frame. Be sure to adjust the parameters to suit the chosen asset and perform a backtest before running the EA.


Money Management

General

  • Initial Lot

The lot size for a standard trading position.

  • SL/TP

Specifies Stop Loss and Take Profit in points. These are mandatory settings in this EA.

  • Number of Positions per Day

Limits the number of positions the EA can open in a single day. If set to 0, there is no limit.

  • Multiple Position

If set to "true", the EA can open multiple positions simultaneously. If set to "false", only one position will be open at a time.

  •  Magic Number

A unique identifier used to differentiate trading positions across different EA instances and/or for other purposes. 

 

Capital Growth

The lot size for regular trades will increase as the account balance grows.

  • Allow Capital Growth
      • "true": Enables this feature, allowing lot size to grow with capital.
      • "false": Disables capital growth; lot size remains the same as the initial lot size.

  •  Initial Capital

Refers to the starting balance when the EA is launched. If capital grows beyond a specified threshold, the lot size will increase accordingly. If set to 0, the EA will use the current account balance as the initial capital.

Example 1: 

If the initial capital is set to 500 USD and the balance is 2000 USD with an initial lot of 0.01, the new lot size will be 0.04, adjusted to the current balance.

Example 2: 

If the initial capital is set to 0 and the balance is 2000 USD, the initial lot size of 0.01 will remain unchanged.

  • Target Growth

Specifies the growth target. Once this target is reached, the EA will stop trading. If set to 0, there is no limit on the growth. 


Signal

This section defines the trading strategy, including Buy and Sell signals. Each signal is triggered by specific factors.

Buy Signal

  • Enable Buy Signal

If set to "true", the EA is allowed to open buy orders. If "false", no buy orders will be created.

Sell Signal

  • Enable Buy Signal

If set to "true", the EA is allowed to open sell orders. If "false", no sell orders will be created.

Signal Factor

Factors contributing to Buy and Sell signals. If a factor is disabled, the EA will ignore it.

  • Price and MA

The relationship between the price (or bar/candle) and the Moving Average (MA) is defined as follows:

      • Bar above MA
      • Bar below MA
      • Bar crossing above MA
      • Bar crossing below MA

  • MACD and Signal

Describes the behavior of the MACD in relation to its signal line:

      • MACD above signal
      • MACD below signal
      • MACD crossing above signal
      • MACD crossing below signal

  • MACD Value

The behavior of the MACD in relation to a specific value:

      • Greater than a defined value
      • Less than a defined value

  • Value

The reference value against which the MACD is compared.


Trailing Stop

This feature automatically adjusts the stop loss of an open position based on market movements, allowing profits to be secured as the price moves in the desired direction. The Trailing Stop in this EA includes the following parameters:

  • Trailing Step (points)
Defines the minimum distance in points required before the stop loss is adjusted again.
  • Initial Profit (points)
Specifies the minimum profit needed before the Trailing Stop is activated.

  • Keep Profit

      • true: Retains the Take Profit (TP) level while the Trailing Stop is active.
      • false: Discards the TP when using the Trailing Stop. This option is suitable for trending markets.

Martingale

The Martingale strategy involves increasing lot size after a loss to recover previous losses and earn a profit.

  • Martingale Level

Defines the number of levels for the Martingale strategy. Level 0 represents normal trading positions. If a trade is lost (negative profit), the EA will increase the level, thus increasing the lot size for subsequent positions until a profit is achieved or the maximum level is reached. If a trade ends in profit or the maximum level is hit, the Martingale level is reset to 0. To disable Martingale, set this value to 0.

  • Profit Type

There are two options for profit calculation:

      • Fixed: A constant profit amount in the account's currency.
      • Exponential: Profit increases based on the lot size multiplier.
  • Fixed Profit (For Fixed Profit Type)

Example

If Fixed Profit is set to 10 units and the previous position lost 20 units, the next trade will aim to generate 30 units (20 to cover the loss + 10 for profit).

  • Lot Multiplier (For Exponential Profit Type)

Example

If the multiplier is set to 2 and the last lost trade had a lot size of 0.2, the next position will use a lot size of 0.4 (0.2 * 2).

  • Martingale Mode
      • Next Signal: Martingale will apply to the next signal after a loss.
      • Instant: The EA will open the next position with the Martingale lot size immediately when the price hits the Stop Loss.
  • Martingale Order Type (For Instant Mode)

There are four options for order types in Instant mode:

      • Same order type: The next trade will be the same as the last (buy if the last was buy, sell if the last was sell).
      • Opposite order type: The next trade will be the opposite (buy if the last was sell, and vice versa).
      • Buy only: Only buy orders are placed if the last was buy.
      • Sell only: Only sell orders are placed if the last was sell.

Indicator

This section outlines settings for the MA and MACD indicators.

  • MA (Moving Average)

Configurable parameters for the MA:

      • Period 
      • Method 
  • MACD

Configurable parameters for the MACD:

      • Fast EMA
      • Slow EMA
      • MACD SMA 

 

Other

  • Buffer Period

Specifies the number of bars (or candles) copied from indicators for analysis.

  • Signal Index

Defines the bar or candle to analyze. Index 0 represents the current bar, index 1 is the previous bar, and so on. When a new bar forms, the EA evaluates all factors except the ones set to "Disable."

  • Show Log Messages
      • true: Log messages generated by this EA will be displayed in the "Experts" tab.
      • false: Log messages generated by this EA will be hidden


Trading Time

Specifies the time (server time) during which the EA is allowed to create orders. This includes parameters for the start time, end time, and the specific days of the week.



Update Log

Ver. 1.1 (27-Sep-2024)

  • Fixed a bug preventing the EA from opening a position when there were existing open positions on other assets while "Multiple Positions" was set to "false."
  • Added Magic Number functionality.
  • Added Show log message functionality.
  • Introduced Trailing Stop feature.

Comments