In MagicTradeBot, when multiple Take Profit rules are defined for a trade, the bot executes them based on the profit percentage targets (TargetProfitPer). This ensures that profits are taken in a logical and sequential order as the market moves in your favor.
🧠 Priority Mechanism
Profit Percentage First
- Rules with lower
TargetProfitPerare evaluated and executed before higher ones. Example: If you have rules set for 10% and 20% profit:
- TargetProfitPer: 10 SellPer: 40 RuleName: "Target - Short" IsEnabled: true EnableSmartTP: true TrailingGapPer: 2 MinProfitLock: 4 UseDynamicGap: true - TargetProfitPer: 20 SellPer: 100 RuleName: "Target - Short" IsEnabled: true EnableSmartTP: true TrailingGapPer: 2 MinProfitLock: 4 UseDynamicGap: true- The 10% TP rule triggers first, selling 40% of the position.
- The 20% TP rule triggers next, closing the remaining 60% of the position.
- Rules with lower
Sequential Execution
- Each rule is evaluated independently, but in ascending order of
TargetProfitPer - This allows staggered profit-taking, which is especially useful in volatile markets
- Each rule is evaluated independently, but in ascending order of
Partial vs Full Take Profit
- Rules with partial TP (
SellPer < 100) execute first, gradually reducing position size - Rules with full TP (
SellPer = 100) close the remaining position once higher profit targets are reached
- Rules with partial TP (
Smart TP Integration
If Smart TP is enabled:
- Trailing logic is applied after the target profit is reached
- The bot may delay execution until the trailing gap or minimum profit lock conditions are met
🔄 Example Flow
- Open trade: 1 BTC
Take Profit rules:
TargetProfitPer: 10,SellPer: 40TargetProfitPer: 20,SellPer: 100
Scenario:
- Price rises +10% → Bot sells 0.4 BTC (40%)
- Price continues to +20% → Bot sells remaining 0.6 BTC (100% of remaining)
- Smart TP active → If price pulls back slightly, trailing logic may execute before final closure
This ensures profits are secured incrementally, while still allowing upside potential for remaining positions.
📌 Key Points
- Rules are prioritized by TargetProfitPer (lowest → highest)
- Partial TP rules execute first, followed by higher targets or full TP
- Smart TP can adjust exact execution timing dynamically
- Sequential prioritization ensures structured and disciplined profit-taking