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:
Trades are flagged with
emergency_close = trueThe Decision Making Brain checks trade age
If:
trade_age >= EmergencyCloseMinHoldTimeโ Trade becomes eligible for closing
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.