# Close & Modify Orders Guide

### 📋 Overview

RedFox Copier Pro provides powerful features to close and modify orders automatically or via Telegram commands. You can partially close positions at TP levels, move SL to breakeven, adjust TP levels, and close all orders with simple commands.

**Key Features:**

* Partial close at TP1/TP2 (scale out strategy)
* Move SL to breakeven/entry automatically
* Move SL/TP via Telegram commands
* Close individual or all orders
* Close by symbol, direction, or profit level

***

### 📉 Partial Close at TP Levels

#### **1. EnableCloseAtTP**

```
EnableCloseAtTP = true | false
```

**Controls whether EA partially closes orders when TP1/TP2 is hit.**

***

#### **false** (Default - Full Close)

**Behavior:** Orders close completely when TP is hit (standard MT4 behavior).

**Example:**

```
Order: EURUSD BUY 0.30 lot @ 1.0850
TP1: 1.0900 (50 pips)

Price reaches 1.0900:
→ Order closes completely (0.30 lot)
→ Profit: $150 (50 pips × 0.30 lot)
```

***

#### **true** (Partial Close - Recommended)

**Behavior:** Partially closes order at TP1/TP2, keeps remaining for higher TP levels.

**Example with 3 TP Levels:**

```
Signal: GBPUSD BUY
Entry: 1.2700
TP1: 1.2750 (50 pips)
TP2: 1.2800 (100 pips)
TP3: 1.2850 (150 pips)

EA Opens: 0.30 lot (calculated based on risk)

Price Action:
1. Price hits 1.2750 (TP1)
   → Close 33% (0.10 lot)
   → Remaining: 0.20 lot
   → Profit: $50

2. Price hits 1.2800 (TP2)
   → Close 33% of original (0.10 lot)
   → Remaining: 0.10 lot
   → Additional profit: $50

3. Price hits 1.2850 (TP3)
   → Close remaining (0.10 lot)
   → Additional profit: $50
   → Total Profit: $150
```

**Benefits:**

* ✅ Lock in profits progressively
* ✅ Reduce risk as trade moves in your favor
* ✅ Let runners capture larger moves
* ✅ Professional scaling out strategy

**When to use:**

* Multi-TP signals (TP1, TP2, TP3)
* Want to secure partial profits
* Trending markets (let winners run)

***

#### **2. ClosePercentAtTP1**

```
ClosePercentAtTP1 = 33  // Percentage to close at TP1 (0-100)
```

**Controls what percentage of position to close when TP1 is hit.**

**Examples:**

**Conservative (Close 50% at TP1):**

```
ClosePercentAtTP1 = 50

Order: 0.40 lot
TP1 Hit:
→ Close: 0.20 lot (50%)
→ Remaining: 0.20 lot
```

**Balanced (Close 33% at TP1):**

```
ClosePercentAtTP1 = 33

Order: 0.30 lot
TP1 Hit:
→ Close: 0.10 lot (33%)
→ Remaining: 0.20 lot
```

**Aggressive (Close 20% at TP1):**

```
ClosePercentAtTP1 = 20

Order: 0.50 lot
TP1 Hit:
→ Close: 0.10 lot (20%)
→ Remaining: 0.40 lot (80% for bigger move)
```

**Strategy Impact:**

| Close % | Remaining | Strategy                      |
| ------- | --------- | ----------------------------- |
| 100%    | 0%        | Full exit at TP1 (no runners) |
| 50%     | 50%       | Equal risk/reward approach    |
| 33%     | 67%       | Let most position run         |
| 25%     | 75%       | Aggressive runners strategy   |

***

#### **3. ClosePercentAtTP2**

```
ClosePercentAtTP2 = 33  // Percentage to close at TP2
```

**Controls what percentage to close when TP2 is hit.**

**Important:** This is percentage of **original order size**, not remaining.

**Example:**

```
Original Order: 0.90 lot
ClosePercentAtTP1 = 33
ClosePercentAtTP2 = 33

TP1 Hit:
→ Close: 0.30 lot (33% of 0.90)
→ Remaining: 0.60 lot

TP2 Hit:
→ Close: 0.30 lot (33% of original 0.90)
→ Remaining: 0.30 lot (33% for TP3)

TP3 Hit:
→ Close: 0.30 lot (remaining)
→ Total closed: 100%
```

**Configuration Examples:**

**Equal Distribution (33/33/33):**

```
ClosePercentAtTP1 = 33
ClosePercentAtTP2 = 33
// Remaining for TP3: 34%
```

**Early Exit Focus (50/30/20):**

```
ClosePercentAtTP1 = 50
ClosePercentAtTP2 = 30
// Remaining for TP3: 20%
```

**Runner Focus (20/30/50):**

```
ClosePercentAtTP1 = 20
ClosePercentAtTP2 = 30
// Remaining for TP3: 50%
```

***

### 🎯 Move SL to Breakeven

#### **4. MoveSLToEntry**

```
MoveSLToEntry = true | false
```

**Controls whether EA automatically moves SL to entry price when TP1 is hit.**

***

#### **true** (Auto Move SL - Recommended)

**Behavior:** When TP1 is hit, SL is moved to entry price (breakeven + spread).

**Example:**

```
Order: EURUSD BUY @ 1.0850
SL: 1.0800 (-50 pips)
TP1: 1.0900 (+50 pips)

Price hits 1.0900 (TP1):
1. Close 33% of position (partial close)
2. Move SL: 1.0800 → 1.0850 (entry price)
→ Trade now risk-free!
```

**Benefits:**

* ✅ Risk-free trade after TP1
* ✅ Can't lose money on runners
* ✅ Psychological comfort
* ✅ Protect initial profit

**When to use:**

* Always recommended for risk management
* Especially in volatile markets
* When holding runners overnight

**Important:** EA adds spread to breakeven level to account for broker costs:

```
BUY: Breakeven = Entry + Spread
SELL: Breakeven = Entry - Spread
```

***

#### **false** (Keep Original SL)

**Behavior:** SL stays at original level even after TP1 is hit.

**Example:**

```
Order: GBPUSD SELL @ 1.2700
SL: 1.2750 (+50 pips)
TP1: 1.2650 (-50 pips)

Price hits 1.2650 (TP1):
→ Close 33%
→ SL remains at 1.2750 (original)
→ Risk still exists on remaining position
```

**When to use:**

* Wide SL that serves as true invalidation level
* Don't want tight SL after TP1
* Advanced strategy with specific SL logic

***

### 🔧 Modify Orders via Telegram

#### **5. Move SL Commands**

EA recognizes these commands in Telegram:

```
"move sl entry"
"move sl to"
"move sl to entry"
"move stop loss to entry"
```

***

#### **Move SL to Entry (Breakeven)**

**Telegram Command:**

```
move sl entry EURUSD
```

**EA Action:**

```
Finds all EURUSD orders
→ Moves SL to entry price + spread
→ Confirms via Telegram: "✅ Moved SL to entry for 3 EURUSD orders"
```

**Example:**

```
Current Orders:
- EURUSD BUY @ 1.0850, SL: 1.0800
- EURUSD BUY @ 1.0860, SL: 1.0810

Command: move sl entry EURUSD

Result:
- EURUSD BUY @ 1.0850, SL: 1.0850 ✅
- EURUSD BUY @ 1.0860, SL: 1.0860 ✅
```

***

#### **Move SL to Specific Price**

**Telegram Command:**

```
move sl to 1.0870 EURUSD
```

**EA Action:**

```
Finds all EURUSD orders
→ Moves SL to 1.0870
→ Confirms: "✅ Moved SL to 1.0870 for 2 EURUSD orders"
```

**Example:**

```
Current: GBPUSD SELL @ 1.2700, SL: 1.2750
Command: move sl to 1.2680 GBPUSD
Result: GBPUSD SELL @ 1.2700, SL: 1.2680 ✅
```

**Validation:**

* BUY orders: New SL must be below entry
* SELL orders: New SL must be above entry
* If invalid: EA sends error message

***

#### **6. Move TP Commands**

```
"move tp"
"move take profit"
```

**Telegram Command:**

```
move tp 1.0920 EURUSD
```

**EA Action:**

```
Finds all EURUSD orders
→ Moves TP to 1.0920
→ Confirms: "✅ Moved TP to 1.0920 for 3 EURUSD orders"
```

**Example:**

```
Current: XAUUSD BUY @ 2650, TP: 2700
Command: move tp 2720 XAUUSD
Result: XAUUSD BUY @ 2650, TP: 2720 ✅ (extended target)
```

***

### ❌ Close Orders via Telegram

#### **7. Close All Orders**

**Telegram Command:**

```
close
close all
```

**EA Action:**

```
Closes ALL open orders immediately
→ Confirms: "✅ Closed 12 orders. Total profit: $245.50"
```

**When to use:**

* Emergency exit (major news event)
* End of trading day
* Account protection
* System maintenance

***

#### **8. Close Orders by Symbol**

**Telegram Command:**

```
close EURUSD
close XAUUSD
```

**EA Action:**

```
Closes all orders on specified symbol (both BUY and SELL)
→ Confirms: "✅ Closed 3 EURUSD orders. Profit: $85.20"
```

**Example:**

```
Current Orders:
- EURUSD BUY (2 orders)
- EURUSD SELL (1 order)
- GBPUSD BUY (2 orders)

Command: close EURUSD

Result:
→ 3 EURUSD orders closed ✅
→ 2 GBPUSD orders remain open
```

***

#### **9. Close Orders by Direction**

**Telegram Command:**

```
close buy
close sell
close buy EURUSD
close sell GBPUSD
```

**EA Action:**

```
Closes all BUY or SELL orders (optionally filtered by symbol)
```

**Examples:**

**Close all BUY orders:**

```
Command: close buy
Result: Closes all BUY orders on all symbols
```

**Close SELL orders on specific symbol:**

```
Command: close sell XAUUSD
Result: Closes only SELL orders on XAUUSD
```

***

#### **10. Close Profitable Orders**

**Telegram Command:**

```
close profit
close profit EURUSD
```

**EA Action:**

```
Closes all orders in profit (optionally by symbol)
→ Confirms: "✅ Closed 5 profitable orders. Total profit: $312.40"
```

**When to use:**

* Lock in profits before weekend
* News event approaching
* Hit daily profit target

***

#### **11. Close Loss Orders**

**Telegram Command:**

```
close loss
close loss GBPUSD
```

**EA Action:**

```
Closes all orders in loss (optionally by symbol)
→ Confirms: "✅ Closed 3 loss orders. Total loss: -$95.30"
```

**When to use:**

* Cut losses during adverse market move
* Clear losing trades to refocus
* Emergency risk reduction

***

### 💼 Real-World Scenarios

#### **Scenario 1: Scale Out Strategy**

**Configuration:**

```
EnableCloseAtTP = true
ClosePercentAtTP1 = 50
ClosePercentAtTP2 = 50
MoveSLToEntry = true
Number_TP_Level = 2
```

**Trade Example:**

```
Signal: EURUSD BUY @ 1.0850
TP1: 1.0900 (50 pips)
TP2: 1.0950 (100 pips)
Lot: 0.40

Timeline:
1. Entry @ 1.0850
   Open: 0.40 lot, SL: 1.0800

2. Price hits 1.0900 (TP1)
   → Close 50% (0.20 lot)
   → Remaining: 0.20 lot
   → Move SL: 1.0800 → 1.0850 (breakeven)
   → Profit locked: $100, Risk: $0

3. Price hits 1.0950 (TP2)
   → Close remaining (0.20 lot)
   → Additional profit: $100
   → Total profit: $200
```

**Result:** Professional risk-free scaling out.

***

#### **Scenario 2: Emergency Exit Before News**

**Situation:** NFP news in 5 minutes, want to close all.

**Action:**

```
Telegram Command: close all
```

**EA Response:**

```
✅ Closed 15 orders
Total profit: $320.50
Orders remaining: 0
```

***

#### **Scenario 3: Gold Reversal**

**Situation:** XAUUSD BUY orders in profit, chart shows reversal pattern.

**Action:**

```
Telegram Command: close profit XAUUSD
```

**EA Response:**

```
✅ Closed 3 profitable XAUUSD orders
Total profit: $245.80
```

***

#### **Scenario 4: Cut EUR Losses**

**Situation:** EUR news negative, all EUR pairs losing.

**Action:**

```
Telegram Command: close loss EUR
```

**EA Response:**

```
✅ Closed loss orders on EUR pairs
EURUSD: 2 orders (-$45.20)
EURGBP: 1 order (-$12.30)
Total loss: -$57.50
```

***

#### **Scenario 5: Protect Runners**

**Situation:** TP1 hit manually, want to move SL to breakeven.

**Action:**

```
Telegram Command: move sl entry GBPUSD
```

**EA Response:**

```
✅ Moved SL to entry for 2 GBPUSD orders
GBPUSD BUY @ 1.2700: SL moved 1.2650 → 1.2700
GBPUSD BUY @ 1.2710: SL moved 1.2660 → 1.2710
Trades now risk-free!
```

***

### ⚠️ Common Mistakes

#### ❌ **Mistake 1: Close Percentages Don't Add Up**

**Bad:**

```
ClosePercentAtTP1 = 50
ClosePercentAtTP2 = 60
// Total: 110% (more than 100%!)
```

**Good:**

```
ClosePercentAtTP1 = 33
ClosePercentAtTP2 = 33
// Remaining: 34% for TP3
```

***

#### ❌ **Mistake 2: Partial Close Without Multiple TPs**

**Bad:**

```
EnableCloseAtTP = true
Number_TP_Level = 1  // Only 1 TP!
// Result: Partial close happens, but no TP2/TP3 to reach
```

**Good:**

```
EnableCloseAtTP = true
Number_TP_Level = 2 or 3
```

***

#### ❌ **Mistake 3: Forget to Enable MoveSLToEntry**

**Bad:**

```
EnableCloseAtTP = true
MoveSLToEntry = false
// Result: Partial profit taken, but full risk remains!
```

**Good:**

```
EnableCloseAtTP = true
MoveSLToEntry = true  // Risk-free after TP1
```

***

#### ❌ **Mistake 4: Wrong Close Command**

**Bad:**

```
Command: close EURUSD buy
// Wrong syntax!
```

**Good:**

```
Command: close buy EURUSD
// Correct: action first, symbol last
```

***

### ✅ Best Practices

#### ✅ **1. Always Enable MoveSLToEntry**

```
MoveSLToEntry = true
```

Reason: Free insurance! No downside to risk-free trades.

***

#### ✅ **2. Match Close Percentages to TP Count**

**For 2 TP levels:**

```
ClosePercentAtTP1 = 50
// Remaining 50% for TP2
```

**For 3 TP levels:**

```
ClosePercentAtTP1 = 33
ClosePercentAtTP2 = 33
// Remaining 34% for TP3
```

***

#### ✅ **3. Test Partial Close Logic**

* Open test order with 0.30 lot, 3 TPs
* Verify close amounts at each TP
* Check SL moves to breakeven
* Confirm calculations correct

***

#### ✅ **4. Use Telegram Commands Actively**

Don't just set-and-forget:

* Move SL when profit grows
* Close before major news
* Adjust TP based on chart patterns
* Active management = better results

***

#### ✅ **5. Document Your Strategy**

```
Scaling Out Strategy Notes:
Date: 2024-10-28
EnableCloseAtTP: true
TP1: Close 33% + Move SL to entry
TP2: Close 33%
TP3: Close remaining 34%
Reason: Balance profit taking and runners
Review Date: 2024-11-15
```

***

### 📊 Partial Close Examples by Strategy

#### **Conservative (Secure Profits Early)**

```
ClosePercentAtTP1 = 60
ClosePercentAtTP2 = 40
MoveSLToEntry = true
```

**Result:** Most profit secured at TP1, small runner.

***

#### **Balanced (Equal Distribution)**

```
ClosePercentAtTP1 = 33
ClosePercentAtTP2 = 33
MoveSLToEntry = true
```

**Result:** Equal profit at each level, smooth scaling.

***

#### **Aggressive (Let It Run)**

```
ClosePercentAtTP1 = 20
ClosePercentAtTP2 = 30
MoveSLToEntry = true
```

**Result:** 50% stays for TP3, maximum runner potential.

***

### 🔍 EA Logging Examples

**Partial Close at TP1:**

```
========== PARTIAL CLOSE AT TP1 ==========
Order: #12345678
Symbol: EURUSD BUY
Original Lot: 0.30
Close Percent: 33%
Closed: 0.10 lot
Remaining: 0.20 lot
Profit: $50.00
SL Moved: 1.0800 → 1.0850 (breakeven)
==========================================
```

**Move SL Command:**

```
📩 TELEGRAM COMMAND RECEIVED
User: @YourUsername
Command: move sl entry GBPUSD
Action: Moving SL to entry for GBPUSD orders...
✅ SUCCESS: 2 orders updated
- #12345678: SL 1.2650 → 1.2700
- #12345679: SL 1.2660 → 1.2710
```

**Close Command:**

```
📩 TELEGRAM COMMAND RECEIVED
User: @YourUsername
Command: close profit
Action: Closing all profitable orders...
✅ SUCCESS: 8 orders closed
Total Profit: $432.50
Remaining Orders: 4 (in loss)
```

***

### 🚀 Quick Start Guide

#### **Step 1: Configure Partial Close**

```
EnableCloseAtTP = true
ClosePercentAtTP1 = 33
ClosePercentAtTP2 = 33
MoveSLToEntry = true
Number_TP_Level = 3
```

#### **Step 2: Test on Demo**

* Open multi-TP order
* Wait for TP1 hit
* Verify:
  * Partial close correct amount
  * SL moved to entry
  * Remaining orders have higher TPs

#### **Step 3: Learn Telegram Commands**

Practice on demo:

```
close EURUSD
move sl entry GBPUSD
close profit
close buy
```

#### **Step 4: Use in Live Trading**

* Monitor TP1 hits
* Manually move SL if needed
* Close before major events
* Adjust TPs based on market

***

### 📞 FAQ

**Q: Can I disable partial close for specific signals?** A: Not directly. Disable `EnableCloseAtTP` to turn off for all, or close manually via Telegram.

**Q: What if I close order manually before TP1?** A: EA respects your manual close. Partial close only triggers if order still open when TP1 is hit.

**Q: SL not moving to breakeven?** A: Check `MoveSLToEntry = true` and verify TP1 was actually hit (check logs).

**Q: Can I move SL beyond entry (to profit)?** A: Yes! Command: `move sl to 1.0900 EURUSD` (any valid price).

**Q: Close commands not working?** A: Verify Telegram connection, check logs for command recognition, ensure correct syntax.

***

**Remember:** Professional traders scale out of winners and actively manage positions. Use these tools! 📈


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://copier-docs.redfox-capital.com/config/close-and-modify-orders-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
