Back to contents

Magic Entry · MT5 trade manager

Drawdown protection in MT5: PNL GUARD in Magic Entry

GUARD opens the protection window, where you set a drawdown threshold in money or in percent of the balance. When the loss reaches it, Magic Entry closes the positions and locks the trading controls for the minutes you set, 5 by default. Ticker counts only this chart’s symbol, Acc the whole account; Current tracks open positions, Daily the trading day including closed trades.

GUARD

PNL Guard: drawdown protection

GUARD opens the protection window. You set a drawdown threshold in money or percent. If the loss reaches it, the advisor closes the positions and locks trading controls for a while.

  • Ticker counts only this chart's positions, Acc counts the whole account.
  • Current tracks open positions, Daily tracks the trading day's result including closed trades.
  • Once triggered, controls stay locked for a set number of minutes, 5 by default.
  • The button is enabled in the advisor settings and works when at least one position is open.

How to set up PNL GUARD

  1. In the Inputs tab (F7), turn on Show GUARD button; set the lock time in Minutes wait after DrawDown activation and, for Daily mode, the day start hour in broker time.
  2. With at least one position open, click GUARD to the right of the entry panel.
  3. Choose Ticker or Acc, Current or Daily, and set the threshold in $ or %.
  4. Turn protection on. After it triggers and the lock ends, protection must be turned on again.

Example: a 3% daily limit on a $10,000 account

With Acc, Daily and a 3% threshold, the limit is $300 for the trading day, counted from the day start hour. If closed trades today lost $200 and open positions show −$100, the total reaches $300.

At that moment Magic Entry closes the positions, the panels turn semi-transparent, the buttons stop responding and the chart shows “Guard locked” until the lock time ends.

  • In Daily mode, positions opened before the day start are counted from their price at the start of the day.
  • If you hide the GUARD button, protection that is already on keeps working.

Advisor inputs for this function

Set on the Inputs tab (F7) when you attach Magic Entry to a chart. Captions and defaults are the advisor’s own.

  • Show GUARD buttonSHOW_BTN_GUARDDefault: OFF

    Shows the GUARD group to the right of the entry panel, mirroring DEFAULTS. It appears only while there are open positions. The menu sets a drawdown limit in $ or in % of balance: Current — for open positions, Daily — for the trading day; Acc — the whole account, Ticker — this symbol only.

    • When drawdown hits the limit, Magic closes the positions, turns protection off and locks trading for the time set in the next parameter.
    • If you hide the button, protection that was already on keeps working — you just don't see it.
    Show GUARD button

    ON: the GUARD group sits to the right of the entry panel while there are open positions.

  • Minutes wait after DrawDown activationGUARD_WAIT_MINUTESDefault: 5

    How many minutes Magic stays locked after protection triggers: all panels turn semi-transparent, buttons don't respond, and the chart shows "Guard locked". When time is up, the lock lifts by itself, but protection has to be turned on again.

  • Day Start hour (BrokerTime) for Daily modeGUARD_DAY_START_HOURDefault: 0

    Trading day start hour in broker server time, 0 to 23. In Daily mode drawdown is counted from this hour: closed trades plus open positions, with positions opened earlier counted from the price at the start of the day. Not used in Current mode.

Other Magic Entry functions