Skip to content

AbsoluteTakeProfitProtections.SecondTakeProfit

property · AbsoluteTakeProfitProtections · cAlgo.API Since 5.8

DesktopCLICloud

Gets the second partial take profit, if any.

Definition

public AbsoluteTakeProfitProtection SecondTakeProfit {get;}
absoluteTakeProfitProtections.SecondTakeProfit: AbsoluteTakeProfitProtection

Returns AbsoluteTakeProfitProtection

Examples

var position = Positions.Find("myLabel");
var secondTakeProfit = position?.AbsoluteTakeProfitProtections?.SecondTakeProfit;
if (secondTakeProfit != null)
    Print("Second take profit: {0} units at {1}", secondTakeProfit.Volume, secondTakeProfit.Price);
position = api.Positions.Find("myLabel")
if position is not None and position.AbsoluteTakeProfitProtections is not None and position.AbsoluteTakeProfitProtections.SecondTakeProfit is not None:
    secondTakeProfit = position.AbsoluteTakeProfitProtections.SecondTakeProfit
    api.Print(f"Second take profit: {secondTakeProfit.Volume} units at {secondTakeProfit.Price}")