Skip to content

RelativeStopLossProtection constructor

constructor · RelativeStopLossProtection · cAlgo.API Since 5.8

DesktopCLICloud

Represents a stop loss defined as a distance (in pips) from the order's entry price.

Overloads

Signature Description
RelativeStopLossProtection(double Distance) Represents a stop loss defined as a distance (in pips) from the order's entry price.
RelativeStopLossProtection(RelativeStopLossProtection original)

RelativeStopLossProtection(double Distance)

Represents a stop loss defined as a distance (in pips) from the order's entry price.

public RelativeStopLossProtection(double Distance)
RelativeStopLossProtection(Distance: float)

Parameters

Name C# type Python type Description
Distance double float The stop loss distance, in pips, from the order's entry price.

Examples

var takeProfits = new RelativeTakeProfitProtections(new RelativeTakeProfitLastProtection(40));
var result = ExecuteMarketOrder(TradeType.Buy, SymbolName, 10000, "myLabel", new RelativeStopLossProtection(20), takeProfits);
if (result.IsSuccessful)
    Print("Stop loss price: {0}", result.Position.StopLoss);
takeProfits = RelativeTakeProfitProtections(RelativeTakeProfitLastProtection(40))
result = api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, 10000, "myLabel", RelativeStopLossProtection(20), takeProfits)
if result.IsSuccessful:
    api.Print(f"Stop loss price: {result.Position.StopLoss}")

RelativeStopLossProtection(RelativeStopLossProtection original)

public RelativeStopLossProtection(RelativeStopLossProtection original)
RelativeStopLossProtection(original: RelativeStopLossProtection)

Parameters

Name C# type Python type Description
original RelativeStopLossProtection RelativeStopLossProtection