Position.AbsoluteTakeProfitProtections
property · Position · cAlgo.API Since 5.8
DesktopCLICloud
The take profit protections of the position. Null if position has no take profit.
Definition
AbsoluteTakeProfitProtections AbsoluteTakeProfitProtections {get;}
position.AbsoluteTakeProfitProtections: AbsoluteTakeProfitProtections
Returns AbsoluteTakeProfitProtections
Examples
var takeProfits = new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(10000, 20), new RelativeTakeProfitLastProtection(40));
var result = ExecuteMarketOrder(TradeType.Buy, SymbolName, 30000, "myLabel", new RelativeStopLossProtection(20), takeProfits);
if (result.IsSuccessful && result.Position.AbsoluteTakeProfitProtections != null)
Print("Last take profit price: {0}", result.Position.AbsoluteTakeProfitProtections.LastTakeProfit.Price);
takeProfits = RelativeTakeProfitProtections(RelativeTakeProfitProtection(10000, 20), RelativeTakeProfitLastProtection(40))
result = api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, 30000, "myLabel", RelativeStopLossProtection(20), takeProfits)
if result.IsSuccessful and result.Position.AbsoluteTakeProfitProtections is not None:
api.Print(f"Last take profit price: {result.Position.AbsoluteTakeProfitProtections.LastTakeProfit.Price}")