Skip to content

RelativeTakeProfitProtections

record cAlgo.API Since 5.8

DesktopCLICloud

Represents a ladder of up to four partial take profits at distances (in pips) from the entry price, followed by a final take profit that closes any remaining volume.

Definition

public class RelativeTakeProfitProtections

Namespace: cAlgo.API · Group: Trading

Examples

var takeProfits = new RelativeTakeProfitProtections(
    new RelativeTakeProfitProtection(10000, 20),
    new RelativeTakeProfitProtection(10000, 35),
    new RelativeTakeProfitLastProtection(50));
var result = ExecuteMarketOrder(TradeType.Buy, SymbolName, 30000, "myLabel", new RelativeStopLossProtection(25), takeProfits);
if (result.IsSuccessful)
    Print("Position {0} opened with a three level take profit ladder", result.Position.Id);
takeProfits = RelativeTakeProfitProtections(
    RelativeTakeProfitProtection(10000, 20),
    RelativeTakeProfitProtection(10000, 35),
    RelativeTakeProfitLastProtection(50))
result = api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, 30000, "myLabel", RelativeStopLossProtection(25), takeProfits)
if result.IsSuccessful:
    api.Print(f"Position {result.Position.Id} opened with a three level take profit ladder")

Constructors

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

Properties

Name Description
FirstTakeProfitDesktopCLICloudRelativeTakeProfitProtection Gets the first partial take profit, if any.
FourthTakeProfitDesktopCLICloudRelativeTakeProfitProtection Gets the fourth partial take profit, if any.
LastTakeProfitDesktopCLICloudRelativeTakeProfitLastProtection Gets the final take profit that closes the remaining volume.
SecondTakeProfitDesktopCLICloudRelativeTakeProfitProtection Gets the second partial take profit, if any.
ThirdTakeProfitDesktopCLICloudRelativeTakeProfitProtection Gets the third partial take profit, if any.