Can MagicTradeBot apply different rules to long and short trades?

  • Home
  • Documentation
  • Can MagicTradeBot apply different rules to long and short trades?

Yes, MagicTradeBot allows you to define separate rules for long and short trades, recognizing that the nature and behavior of long and short positions are fundamentally different. This gives the bot greater flexibility and precision in trade management.


🧠 How It Works

  1. Separate Configuration Blocks

    • Rules for LongTrades and ShortTrades can be set independently in decision_engine.yaml.
    • This includes ThresholdRules (stop-loss), TakeProfitRules, and dynamic behavior settings.
  2. Example: Long Trades

LongTrade:
  ThresholdRules:
    - Minutes: 2
      ThresholdPer: -20        # Tight stop-loss for long positions
      RuleName: "Stop Loss - Long"
      EnableDynamicSL: false
      DynamicSLPercentage: 5    # Adjust dynamically based on highest price movement
      CloseIfProfit: false
      CloseIfLoss: false

  TakeProfitRules:
    - TargetProfitPer: 7
      SellPer: 100
      RuleName: "TP Target - Long"
      IsEnabled: true
      EnableSmartTP: true
      TrailingGapPer: 3
      MinProfitLock: 4
      UseDynamicGap: true
  1. Example: Short Trades
ShortTrade:
  ThresholdRules:
    - Minutes: 2
      ThresholdPer: -20
      RuleName: "Stop Loss - Short"
      EnableDynamicSL: false
      DynamicSLPercentage: 3
      CloseIfProfit: false
      CloseIfLoss: false

  TakeProfitRules:
    - TargetProfitPer: 6
      SellPer: 100
      RuleName: "Target - Short"
      IsEnabled: true
      EnableSmartTP: true
      TrailingGapPer: 2
      MinProfitLock: 4
      UseDynamicGap: true

🔑 Key Points

  • Custom Stop-Loss & TP: You can define tighter or looser thresholds for long vs. short positions
  • Dynamic Adjustment: DynamicSLPercentage and UseDynamicGap can be set differently for long and short trades
  • Smart TP & Partial TP: Works independently for each trade type
  • Fine-Tuned Risk Management: Allows optimizing strategies separately for bullish and bearish market conditions

In short, MagicTradeBot provides full flexibility to apply distinct trade management strategies for long and short trades, ensuring that each position type can respond optimally to market conditions.

📎 Related Topics