Class TrailingStopLossBracketOrderDefinition
- Namespace
- WhalesSecret.TradeScriptLib.API.TradingV1.Orders.Brackets
- Assembly
- WhalesSecret.TradeScriptLib.dll
Description of the trailing stop loss bracket order to be placed when the working order of a bracketed order is fully filled.
public class TrailingStopLossBracketOrderDefinition : BracketOrderDefinition, IEquatable<BracketOrderDefinition>, IEquatable<TrailingStopLossBracketOrderDefinition>
- Inheritance
-
TrailingStopLossBracketOrderDefinition
- Implements
- Inherited Members
- Extension Methods
Remarks
A trailing stop-loss order is a synthetic stop-loss order type used in trading to secure profits while minimizing potential losses. It automatically updates the stop price as the market price of an asset moves in a favorable direction, maintaining a set distance from the current market price. If the market price reverses and hits the trailing stop price, the order activates, resulting in a sale (or a buy for a short position) to close the trade.
For example, if a working buy order of 1 BTC, filled at 105,000 USD, has a trailing stop-loss bracket order with
the ThresholdPrice at 100,000 USD and the PriceDistance is 5,000 USD and ReplacePriceDelta is
100 USD, then the price can move anywhere between 100,000 USD and 105,100 USD (both exclusive) without any explicit action to close the open position.
If the price touches 100,000 USD, the stop-loss triggers and the bracket sell order is finished (realizing loss of 5,000 USD). If the price goes over 105,100,
the trailing stop-loss is replaced with a new one with ThresholdPrice set to 100,100. If the priced suddenly jumps to 107,123
USD, the trailing stop-loss would be replaced with a new one with threshold price set to 102,123.
The price distance does not need to match the initial difference between the market price and the threshold price of the trailing stop-loss bracket order. For example,
we can have a working buy order, filled at 105,000 USD, that has a trailing stop-loss bracket order with the ThresholdPrice at
100,000 USD and the PriceDistance at 8,000 USD and ReplacePriceDelta at 100 USD. In that case, nothing happens until
the price touches either 100,000 USD, for liquidation, or108,100 for replacement with a new trailing stop-loss bracket order with threshold price set to
100,100 USD.
It is even possible, though less common and not recommended, to set the price distance to a value smaller than the the initial difference between the market price
and the threshold price of the trailing stop-loss bracket order. For example, we can have a working buy order, filled at 105,000 USD, that has a trailing stop-loss
bracket order with the ThresholdPrice at 100,000 USD and the PriceDistance at 3,000 USD and
ReplacePriceDelta at 100 USD. In that case, any minor price movement from the initial 105,000 USD triggers replacement of the trailing stop-loss.
If the price moves to 104,980 USD, the new threshold price of the trailing stop-loss will be 101,980 USD.
Constructors
- TrailingStopLossBracketOrderDefinition(decimal, decimal, decimal, decimal)
Creates a new instance of the object.
Properties
- PriceDistance
Price distance to keep between the stop-loss order and the market price when the market price moves in the direction of the order.
- ReplacePriceDelta
Difference in market price between the old trailing stop-loss bracket order that triggers the replacement with a new trailing stop-loss bracket order. This value has to be between
0and PriceDistance, both exclusive.
Methods
- Equals(object?)
Determines whether the specified object is equal to the current object.
- Equals(TrailingStopLossBracketOrderDefinition?)
Indicates whether the current object is equal to another object of the same type.
- GetHashCode()
Serves as the default hash function.
- ToString()
Returns a string that represents the current object.