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:
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.