Skip to content

AbsoluteTakeProfitLastProtection

record cAlgo.API Since 5.8

DesktopCLICloud

Represents the final take profit in an absolute take profit ladder, closing any remaining order volume at a specified price.

Definition

public class AbsoluteTakeProfitLastProtection

Namespace: cAlgo.API · Group: Trading

Examples

var position = Positions.Find("myLabel");
if (position != null && position.TradeType == TradeType.Buy)
{
    var targetPrice = position.EntryPrice + 50 * position.Symbol.PipSize;
    var result = position.ModifyTakeProfit(new AbsoluteTakeProfitProtections(new AbsoluteTakeProfitLastProtection(targetPrice)));
    Print("Take profit set at {0}: {1}", targetPrice, result.IsSuccessful);
}
position = api.Positions.Find("myLabel")
if position is not None and position.TradeType == TradeType.Buy:
    targetPrice = position.EntryPrice + 50 * position.Symbol.PipSize
    result = position.ModifyTakeProfit(AbsoluteTakeProfitProtections(AbsoluteTakeProfitLastProtection(targetPrice)))
    api.Print(f"Take profit set at {targetPrice}: {result.IsSuccessful}")

Constructors

Name Description
AbsoluteTakeProfitLastProtection 2 overloadsDesktopCLICloud Represents the final take profit in an absolute take profit ladder, closing any remaining order volume at a specified price.

Properties

Name Description
PriceDesktopCLIClouddouble The absolute price at which the remaining volume is closed.