Time-based stop-loss rules in MagicTradeBot allow the bot to make trade exit decisions based not only on price movement but also on how long the trade has been open. This adds an extra layer of control to your risk management strategy.
🧠 Core Concept
- Each Threshold Rule includes a
Minutesparameter that defines the age of the trade before the rule becomes active. - The bot evaluates stop-loss conditions only after the trade has been open for at least the specified number of minutes.
- If multiple rules exist, the bot prioritizes rules sequentially by their
Minutesvalues, ensuring proper time-based escalation of stop-loss actions.
🔄 How It Works
- Trade is opened → bot starts counting the trade age in minutes
For each Threshold Rule:
- Check if trade age ≥
Minutes - Evaluate ThresholdPer (profit/loss percentage)
- Apply CloseIfProfit / CloseIfLoss logic
- Check if trade age ≥
- If the trade age is below the rule’s
Minutes, that rule is ignored until the time condition is met
Example:
ThresholdRules:
- Minutes: 10
ThresholdPer: -20
RuleName: "Stop Loss - Short"
CloseIfLoss: true
- Minutes: 20
ThresholdPer: -10
RuleName: "Stop Loss - Short"
CloseIfLoss: true
- Minutes: 60
ThresholdPer: 0.0
RuleName: "Stop Loss - Short"
CloseIfProfit: true
- First 10 minutes: Only Rule 1 is active → triggers if loss > 20%
- 10–20 minutes: Rule 2 becomes active → triggers if loss > 10%
- After 60 minutes: Rule 3 becomes active → can close trade if profit ≥ 0%
📌 Key Advantages
- Time-aware exit: Prevents premature stop-loss closures during initial trade fluctuations
- Sequential risk control: Multiple rules allow staged protection as trade progresses
- Integration with Smart TP and DCA: Works alongside trailing profits and averaged positions
In short, time-based stop-loss rules give your bot dynamic, intelligent trade exits, combining both trade age and profit/loss thresholds to optimize risk management.