Skip to content

Plugin.LastResult

property · Plugin · cAlgo.API

DesktopCLICloud

The latest trade result

Environment behaviour

CLI — not supported. Plugins cannot run in the CLI: ctrader-cli runs cBots only.

Cloud — not supported. Plugins cannot run in the cloud: it runs cBots only.

Definition

public TradeResult LastResult {get;}
api.LastResult: TradeResult

Returns TradeResult

Examples

ExecuteMarketOrder(TradeType.Buy, "EURUSD", 10000, "MyLabel");
if (LastResult.IsSuccessful)
    Print("Position {0} opened at {1}", LastResult.Position.Id, LastResult.Position.EntryPrice);
else
    Print("Order failed: {0}", LastResult.Error);
api.ExecuteMarketOrder(TradeType.Buy, "EURUSD", 10000, "MyLabel")
if api.LastResult.IsSuccessful:
    api.Print(f"Position {api.LastResult.Position.Id} opened at {api.LastResult.Position.EntryPrice}")
else:
    api.Print(f"Order failed: {api.LastResult.Error}")