PendingOrder.AbsoluteTakeProfitProtections
property · PendingOrder · cAlgo.API Since 5.8
DesktopCLICloud
The absolute take profit protections of the order. Null if order has no take profit.
Definition
AbsoluteTakeProfitProtections AbsoluteTakeProfitProtections {get;}
pendingOrder.AbsoluteTakeProfitProtections: AbsoluteTakeProfitProtections
Returns AbsoluteTakeProfitProtections
Examples
var limitPrice = Symbol.Bid - 20 * Symbol.PipSize;
var takeProfits = new AbsoluteTakeProfitProtections(new AbsoluteTakeProfitProtection(10000, limitPrice + 20 * Symbol.PipSize), new AbsoluteTakeProfitLastProtection(limitPrice + 40 * Symbol.PipSize));
var result = PlaceLimitOrder(TradeType.Buy, SymbolName, 30000, limitPrice, "myLabel", new AbsoluteStopLossProtection(limitPrice - 20 * Symbol.PipSize), takeProfits);
if (result.IsSuccessful && result.PendingOrder.AbsoluteTakeProfitProtections != null)
Print("Last take profit price: {0}", result.PendingOrder.AbsoluteTakeProfitProtections.LastTakeProfit.Price);
limitPrice = api.Symbol.Bid - 20 * api.Symbol.PipSize
takeProfits = AbsoluteTakeProfitProtections(AbsoluteTakeProfitProtection(10000, limitPrice + 20 * api.Symbol.PipSize), AbsoluteTakeProfitLastProtection(limitPrice + 40 * api.Symbol.PipSize))
result = api.PlaceLimitOrder(TradeType.Buy, api.SymbolName, 30000, limitPrice, "myLabel", AbsoluteStopLossProtection(limitPrice - 20 * api.Symbol.PipSize), takeProfits)
if result.IsSuccessful and result.PendingOrder.AbsoluteTakeProfitProtections is not None:
api.Print(f"Last take profit price: {result.PendingOrder.AbsoluteTakeProfitProtections.LastTakeProfit.Price}")