Can trades be closed automatically after a fixed time?

Yes — in MagicTradeBot, trades can be closed automatically after a fixed duration using the Maximum Hold Time settings. This applies to both long and short trades.


🧠 How Automatic Time-Based Closures Work

  1. Trade Timer Starts at Entry

    • When a trade is opened, the bot starts tracking how long the position has been active
  2. Maximum Hold Time Threshold

    • Defined separately for long and short trades:

      MaximumBuyHoldTime: 380   # in minutes for long trades
      MaximumSellHoldTime: 380  # in minutes for short trades
      
    • Once the elapsed time reaches the configured maximum, the bot closes the trade automatically
  3. Smart TP Interaction

    • If Smart TP Lock is enabled and profit has been locked:

      • Maximum Hold Time is ignored
      • Trade remains open to maximize gains
    • If Smart TP is not active or no profit is locked:

      • Trade will close 100% automatically once the hold time threshold is met

🔄 Example Scenarios

Long Trade

  • MaximumBuyHoldTime = 380 minutes
  • Trade opens at $10,000
  • Price has not hit Take Profit or Smart TP conditions
  • After 380 minutes → Bot automatically closes the trade

Short Trade

  • MaximumSellHoldTime = 380 minutes
  • Trade opens at $10,000
  • Price has not reached target exit
  • After 380 minutes → Bot automatically closes the trade

📌 Why This Feature Is Important

Automatic time-based closures ensure:

  • Risk control: No trade stays open indefinitely
  • Capital efficiency: Freed balance can be used for new opportunities
  • Discipline: Prevents trades from running too long due to market stagnation
  • Consistency: Works even if you are away from the system

🎯 Key Takeaways

  • Trades can be automatically closed after a fixed time using Maximum Hold Time
  • Applies to long and short trades independently
  • Smart TP Lock overrides automatic closure if profits are secured
  • Guarantees 100% enforcement of exit rules when the threshold is met

📎 Related Topics