Skip to content

AbsoluteTakeProfitProtections

record cAlgo.API Since 5.8

DesktopCLICloud

Represents a ladder of up to four partial take profits at absolute prices, followed by a final take profit that closes any remaining volume.

Definition

public class AbsoluteTakeProfitProtections

Namespace: cAlgo.API · Group: Trading

Examples

var entryPrice = Symbol.Bid - 20 * Symbol.PipSize;
var takeProfits = new AbsoluteTakeProfitProtections(
    new AbsoluteTakeProfitProtection(10000, entryPrice + 20 * Symbol.PipSize),
    new AbsoluteTakeProfitLastProtection(entryPrice + 40 * Symbol.PipSize));
var stopLoss = new AbsoluteStopLossProtection(entryPrice - 20 * Symbol.PipSize);
var result = PlaceLimitOrder(TradeType.Buy, SymbolName, 20000, entryPrice, "myLabel", stopLoss, takeProfits);
Print("Limit order with a price based take profit ladder placed: {0}", result.IsSuccessful);
entryPrice = api.Symbol.Bid - 20 * api.Symbol.PipSize
takeProfits = AbsoluteTakeProfitProtections(
    AbsoluteTakeProfitProtection(10000, entryPrice + 20 * api.Symbol.PipSize),
    AbsoluteTakeProfitLastProtection(entryPrice + 40 * api.Symbol.PipSize))
stopLoss = AbsoluteStopLossProtection(entryPrice - 20 * api.Symbol.PipSize)
result = api.PlaceLimitOrder(TradeType.Buy, api.SymbolName, 20000, entryPrice, "myLabel", stopLoss, takeProfits)
api.Print(f"Limit order with a price based take profit ladder placed: {result.IsSuccessful}")

Constructors

Name Description
AbsoluteTakeProfitProtections 6 overloadsDesktopCLICloud Initializes a new instance with only a final take profit.

Properties

Name Description
FirstTakeProfitDesktopCLICloudAbsoluteTakeProfitProtection Gets the first partial take profit, if any.
FourthTakeProfitDesktopCLICloudAbsoluteTakeProfitProtection Gets the fourth partial take profit, if any.
LastTakeProfitDesktopCLICloudAbsoluteTakeProfitLastProtection Gets the final take profit that closes the remaining volume.
SecondTakeProfitDesktopCLICloudAbsoluteTakeProfitProtection Gets the second partial take profit, if any.
ThirdTakeProfitDesktopCLICloudAbsoluteTakeProfitProtection Gets the third partial take profit, if any.