Skip to content

PendingOrder.RelativeTakeProfitProtections

property · PendingOrder · cAlgo.API Since 5.8

DesktopCLICloud

The relative take profit protections of the order. Null if order has no take profit.

Definition

RelativeTakeProfitProtections RelativeTakeProfitProtections {get;}
pendingOrder.RelativeTakeProfitProtections: RelativeTakeProfitProtections

Returns RelativeTakeProfitProtections

Examples

var takeProfits = new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(10000, 20), new RelativeTakeProfitLastProtection(40));
var result = PlaceLimitOrder(TradeType.Buy, SymbolName, 30000, Symbol.Bid - 20 * Symbol.PipSize, "myLabel", new RelativeStopLossProtection(20), takeProfits);
if (result.IsSuccessful && result.PendingOrder.RelativeTakeProfitProtections != null)
    Print("Last take profit distance: {0} pips", result.PendingOrder.RelativeTakeProfitProtections.LastTakeProfit.Distance);
takeProfits = RelativeTakeProfitProtections(RelativeTakeProfitProtection(10000, 20), RelativeTakeProfitLastProtection(40))
result = api.PlaceLimitOrder(TradeType.Buy, api.SymbolName, 30000, api.Symbol.Bid - 20 * api.Symbol.PipSize, "myLabel", RelativeStopLossProtection(20), takeProfits)
if result.IsSuccessful and result.PendingOrder.RelativeTakeProfitProtections is not None:
    api.Print(f"Last take profit distance: {result.PendingOrder.RelativeTakeProfitProtections.LastTakeProfit.Distance} pips")