Lean  $LEAN_TAG$
QuantConnect.Orders.TrailingStopOrder Class Reference

Trailing Stop Order Type Definition More...

Inheritance diagram for QuantConnect.Orders.TrailingStopOrder:
[legend]

Public Member Functions

 TrailingStopOrder ()
 Default constructor for JSON Deserialization: More...
 
 TrailingStopOrder (Symbol symbol, decimal quantity, decimal stopPrice, decimal trailingAmount, bool trailingAsPercentage, DateTime time, string tag="", IOrderProperties properties=null)
 New Trailing Stop Market Order constructor More...
 
 TrailingStopOrder (Symbol symbol, decimal quantity, decimal trailingAmount, bool trailingAsPercentage, DateTime time, string tag="", IOrderProperties properties=null)
 New Trailing Stop Market Order constructor. It creates a new Trailing Stop Market Order with an initial stop price calculated by subtracting (for a sell) or adding (for a buy) the trailing amount to the current market price. More...
 
override string GetDefaultTag ()
 Gets the default tag for this order More...
 
override void ApplyUpdateOrderRequest (UpdateOrderRequest request)
 Modifies the state of this order to match the update request More...
 
override string ToString ()
 Returns a string that represents the current object. More...
 
override Order Clone ()
 Creates a deep-copy clone of this order More...
 
- Public Member Functions inherited from QuantConnect.Orders.StopMarketOrder
 StopMarketOrder ()
 Default constructor for JSON Deserialization: More...
 
 StopMarketOrder (Symbol symbol, decimal quantity, decimal stopPrice, DateTime time, string tag="", IOrderProperties properties=null)
 New Stop Market Order constructor - More...
 
override string ToString ()
 Returns a string that represents the current object. More...
 
- Public Member Functions inherited from QuantConnect.Orders.Order
virtual IEnumerable< IPositionCreatePositions (SecurityManager securities)
 Creates an enumerable containing each position resulting from executing this order. More...
 
decimal GetValue (Security security)
 Gets the value of this order at the given market price in units of the account currency NOTE: Some order types derive value from other parameters, such as limit prices More...
 
override string ToString ()
 Returns a string that represents the current object. More...
 

Static Public Member Functions

static bool TryUpdateStopPrice (decimal currentMarketPrice, decimal currentStopPrice, decimal trailingAmount, bool trailingAsPercentage, OrderDirection direction, out decimal updatedStopPrice)
 Tries to update the stop price for a trailing stop order given the current market price More...
 
static decimal CalculateStopPrice (decimal currentMarketPrice, decimal trailingAmount, bool trailingAsPercentage, OrderDirection direction)
 Calculates the stop price for a trailing stop order given the current market price More...
 
- Static Public Member Functions inherited from QuantConnect.Orders.Order
static Order CreateOrder (SubmitOrderRequest request)
 Creates an Order to match the specified request More...
 

Properties

decimal TrailingAmount [get, set]
 Trailing amount for this trailing stop order More...
 
bool TrailingAsPercentage [get, set]
 Determines whether the TrailingAmount is a percentage or an absolute currency value More...
 
override OrderType Type [get]
 StopLimit Order Type More...
 
- Properties inherited from QuantConnect.Orders.StopMarketOrder
decimal StopPrice [get, set]
 Stop price for this stop market order. More...
 
override OrderType Type [get]
 StopMarket Order Type More...
 
- Properties inherited from QuantConnect.Orders.Order
int Id [get, set]
 Order ID. More...
 
int ContingentId [get, set]
 Order id to process before processing this order. More...
 
List< string > BrokerId [get, set]
 Brokerage Id for this order for when the brokerage splits orders into multiple pieces More...
 
Symbol Symbol [get, set]
 Symbol of the Asset More...
 
decimal Price [get, set]
 Price of the Order. More...
 
string PriceCurrency [get, set]
 Currency for the order price More...
 
DateTime Time [get, set]
 Gets the utc time the order was created. More...
 
DateTime? LastFillTime [get, set]
 Gets the utc time the last fill was received, or null if no fills have been received More...
 
DateTime? LastUpdateTime [get, set]
 Gets the utc time this order was last updated, or null if the order has not been updated. More...
 
DateTime? CanceledTime [get, set]
 Gets the utc time this order was canceled, or null if the order was not canceled. More...
 
virtual decimal Quantity [get, set]
 Number of shares to execute. More...
 
abstract OrderType Type [get]
 Order Type More...
 
OrderStatus Status [get, set]
 Status of the Order More...
 
string Tag [get, set]
 Tag the order with some custom data More...
 
IOrderProperties Properties [get]
 Additional properties of the order More...
 
OrderDirection Direction [get]
 Order Direction Property based off Quantity. More...
 
OrderSubmissionData OrderSubmissionData [get, set]
 Gets the price data at the time the order was submitted More...
 
bool IsMarketable [get]
 Returns true if the order is a marketable order. More...
 
GroupOrderManager GroupOrderManager [get, set]
 Manager for the orders in the group if this is a combo order More...
 
DataNormalizationMode PriceAdjustmentMode [get, set]
 The adjustment mode used on the order fill price More...
 

Additional Inherited Members

- Public Attributes inherited from QuantConnect.Orders.Order
DateTime CreatedTime => Time
 Gets the utc time this order was created. Alias for Time More...
 
TimeInForce TimeInForce => Properties.TimeInForce
 Order Time In Force More...
 
SecurityType SecurityType => Symbol.ID.SecurityType
 The symbol's security type More...
 
decimal AbsoluteQuantity => Math.Abs(Quantity)
 Get the absolute quantity for this order More...
 
decimal Value => Quantity * Price
 Deprecated More...
 
- Protected Member Functions inherited from QuantConnect.Orders.StopMarketOrder
override decimal GetValueImpl (Security security)
 Gets the order value in units of the security's quote currency More...
 
- Protected Member Functions inherited from QuantConnect.Orders.Order
 Order ()
 Added a default constructor for JSON Deserialization: More...
 
 Order (Symbol symbol, decimal quantity, DateTime time, GroupOrderManager groupOrderManager, string tag="", IOrderProperties properties=null)
 New order constructor More...
 
 Order (Symbol symbol, decimal quantity, DateTime time, string tag="", IOrderProperties properties=null)
 New order constructor More...
 
void CopyTo (Order order)
 Copies base Order properties to the specified order More...
 

Detailed Description

Trailing Stop Order Type Definition

Definition at line 25 of file TrailingStopOrder.cs.

Constructor & Destructor Documentation

◆ TrailingStopOrder() [1/3]

QuantConnect.Orders.TrailingStopOrder.TrailingStopOrder ( )

Default constructor for JSON Deserialization:

Definition at line 50 of file TrailingStopOrder.cs.

◆ TrailingStopOrder() [2/3]

QuantConnect.Orders.TrailingStopOrder.TrailingStopOrder ( Symbol  symbol,
decimal  quantity,
decimal  stopPrice,
decimal  trailingAmount,
bool  trailingAsPercentage,
DateTime  time,
string  tag = "",
IOrderProperties  properties = null 
)

New Trailing Stop Market Order constructor

Parameters
symbolSymbol asset being traded
quantityQuantity of the asset to be traded
stopPriceInitial stop price at which the order should be triggered
trailingAmountThe trailing amount to be used to update the stop price
trailingAsPercentageWhether the trailingAmount is a percentage or an absolute currency value
timeTime the order was placed
tagUser defined data tag for this order
propertiesThe properties for this order

Definition at line 65 of file TrailingStopOrder.cs.

◆ TrailingStopOrder() [3/3]

QuantConnect.Orders.TrailingStopOrder.TrailingStopOrder ( Symbol  symbol,
decimal  quantity,
decimal  trailingAmount,
bool  trailingAsPercentage,
DateTime  time,
string  tag = "",
IOrderProperties  properties = null 
)

New Trailing Stop Market Order constructor. It creates a new Trailing Stop Market Order with an initial stop price calculated by subtracting (for a sell) or adding (for a buy) the trailing amount to the current market price.

Parameters
symbolSymbol asset being traded
quantityQuantity of the asset to be traded
trailingAmountThe trailing amount to be used to update the stop price
trailingAsPercentageWhether the trailingAmount is a percentage or an absolute currency value
timeTime the order was placed
tagUser defined data tag for this order
propertiesThe properties for this order

Definition at line 85 of file TrailingStopOrder.cs.

Member Function Documentation

◆ GetDefaultTag()

override string QuantConnect.Orders.TrailingStopOrder.GetDefaultTag ( )
virtual

Gets the default tag for this order

Returns
The default tag

Reimplemented from QuantConnect.Orders.StopMarketOrder.

Definition at line 95 of file TrailingStopOrder.cs.

Here is the call graph for this function:

◆ ApplyUpdateOrderRequest()

override void QuantConnect.Orders.TrailingStopOrder.ApplyUpdateOrderRequest ( UpdateOrderRequest  request)
virtual

Modifies the state of this order to match the update request

Parameters
requestThe request to update this order object

Reimplemented from QuantConnect.Orders.StopMarketOrder.

Definition at line 104 of file TrailingStopOrder.cs.

◆ ToString()

override string QuantConnect.Orders.TrailingStopOrder.ToString ( )

Returns a string that represents the current object.

Returns
A string that represents the current object.

<filterpriority>2</filterpriority>

Definition at line 120 of file TrailingStopOrder.cs.

Here is the call graph for this function:

◆ Clone()

override Order QuantConnect.Orders.TrailingStopOrder.Clone ( )
virtual

Creates a deep-copy clone of this order

Returns
A copy of this order

Reimplemented from QuantConnect.Orders.StopMarketOrder.

Definition at line 129 of file TrailingStopOrder.cs.

Here is the call graph for this function:

◆ TryUpdateStopPrice()

static bool QuantConnect.Orders.TrailingStopOrder.TryUpdateStopPrice ( decimal  currentMarketPrice,
decimal  currentStopPrice,
decimal  trailingAmount,
bool  trailingAsPercentage,
OrderDirection  direction,
out decimal  updatedStopPrice 
)
static

Tries to update the stop price for a trailing stop order given the current market price

Parameters
currentMarketPriceThe current market price
currentStopPriceThe current trailing stop order stop price
trailingAmountThe trailing amount to be used to update the stop price
trailingAsPercentageWhether the trailingAmount is a percentage or an absolute currency value
directionThe order direction
updatedStopPriceThe updated stop price
Returns
Whether the stop price was updated. This only happens when the distance between the current stop price and the current market price is greater than the trailing amount, which will happen when the market price raises/falls for sell/buy orders respectively.

Definition at line 155 of file TrailingStopOrder.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CalculateStopPrice()

static decimal QuantConnect.Orders.TrailingStopOrder.CalculateStopPrice ( decimal  currentMarketPrice,
decimal  trailingAmount,
bool  trailingAsPercentage,
OrderDirection  direction 
)
static

Calculates the stop price for a trailing stop order given the current market price

Parameters
currentMarketPriceThe current market price
trailingAmountThe trailing amount to be used to update the stop price
trailingAsPercentageWhether the trailingAmount is a percentage or an absolute currency value
directionThe order direction
Returns
The stop price for the order given the current market price

Definition at line 181 of file TrailingStopOrder.cs.

Here is the caller graph for this function:

Property Documentation

◆ TrailingAmount

decimal QuantConnect.Orders.TrailingStopOrder.TrailingAmount
getset

Trailing amount for this trailing stop order

Definition at line 31 of file TrailingStopOrder.cs.

◆ TrailingAsPercentage

bool QuantConnect.Orders.TrailingStopOrder.TrailingAsPercentage
getset

Determines whether the TrailingAmount is a percentage or an absolute currency value

Definition at line 37 of file TrailingStopOrder.cs.

◆ Type

override OrderType QuantConnect.Orders.TrailingStopOrder.Type
get

StopLimit Order Type

Definition at line 43 of file TrailingStopOrder.cs.


The documentation for this class was generated from the following file: