Threshold Rules in MagicTradeBot are customizable stop-loss or exit rules that allow the bot to make intelligent decisions based on trade performance and age. They provide granular control over when a trade should be closed, beyond traditional fixed stop-loss levels.
๐ง How Threshold Rules Work
Separate Rules for Long and Short Trades
- You can define multiple rules for long trades and short trades independently
- Each rule can have its own trade age, percentage threshold, and dynamic stop-loss settings
Rule Priority Based on Trade Age
- Rules are prioritized by the
Minutesparameter, which defines how long the trade has been open - Older trades can trigger different thresholds than newer trades
- Rules are prioritized by the
ThresholdPer
- Defines the profit/loss percentage at which the rule should trigger
- Example:
ThresholdPer: -10โ trade has lost 10%
Dynamic Stop-Loss (Optional)
EnableDynamicSLallows the bot to adjust stop-loss dynamically as trade progressesDynamicSLPercentagesets the adaptive buffer for trailing the stop-loss
Close Conditions
CloseIfProfitโ closes the trade if it hits a positive profit thresholdCloseIfLossโ closes the trade if it hits a negative loss threshold
โ Example Configuration
ThresholdRules:
- Minutes: 10
ThresholdPer: -20
RuleName: "Stop Loss - Short"
EnableDynamicSL: false
DynamicSLPercentage: 3
CloseIfProfit: false
CloseIfLoss: false
- Minutes: 20
ThresholdPer: -10
RuleName: "Stop Loss - Short"
EnableDynamicSL: false
DynamicSLPercentage: 3
CloseIfProfit: false
CloseIfLoss: false
- Minutes: 60
ThresholdPer: 0.0
RuleName: "Stop Loss - Short"
EnableDynamicSL: false
DynamicSLPercentage: 3
CloseIfProfit: true
CloseIfLoss: false
How This Works:
- Rule 1 (10 minutes): If the trade has been open for 10 minutes and drops 20%, it can trigger dynamic adjustments (if enabled).
- Rule 2 (20 minutes): At 20 minutes, a 10% loss can be used to re-evaluate the trade.
- Rule 3 (60 minutes): At 60 minutes, if profit reaches 0% or above, the bot can close the trade automatically.
๐ Key Advantages
- Time-Based Decision Making: Adjust thresholds based on how long a trade has been open
- Dynamic Stop-Loss Support: Adapt exit points automatically to market conditions
- Flexible Risk Management: Protects against both early losses and missed profit exits
- Works With Smart TP and DCA: Ensures that trades with partial profits or averaged entries follow intelligent exit logic
In short, Threshold Rules make your stop-loss strategy more intelligent and adaptive, rather than relying on static percentages, allowing the bot to react to both time and market movement for each trade.