What does EmergencyCloseMinHoldTime do?

EmergencyCloseMinHoldTime defines the minimum amount of time (in minutes) a trade must remain open before it becomes eligible for an emergency close.

It prevents emergency closures from happening immediately after a trade is opened.

Example:

EmergencyCloseMinHoldTime: 20

This means:

  • A trade must be open for at least 20 minutes
  • Before the emergency close logic is allowed to close it

๐Ÿ›ก๏ธ Why Is This Important?

Right after a trade is opened, the market often experiences:

  • Spread widening
  • Initial volatility spikes
  • Minor pullbacks
  • Entry noise

If emergency close were allowed instantly:

  • Many valid trades would be closed too early
  • You would exit before the setup plays out
  • Win rate could drop significantly

This setting protects new trades from premature panic exits.


โš™๏ธ How It Works

When an emergency condition is detected:

  1. Trades are flagged with emergency_close = true

  2. The Decision Making Brain checks trade age

  3. If:

    trade_age >= EmergencyCloseMinHoldTime
    

    โ†’ Trade becomes eligible for closing

  4. If trade age is less than the configured time โ†’ The emergency close is ignored temporarily


๐Ÿ“Š Example Scenario

You enter a Long trade.

5 minutes later:

  • Market dips sharply
  • Emergency threshold is triggered

If:

EmergencyCloseMinHoldTime: 20

The trade will NOT close because:

  • It has not yet reached 20 minutes of age

This gives the trade time to stabilize instead of reacting to short-term noise.


๐ŸŽฏ When to Use Higher vs Lower Values

๐Ÿ”น Lower Value (0โ€“5 minutes)

  • Faster reaction
  • Higher protection
  • Suitable for scalping
  • More sensitive

๐Ÿ”น Medium Value (10โ€“20 minutes)

  • Balanced protection
  • Avoids entry noise
  • Good for intraday trading

๐Ÿ”น Higher Value (30+ minutes)

  • Allows trades to fully develop
  • Less sensitive to early volatility
  • Better for swing strategies

โš ๏ธ Special Case: Value = 0

If:

EmergencyCloseMinHoldTime: 0

Emergency closes can happen immediately after entry.

This is more aggressive and should only be used if:

  • You want maximum protection
  • You accept potential early exits

๐Ÿš€ Summary

EmergencyCloseMinHoldTime ensures that emergency closes:

  • Do not happen immediately after trade entry
  • Do not react to spread widening
  • Do not respond to short-term entry noise

It creates a time-based safety buffer, allowing trades to stabilize before emergency protection logic becomes active.

๐Ÿ“Ž Related Topics