Loss Add-On (Martingale)

See the "Loss Add-On" section under [Market Price Add-On] below for detailed explanations. This EA can be used alongside other EAs. For example, in MT4, open two EURUSD charts: load an EA for placing orders on one chart and this EA on the other. When the order-placing EA’s orders reach the loss threshold for adding positions, this EA executes the loss add-on (Martingale) operation.

The "Order Magic Number" parameter of this EA defaults to 0, meaning it applies add-on operations to all orders for the symbol. If a number greater than 0 is entered, the EA will only add to orders placed by an EA with the same "Order Magic Number." For adding to manually placed orders, keep the "Order Magic Number" parameter at its default value of 0.

Terminology

Order Magic Number: When multiple order-placing EAs are loaded for the same symbol, each EA must have a unique number in its "Order Magic Number" parameter to distinguish its orders. This prevents logical errors by allowing EAs to identify and manage their respective orders.

Points: 1 point corresponds to the last decimal place of the symbol's price. For a 5-decimal price, 1 point is 0.00001; for a 4-decimal price, 1 point is 0.0001.

Multiplicative Add-On:

  • Parameters: Parameter A [Interval Points], Parameter B [Lot Size Multiplier], Parameter C [Number of Add-On Orders]
  • Function:
    • Loss Add-On (Counter-Trend, Martingale):
      • When the symbol’s ASK price falls below the lowest entry price of open BUY orders by more than the points specified in Parameter A, the EA immediately places a BUY order.
      • When the symbol’s BID price rises above the highest entry price of open SELL orders by more than the points specified in Parameter A, the EA immediately places a SELL order.
    • Profit Add-On (Trend-Following):
      • When the symbol’s ASK price rises above the highest entry price of open BUY orders by more than the points specified in Parameter A, the EA immediately places a BUY order.
      • When the symbol’s BID price falls below the lowest entry price of open SELL orders by more than the points specified in Parameter A, the EA immediately places a SELL order.
    • The lot size of the add-on order is calculated as the "previous order’s lot size" multiplied by Parameter B. No further add-ons are placed once the number of add-on orders reaches Parameter C.
  • Note: When the "Order Magic Number" parameter is 0, this function considers all open orders for the symbol. If a number greater than 0 is entered, it only considers orders with the same "Order Magic Number." If no orders with the specified "Order Magic Number" exist, no add-on operations are performed.