Skip to main content

Mastering Trailing in Gunbot

Trailing is a dynamic and powerful feature in Gunbot designed to enhance your trading strategies by optimizing entry and exit points. It is used for both buying (to get a better entry price) and selling (to maximize profit or minimize loss).

Info

In trading, "trailing" refers to setting orders that dynamically adjust their price level based on market movements. For example, a trailing stop-loss order for a sell will move up if the price moves favorably, locking in more profit, but will remain fixed if the price moves unfavorably, triggering a sell if it hits the stop level.

Here’s how trailing generally works within Gunbot:

  • Nature of Trailing: It is primarily based on price action, not directly on indicator signals (though indicators might trigger the initial condition for trailing to start).
  • Integration with Indicators: For a trailing order to execute, any conditions set by confirming indicators in your strategy should ideally remain met throughout the trailing process.
  • Price Reference: For buy orders, trailing typically references the ask price. For sell orders, it references the bid price.
  • Trailing Ranges: These are usually defined as a percentage of the current best bid (for selling) or ask (for buying) price.
  • Price Movement: The trailing limits adjust (trail) around the bid/ask price as long as the price moves in a favorable direction. If the price moves unfavorably, the limits freeze, awaiting either a price reversal or execution.
  • Range Reset: A trailing range might reset if the price moves significantly beyond the initially targeted execution point without triggering an order.

In some comprehensive strategies like StepGrid, trailing mechanisms are fully integrated and may not require separate, explicit trailing settings.

Visualizing Trailing in Action​

The following visual examples illustrate how different trailing mechanisms function:

Trailing Buy Sequence​

Animation showing the trailing buy process in price action, where the buy order follows the price down.

Trailing Sell Sequence​

Animation showing the trailing sell process in price action, where the sell order follows the price up.

Take Buy Example​

Diagram illustrating the Take Buy trailing mechanism, a secondary buy layer.

Take Profit Example​

Diagram illustrating the Take Profit trailing process, an additional sell layer.

ROE Trailing Example​

Diagram illustrating the ROE (Return on Equity) based trailing mechanism for futures trading.

By mastering these trailing techniques, you can significantly improve your trading performance, making smarter, more profitable decisions based on price dynamics.

Buy Trailing Tactics​

Buy trailing aims to secure a lower entry price by following the price down to a certain extent before executing a buy order.

TSSL Strategy​

  • Key Point: For a trailing buy in TSSL (Trailing Stop / Stop Limit) strategies, the trailing process must complete (i.e., the buy order executes) at a price below the initial Buy Level defined by your indicators.
  • Buy Level Configuration: Ensure your Buy Level is set with enough margin to accommodate the downward trail.

DU Trailing and Others (e.g., TRAILING_LIMIT in various strategies)​

  • Similar Logic: These follow the same core principle of trailing the price downwards.
  • Threshold Variation: Different strategies or parameters might have varied thresholds or conditions for how far the price can trail before a buy is executed or the trailing attempt is abandoned.

Sell Trailing Strategies​

Sell trailing is designed to capture higher profits by allowing a position to appreciate further while protecting accrued gains. The sell order's trigger price trails the market price upwards.

TSSL Strategy​

  • Stop-loss Limit: The stop-loss limit for a sell order must be set above the strategy's gain target for trailing to successfully complete (i.e., sell higher than the minimum gain).
  • Gain Setting: Adjust your gain target to provide sufficient room for upward trailing. This can be achieved with a modest initial gain target or by defining a specific sell trailing range.

Other Strategies​

  • Consistent Approach: Similar trailing behavior is observed in other strategies, though the reference points (like initial sell price or activation triggers) may differ.

Special Cases: Take Buy and Take Profit​

Take Buy​

  • Function: This acts as a secondary buying mechanism or layer.
  • Scenario: It is particularly useful when the market price approaches your primary buy trigger (as determined by your strategy's indicators) but doesn't quite reach it, then starts to move away (upwards). Take Buy can then initiate a trailing buy to catch this potential entry.

Take Profit​

  • Function: This serves as an additional selling layer, often more aggressive than the primary strategy's sell condition.
  • Application: It becomes effective when the price significantly crosses the predefined Gain target. Take Profit can then trail the price to secure even more profit, after which normal strategy conditions for buying might resume.

ROE Trailing in Futures Trading​

For futures trading, ROE (Return on Equity) trailing is a specialized feature designed to maximize profitability by adjusting the closing point of a position based on its unrealized ROE.

  • Basis: Trailing is based on a percentage of the current unrealized ROE of the open position.
  • Trailing Focus: The trailing mechanism monitors changes in the unrealized ROE, not directly the price of the asset.
  • Starting Point: ROE trailing typically activates once a minimum ROE target for the position has been reached.
Important

ROE trailing is fundamentally different as it is based solely on ROE percentage changes, not absolute price levels. Consequently, you should generally use larger trailing limit percentages for ROE trailing compared to price-based trailing methods.