What are threshold rules in the Intelligent Decision Engine?

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

  1. 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
  2. Rule Priority Based on Trade Age

    • Rules are prioritized by the Minutes parameter, which defines how long the trade has been open
    • Older trades can trigger different thresholds than newer trades
  3. ThresholdPer

    • Defines the profit/loss percentage at which the rule should trigger
    • Example: ThresholdPer: -10 โ†’ trade has lost 10%
  4. Dynamic Stop-Loss (Optional)

    • EnableDynamicSL allows the bot to adjust stop-loss dynamically as trade progresses
    • DynamicSLPercentage sets the adaptive buffer for trailing the stop-loss
  5. Close Conditions

    • CloseIfProfit โ†’ closes the trade if it hits a positive profit threshold
    • CloseIfLoss โ†’ 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.

๐Ÿ“Ž Related Topics