What Happens If a Limit Order Is Not Filled Within TimeInForce?
If a limit order is not filled within the specified TimeInForce, MagicTradeBot will automatically cancel the order.
This mechanism ensures that your strategy only executes trades at relevant prices and prevents unintended entries from stale orders.
๐น How It Works
- You place a limit order:
Limit Price: $100
TimeInForce: 60
The bot monitors the order for the next 60 seconds.
If the market does not reach your limit price within this time:
The order is canceled automatically
- No trade is executed
- Your capital remains available for the next signal or trade
๐น Why This Is Important
Prevents Stale Orders
Prices can move quickly in volatile markets
Without TimeInForce, old limit orders could execute at outdated levels, causing losses
Maintains Strategy Integrity
Ensures trades are executed only when market conditions match your signal
Avoids accidental entries that deviate from your intended strategy
Reduces Risk
Automatically freeing up capital from unfilled orders
- Prevents unwanted leverage exposure or position sizing issues
๐น Example Scenario
- Signal triggers a buy limit at $100
- TimeInForce = 30 seconds
- Price moves sideways at $101 โ $102 โ $103
- After 30 seconds โ order is canceled automatically
Result: You avoid entering at a price higher than intended and can wait for the next valid signal.
๐น Practical Tips
Scalping / HFT: Use short TimeInForce (10โ30s) to prevent outdated fills
Day Trading: Use moderate TimeInForce (30โ120s) for calm markets
Swing Trading: Use longer TimeInForce, but combine with buffers to avoid unnecessary misses
Monitor canceled order logs to adjust TimeInForce and AskPriceBufferPer for optimal execution.
โ Key Takeaway
If a limit order is not filled within TimeInForce:
- The bot cancels it automatically
- Protects against stale or unintended trades
- Maintains capital efficiency and strategy accuracy
- Crucial for fast-moving or volatile markets