Skip to content

StopLossBreakEven constructor

constructor · StopLossBreakEven · cAlgo.API Since 5.8

DesktopCLICloud

Initializes a new instance of the StopLossBreakEven record.

Overloads

StopLossBreakEven(double triggerDistance, double offset)

Initializes a new instance of the StopLossBreakEven record.

public StopLossBreakEven(double triggerDistance, double offset)
StopLossBreakEven(triggerDistance: float, offset: float)

Parameters

Name C# type Python type Description
triggerDistance double float The distance in pips that activates the break-even rule. Must be greater than 10 pips.
offset double float The offset in pips applied to the entry price when the stop loss is moved.

Exceptions

  • ArgumentException — Thrown when triggerDistance is less than or equal to 10 pips.

Examples

var position = Positions.Find("myLabel");
if (position != null)
{
    var result = position.ModifyStopLossBreakEven(new StopLossBreakEven(20, 1));
    Print("Break-even rule set: {0}", result.IsSuccessful);
}
position = api.Positions.Find("myLabel")
if position is not None:
    result = position.ModifyStopLossBreakEven(StopLossBreakEven(20, 1))
    api.Print(f"Break-even rule set: {result.IsSuccessful}")

StopLossBreakEven(StopLossBreakEven original)

public StopLossBreakEven(StopLossBreakEven original)
StopLossBreakEven(original: StopLossBreakEven)

Parameters

Name C# type Python type Description
original StopLossBreakEven StopLossBreakEven