Docs Download
Home / Docs / What happens if both stop-loss and take-profit conditions are met?

What happens if both stop-loss and take-profit conditions are met?

In MagicTradeBot, it’s rare but possible that both stop-loss (SL) and take-profit (TP) conditions may trigger simultaneously. The bot has a defined priority to handle this situation safely.


🧠 Behavior Overview

  1. Stop-Loss Priority

    • If both SL and TP conditions are met at the same moment, stop-loss takes priority in the decision engine.
    • This ensures that risk protection is always enforced first, minimizing potential losses.
  2. Quantity Handling Difference

    • Stop-Loss: Always closes 100% of the position
    • Take-Profit: Can close partial quantities based on SellPer in TakeProfitRules
    • This means that even if TP would have sold only a portion, SL will override and exit the full position
  3. Trade Result Impact

    • The result of the trade is the same as a normal SL exit, except that any potential partial TP gains are included if the price reached the TP level before triggering SL
    • Bot ensures that trade closes safely and avoids conflicts between rules

πŸ”„ Example Scenario

TakeProfitRules:
  - TargetProfitPer: 5
    SellPer: 50
    EnableSmartTP: true

ThresholdRules:
  - Minutes: 10
    ThresholdPer: -3
    CloseIfLoss: true
  • Trade moves in your favor β†’ hits 5% TP β†’ partial sell for 50%
  • Market quickly reverses β†’ hits -3% SL for remaining 50%
  • Bot closes remaining position completely, respecting stop-loss priority

πŸ“Œ Key Points

  • Extremely rare: TP and SL rarely trigger at the same exact time due to price tick movement
  • Stop-loss always prioritizes: Full protection against extreme losses
  • Partial TP still executes first if it triggers before SL, so profits are not entirely lost
  • Works seamlessly with Smart TP, DCA, and dynamic SL

In short, stop-loss ensures safety first, while take-profit rules maximize gains when conditions allow, giving the bot intelligent trade exit handling even in extreme scenarios.

Ready to trade? Download MagicTradeBot free and test in paper mode before going live.