StopLossBreakEven
record cAlgo.API Since 5.8
DesktopCLICloud
Represents a break-even rule that moves the stop loss to the entry price (optionally offset by a number of pips) once the trade has moved a configured trigger distance in favor of the position.
Definition
public class StopLossBreakEven
Namespace: cAlgo.API · Group: Trading
Examples
var breakEven = new StopLossBreakEven(15, 2);
var takeProfits = new RelativeTakeProfitProtections(new RelativeTakeProfitLastProtection(40));
var result = ExecuteMarketOrder(TradeType.Buy, SymbolName, 10000, "myLabel", new RelativeStopLossProtection(20), takeProfits, breakEven);
Print("Stop loss moves to entry + {0} pips after {1} pips: {2}", breakEven.Offset, breakEven.TriggerDistance, result.IsSuccessful);
breakEven = StopLossBreakEven(15, 2)
takeProfits = RelativeTakeProfitProtections(RelativeTakeProfitLastProtection(40))
result = api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, 10000, "myLabel", RelativeStopLossProtection(20), takeProfits, breakEven)
api.Print(f"Stop loss moves to entry + {breakEven.Offset} pips after {breakEven.TriggerDistance} pips: {result.IsSuccessful}")
Constructors
| Name | Description |
|---|---|
| StopLossBreakEven 2 overloadsDesktopCLICloud | Initializes a new instance of the StopLossBreakEven record. |
Properties
| Name | Description |
|---|---|
OffsetDesktopCLIClouddouble | The offset in pips applied to the entry price when the stop loss is moved. |
TriggerDistanceDesktopCLIClouddouble | The distance in pips that activates the break-even rule. |