Skip to content

Position.HasTrailingStop

property · Position · cAlgo.API

DesktopCLICloud

When HasTrailingStop set to true, the server updates the Stop Loss every time the position moves in your favor.

Definition

bool HasTrailingStop {get;}
position.HasTrailingStop: bool

Returns bool

Examples

var result = ExecuteMarketOrder(TradeType.Buy, SymbolName, 10000, "myLabel", 20, 40, "Trailing", true);
if (result.IsSuccessful)
    Print("Position has trailing stop: {0}", result.Position.HasTrailingStop);
result = api.ExecuteMarketOrder(TradeType.Buy, api.SymbolName, 10000, "myLabel", 20, 40, "Trailing", True)
if result.IsSuccessful:
    api.Print(f"Position has trailing stop: {result.Position.HasTrailingStop}")