TP and SL Strategies

🔵 Orta Seviye · 2025-03-28

TP and SL Strategies

Take profit (TP) and stop loss (SL) are the two mechanisms that control when your grid bot exits positions. Grid-level TP handles individual trades, while global TP and SL manage the entire bot session. Understanding how these layers interact is essential for both maximizing profit and limiting downside.

Grid-Level Take Profit

Every time the bot buys at a grid level, it places a corresponding take-profit sell order at the next grid level above. This is the core mechanic of grid trading: buy low, sell one level higher, pocket the difference.

The TP price for each entry level is simply the next grid level up. If your grid levels are at $95, $96, $97, $98, $99, and $100, a buy fill at $96 triggers a TP sell order at $97. The profit per trade equals one grid spacing minus fees.

This happens automatically and continuously. As long as the price oscillates within your grid range, the bot executes buy-sell cycles at each level, each capturing one grid spacing worth of profit.

The tp_mode Setting

The tp_mode configuration controls what happens after the global take profit target is reached. There are two modes:

tp_mode = “stop”: When the cumulative realized profit reaches your take_profit_pct target, the bot performs a clean shutdown. It cancels all open orders, closes any remaining positions, and exits. This is the conservative choice for traders who want to lock in a specific return.

tp_mode = “continue”: When the target is reached, the bot logs the event but continues trading. It resets the session PnL counter and keeps running. This suits traders who want the bot to run indefinitely and only stop manually or on grid break.

Setting Global Take Profit

The take_profit_pct parameter sets the total profit target as a percentage of your initial capital. For example, take_profit_pct: 5.0 means the bot will trigger its TP action when cumulative realized profit reaches 5% of starting capital.

When choosing a global TP target, consider:

  • Grid spacing: If each trade profits 0.5%, you need roughly 10 completed round trips to reach 5%. How long will that take given current volatility?
  • Time horizon: Higher targets require more time and more favorable conditions. A 2-3% target for a weekly run is more realistic than targeting 20%.
  • Compounding: Profits from completed grid trades are available as margin for new trades, creating a mild compounding effect over time.

Setting Stop Loss

The stop_loss_pct parameter defines the maximum acceptable loss before the bot shuts down. When unrealized plus realized losses exceed this percentage, the bot triggers a clean shutdown.

Stop loss works as a last line of defense. It catches scenarios where the price drops through your entire grid range and keeps falling. Without a stop loss, a long grid bot would hold its accumulated positions indefinitely as they lose value.

Recommended stop loss settings depend on your leverage and range:

LeverageSuggested SL Range
1x10-20%
2x8-15%
3x5-10%
5x3-7%

Layered Protection

The best risk management uses multiple layers:

  1. Grid-level TP: Captures profit on each individual trade automatically.
  2. Grid break detection: Shuts down the bot when price exits the grid range, before positions accumulate dangerously.
  3. Global SL: Catches extreme scenarios where grid break alone is insufficient.
  4. Global TP (with tp_mode=stop): Locks in profits when your target is reached.

These layers are independent and complementary. Grid break protects against range violations. Stop loss protects against total capital loss. Global TP secures your gains.

Common Mistakes

Setting SL too tight: A stop loss at 2% will trigger frequently during normal market volatility, closing the bot before it can recover. Your SL should be outside the range of normal drawdowns.

No SL at all: Running without a stop loss at leverage above 1x is dangerous. A flash crash or sustained downtrend can wipe out your account before you can react manually.

Conflicting TP and SL: If your TP target requires 50 completed trades but your SL triggers after 5 unfilled levels, the SL will fire long before TP is reachable. Ensure your SL gives the bot enough room to reach its TP under normal conditions.

Ignoring tp_mode: Leaving tp_mode on “continue” when you intended to lock in profits means the bot keeps running past your target. Always set this deliberately based on your strategy.

Summary

  • Grid-level TP automatically sells one grid level above each buy, capturing the spacing as profit on every cycle.
  • Global TP and SL control the entire bot session; use tp_mode “stop” to exit at your profit target or “continue” to keep running.
  • Layer grid break, stop loss, and global TP together for comprehensive protection at every risk level.

Next Step

Learn how to adapt your grid strategy to bullish conditions in Grid Trading in Bull Markets.

✨ Was this article helpful?

Ask your questions on Ask on Discord →