Skip to content

RelativeTakeProfitProtection constructor

constructor · RelativeTakeProfitProtection · cAlgo.API Since 5.8

DesktopCLICloud

Represents a partial take profit closing a portion of the order volume at a distance (in pips) from the entry price.

Overloads

Signature Description
RelativeTakeProfitProtection(double Volume, double Distance) Represents a partial take profit closing a portion of the order volume at a distance (in pips) from the entry price.
RelativeTakeProfitProtection(RelativeTakeProfitProtection original)

RelativeTakeProfitProtection(double Volume, double Distance)

Represents a partial take profit closing a portion of the order volume at a distance (in pips) from the entry price.

public RelativeTakeProfitProtection(double Volume, double Distance)
RelativeTakeProfitProtection(Volume: float, Distance: float)

Parameters

Name C# type Python type Description
Volume double float The portion of the order volume to close when the take profit is triggered.
Distance double float The take profit distance, in pips, from the order's entry price.

Examples

var firstTakeProfit = new RelativeTakeProfitProtection(10000, 20);
var takeProfits = new RelativeTakeProfitProtections(firstTakeProfit, new RelativeTakeProfitLastProtection(40));
var result = ExecuteMarketOrder(TradeType.Buy, SymbolName, 20000, "myLabel", new RelativeStopLossProtection(20), takeProfits);
Print("Half of the position closes {0} pips from entry: {1}", firstTakeProfit.Distance, result.IsSuccessful);
firstTakeProfit = RelativeTakeProfitProtection(10000, 20)
takeProfits = RelativeTakeProfitProtections(firstTakeProfit, RelativeTakeProfitLastProtection(40))
result = api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, 20000, "myLabel", RelativeStopLossProtection(20), takeProfits)
api.Print(f"Half of the position closes {firstTakeProfit.Distance} pips from entry: {result.IsSuccessful}")

RelativeTakeProfitProtection(RelativeTakeProfitProtection original)

public RelativeTakeProfitProtection(RelativeTakeProfitProtection original)
RelativeTakeProfitProtection(original: RelativeTakeProfitProtection)

Parameters

Name C# type Python type Description
original RelativeTakeProfitProtection RelativeTakeProfitProtection