1. **Initial conditions:** Trade opens in Sell position at 3033

- **Symbol:** Gold (XAUUSD)

- **Current price:** 3033

- **Lot size:** 0.01

- **Take Profit (TP):** 3032

- **Stop Loss (SL):** 3034

- **Order closing price:** 3034 (for example, the order is closed due to reaching the stop loss).
## **What the EA should do:**

1. **On closed order:**

- The EA detects that the order is closed at the price of 3034 (Stop Loss).

2. **Check current price:**

- The EA checks the current price of gold after closing the order. For example, the current price is now 3034.

3. **Decision to open a new pending order:**

- Since the current price (3034) is **higher** than the price of the closed order (3033), the EA should open a **Sell Stop** pending order.

4. **Setting parameters for the new pending order:**

- **Lot size:** 0.01 (same as the previous order).** sets the buy rate at the price of 3033

- **Take Profit (TP):** 3032

- **Stop Loss (SL):** 3034