Skip to content

Plugin.ExecuteMarketOrderAsync

method · Plugin · cAlgo.API

DesktopCLICloud

Execute a market order in asynchronous execution mode

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.

Overloads

Signature
ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, Action<TradeResult> callback)
ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, Action<TradeResult> callback)
ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, double? stopLossPips, double? takeProfitPips, Action<TradeResult> callback)
ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, double? stopLossPips, double? takeProfitPips, string comment, Action<TradeResult> callback)
ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, double? stopLossPips, double? takeProfitPips, string comment, bool hasTrailingStop, Action<TradeResult> callback)
ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, double? stopLossPips, double? takeProfitPips, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, Action<TradeResult> callback)
ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, Action<TradeResult> callback)
ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)
ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, Action<TradeResult> callback)
ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)
ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, Action<TradeResult> callback)
ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)
ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, bool hasTrailingStop, Action<TradeResult> callback)
ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, bool hasTrailingStop, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)

ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, Action<TradeResult> callback)
api.ExecuteMarketOrderAsync(tradeType: TradeType, symbolName: str, volume: float, callback: Callable[[TradeResult], None]) -> TradeOperation

Parameters

Name C# type Python type Description
tradeType TradeType TradeType Direction of trade
symbolName string str Symbol name of trade
volume double float Volume (in units) of trade
callback Action<TradeResult> Callable[[TradeResult], None] Event raised when position is opened

Returns TradeOperation — Trade Operation

Examples

ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, result => Print("Trade result: {0}", result.IsSuccessful));
api.ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, lambda result: api.Print(f"Trade result: {result.IsSuccessful}"))

ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, Action<TradeResult> callback)
api.ExecuteMarketOrderAsync(tradeType: TradeType, symbolName: str, volume: float, label: str, callback: Callable[[TradeResult], None]) -> TradeOperation

Parameters

Name C# type Python type Description
tradeType TradeType TradeType Direction of trade
symbolName string str Symbol name of trade
volume double float Volume (in units) of trade
label string str Label representing the order
callback Action<TradeResult> Callable[[TradeResult], None] Event raised when position is opened

Returns TradeOperation — Trade Operation

Examples

ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, "myLabel", result => Print("Trade result: {0}", result.IsSuccessful));
api.ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, "myLabel", lambda result: api.Print(f"Trade result: {result.IsSuccessful}"))

ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, double? stopLossPips, double? takeProfitPips, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, double? stopLossPips, double? takeProfitPips, Action<TradeResult> callback)
api.ExecuteMarketOrderAsync(tradeType: TradeType, symbolName: str, volume: float, label: str, stopLossPips: float | None, takeProfitPips: float | None, callback: Callable[[TradeResult], None]) -> TradeOperation

Parameters

Name C# type Python type Description
tradeType TradeType TradeType Direction of trade
symbolName string str Symbol name of trade
volume double float Volume (in units) of trade
label string str Label representing the order
stopLossPips double? float | None Stop loss in pips
takeProfitPips double? float | None Take profit in pips
callback Action<TradeResult> Callable[[TradeResult], None] Event raised when position is opened

Returns TradeOperation — Trade Operation

Examples

ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, "myLabel", 10, 20, result => Print("Trade result: {0}", result.IsSuccessful));
api.ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, "myLabel", 10, 20, lambda result: api.Print(f"Trade result: {result.IsSuccessful}"))

ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, double? stopLossPips, double? takeProfitPips, string comment, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, double? stopLossPips, double? takeProfitPips, string comment, Action<TradeResult> callback)
api.ExecuteMarketOrderAsync(tradeType: TradeType, symbolName: str, volume: float, label: str, stopLossPips: float | None, takeProfitPips: float | None, comment: str, callback: Callable[[TradeResult], None]) -> TradeOperation

Parameters

Name C# type Python type Description
tradeType TradeType TradeType Direction of trade
symbolName string str Symbol name of trade
volume double float Volume (in units) of trade
label string str Label representing the order
stopLossPips double? float | None Stop loss in pips
takeProfitPips double? float | None Take profit in pips
comment string str Order comment
callback Action<TradeResult> Callable[[TradeResult], None] Event raised when position is opened

Returns TradeOperation — Trade Operation

Examples

ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, "myLabel", 10, 20, "order comment", result => Print("Trade result: {0}", result.IsSuccessful));
api.ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, "myLabel", 10, 20, "order comment", lambda result: api.Print(f"Trade result: {result.IsSuccessful}"))

ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, double? stopLossPips, double? takeProfitPips, string comment, bool hasTrailingStop, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, double? stopLossPips, double? takeProfitPips, string comment, bool hasTrailingStop, Action<TradeResult> callback)
api.ExecuteMarketOrderAsync(tradeType: TradeType, symbolName: str, volume: float, label: str, stopLossPips: float | None, takeProfitPips: float | None, comment: str, hasTrailingStop: bool, callback: Callable[[TradeResult], None]) -> TradeOperation

Parameters

Name C# type Python type Description
tradeType TradeType TradeType Direction of trade
symbolName string str Symbol name of trade
volume double float Volume (in units) of trade
label string str Label representing the order
stopLossPips double? float | None Stop loss in pips
takeProfitPips double? float | None Take profit in pips
comment string str Order comment
hasTrailingStop bool bool Enable/disable TrailingStop for position
callback Action<TradeResult> Callable[[TradeResult], None] Event raised when position is opened

Returns TradeOperation — Trade Operation

Examples

ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, "myLabel", 10, 20, "order comment", true, result => Print("Trade result: {0}", result.IsSuccessful));
api.ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, "myLabel", 10, 20, "order comment", True, lambda result: api.Print(f"Trade result: {result.IsSuccessful}"))

ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, double? stopLossPips, double? takeProfitPips, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, double? stopLossPips, double? takeProfitPips, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, Action<TradeResult> callback)
api.ExecuteMarketOrderAsync(tradeType: TradeType, symbolName: str, volume: float, label: str, stopLossPips: float | None, takeProfitPips: float | None, comment: str, hasTrailingStop: bool, stopLossTriggerMethod: StopTriggerMethod | None, callback: Callable[[TradeResult], None]) -> TradeOperation

Parameters

Name C# type Python type Description
tradeType TradeType TradeType Direction of trade
symbolName string str Symbol name of trade
volume double float Volume (in units) of trade
label string str Label representing the order
stopLossPips double? float | None Stop loss in pips
takeProfitPips double? float | None Take profit in pips
comment string str Order comment
hasTrailingStop bool bool Enable/disable TrailingStop for position
stopLossTriggerMethod StopTriggerMethod? StopTriggerMethod | None Trigger method for position's StopLoss
callback Action<TradeResult> Callable[[TradeResult], None] Event raised when position is opened

Returns TradeOperation — Trade Operation

Examples

ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, "myLabel", 10, 20, "order comment", true, StopTriggerMethod.Trade, result => Print("Trade result: {0}", result.IsSuccessful));
api.ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, "myLabel", 10, 20, "order comment", True, StopTriggerMethod.Trade, lambda result: api.Print(f"Trade result: {result.IsSuccessful}"))

ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, Action<TradeResult> callback)
api.ExecuteMarketOrderAsync(tradeType: TradeType, symbolName: str, volume: float, label: str, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, comment: str, hasTrailingStop: bool, stopLossTriggerMethod: StopTriggerMethod | None, callback: Callable[[TradeResult], None]) -> TradeOperation

Parameters

Name C# type Python type Description
tradeType TradeType TradeType Direction of trade
symbolName string str Symbol name of trade
volume double float Volume (in units) of trade
label string str Label representing the order
stopLoss RelativeStopLossProtection RelativeStopLossProtection Relative Stop loss
takeProfits RelativeTakeProfitProtections RelativeTakeProfitProtections Relative Take profits
comment string str Order comment
hasTrailingStop bool bool Enable/disable TrailingStop for position
stopLossTriggerMethod StopTriggerMethod? StopTriggerMethod | None Trigger method for position's StopLoss
callback Action<TradeResult> Callable[[TradeResult], None] Event raised when position is opened

Returns TradeOperation — Trade Operation

Examples

ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, "myLabel", new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), "order comment", true, StopTriggerMethod.Trade, result => Print("Trade result: {0}", result.IsSuccessful));
api.ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, "myLabel", RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), "order comment", True, StopTriggerMethod.Trade, lambda result: api.Print(f"Trade result: {result.IsSuccessful}"))

ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, bool hasTrailingStop, StopTriggerMethod? stopLossTriggerMethod, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)
api.ExecuteMarketOrderAsync(tradeType: TradeType, symbolName: str, volume: float, label: str, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, comment: str, hasTrailingStop: bool, stopLossTriggerMethod: StopTriggerMethod | None, stopLossBreakEven: StopLossBreakEven, callback: Callable[[TradeResult], None]) -> TradeOperation

Parameters

Name C# type Python type Description
tradeType TradeType TradeType Direction of trade
symbolName string str Symbol name of trade
volume double float Volume (in units) of trade
label string str Label representing the order
stopLoss RelativeStopLossProtection RelativeStopLossProtection Relative Stop loss
takeProfits RelativeTakeProfitProtections RelativeTakeProfitProtections Relative Take profits
comment string str Order comment
hasTrailingStop bool bool Enable/disable TrailingStop for position
stopLossTriggerMethod StopTriggerMethod? StopTriggerMethod | None Trigger method for position's StopLoss
stopLossBreakEven StopLossBreakEven StopLossBreakEven Break-even for position's StopLoss
callback Action<TradeResult> Callable[[TradeResult], None] Event raised when position is opened

Returns TradeOperation — Trade Operation

Examples

ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, "myLabel", new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), "order comment", true, StopTriggerMethod.Trade, new StopLossBreakEven(15, 3), result => Print("Trade result: {0}", result.IsSuccessful));
api.ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, "myLabel", RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), "order comment", True, StopTriggerMethod.Trade, StopLossBreakEven(15, 3), lambda result: api.Print(f"Trade result: {result.IsSuccessful}"))

ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, Action<TradeResult> callback)
api.ExecuteMarketOrderAsync(tradeType: TradeType, symbolName: str, volume: float, label: str, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, callback: Callable[[TradeResult], None]) -> TradeOperation

Parameters

Name C# type Python type Description
tradeType TradeType TradeType Direction of trade
symbolName string str Symbol name of trade
volume double float Volume (in units) of trade
label string str Label representing the order
stopLoss RelativeStopLossProtection RelativeStopLossProtection Relative Stop loss
takeProfits RelativeTakeProfitProtections RelativeTakeProfitProtections Relative Take profits
callback Action<TradeResult> Callable[[TradeResult], None] Event raised when position is opened

Returns TradeOperation — Trade Operation

Examples

ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, "myLabel", new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), result => Print("Trade result: {0}", result.IsSuccessful));
api.ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, "myLabel", RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), lambda result: api.Print(f"Trade result: {result.IsSuccessful}"))

ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)
api.ExecuteMarketOrderAsync(tradeType: TradeType, symbolName: str, volume: float, label: str, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, stopLossBreakEven: StopLossBreakEven, callback: Callable[[TradeResult], None]) -> TradeOperation

Parameters

Name C# type Python type Description
tradeType TradeType TradeType Direction of trade
symbolName string str Symbol name of trade
volume double float Volume (in units) of trade
label string str Label representing the order
stopLoss RelativeStopLossProtection RelativeStopLossProtection Relative Stop loss
takeProfits RelativeTakeProfitProtections RelativeTakeProfitProtections Relative Take profits
stopLossBreakEven StopLossBreakEven StopLossBreakEven Break-even for position's StopLoss
callback Action<TradeResult> Callable[[TradeResult], None] Event raised when position is opened

Returns TradeOperation — Trade Operation

Examples

ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, "myLabel", new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), new StopLossBreakEven(15, 3), result => Print("Trade result: {0}", result.IsSuccessful));
api.ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, "myLabel", RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), StopLossBreakEven(15, 3), lambda result: api.Print(f"Trade result: {result.IsSuccessful}"))

ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, Action<TradeResult> callback)
api.ExecuteMarketOrderAsync(tradeType: TradeType, symbolName: str, volume: float, label: str, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, comment: str, callback: Callable[[TradeResult], None]) -> TradeOperation

Parameters

Name C# type Python type Description
tradeType TradeType TradeType Direction of trade
symbolName string str Symbol name of trade
volume double float Volume (in units) of trade
label string str Label representing the order
stopLoss RelativeStopLossProtection RelativeStopLossProtection Relative Stop loss
takeProfits RelativeTakeProfitProtections RelativeTakeProfitProtections Relative Take profits
comment string str Order comment
callback Action<TradeResult> Callable[[TradeResult], None] Event raised when position is opened

Returns TradeOperation — Trade Operation

Examples

ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, "myLabel", new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), "order comment", result => Print("Trade result: {0}", result.IsSuccessful));
api.ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, "myLabel", RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), "order comment", lambda result: api.Print(f"Trade result: {result.IsSuccessful}"))

ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)
api.ExecuteMarketOrderAsync(tradeType: TradeType, symbolName: str, volume: float, label: str, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, comment: str, stopLossBreakEven: StopLossBreakEven, callback: Callable[[TradeResult], None]) -> TradeOperation

Parameters

Name C# type Python type Description
tradeType TradeType TradeType Direction of trade
symbolName string str Symbol name of trade
volume double float Volume (in units) of trade
label string str Label representing the order
stopLoss RelativeStopLossProtection RelativeStopLossProtection Relative Stop loss
takeProfits RelativeTakeProfitProtections RelativeTakeProfitProtections Relative Take profits
comment string str Order comment
stopLossBreakEven StopLossBreakEven StopLossBreakEven Break-even for position's StopLoss
callback Action<TradeResult> Callable[[TradeResult], None] Event raised when position is opened

Returns TradeOperation — Trade Operation

Examples

ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, "myLabel", new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), "order comment", new StopLossBreakEven(15, 3), result => Print("Trade result: {0}", result.IsSuccessful));
api.ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, "myLabel", RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), "order comment", StopLossBreakEven(15, 3), lambda result: api.Print(f"Trade result: {result.IsSuccessful}"))

ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, bool hasTrailingStop, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, bool hasTrailingStop, Action<TradeResult> callback)
api.ExecuteMarketOrderAsync(tradeType: TradeType, symbolName: str, volume: float, label: str, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, comment: str, hasTrailingStop: bool, callback: Callable[[TradeResult], None]) -> TradeOperation

Parameters

Name C# type Python type Description
tradeType TradeType TradeType Direction of trade
symbolName string str Symbol name of trade
volume double float Volume (in units) of trade
label string str Label representing the order
stopLoss RelativeStopLossProtection RelativeStopLossProtection Relative Stop loss
takeProfits RelativeTakeProfitProtections RelativeTakeProfitProtections Relative Take profits
comment string str Order comment
hasTrailingStop bool bool Enable/disable TrailingStop for position
callback Action<TradeResult> Callable[[TradeResult], None] Event raised when position is opened

Returns TradeOperation — Trade Operation

Examples

ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, "myLabel", new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), "order comment", true, result => Print("Trade result: {0}", result.IsSuccessful));
api.ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, "myLabel", RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), "order comment", True, lambda result: api.Print(f"Trade result: {result.IsSuccessful}"))

ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, bool hasTrailingStop, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)

Execute a market order in asynchronous execution mode

public TradeOperation ExecuteMarketOrderAsync(TradeType tradeType, string symbolName, double volume, string label, RelativeStopLossProtection stopLoss, RelativeTakeProfitProtections takeProfits, string comment, bool hasTrailingStop, StopLossBreakEven stopLossBreakEven, Action<TradeResult> callback)
api.ExecuteMarketOrderAsync(tradeType: TradeType, symbolName: str, volume: float, label: str, stopLoss: RelativeStopLossProtection, takeProfits: RelativeTakeProfitProtections, comment: str, hasTrailingStop: bool, stopLossBreakEven: StopLossBreakEven, callback: Callable[[TradeResult], None]) -> TradeOperation

Parameters

Name C# type Python type Description
tradeType TradeType TradeType Direction of trade
symbolName string str Symbol name of trade
volume double float Volume (in units) of trade
label string str Label representing the order
stopLoss RelativeStopLossProtection RelativeStopLossProtection Relative Stop loss
takeProfits RelativeTakeProfitProtections RelativeTakeProfitProtections Relative Take profits
comment string str Order comment
hasTrailingStop bool bool Enable/disable TrailingStop for position
stopLossBreakEven StopLossBreakEven StopLossBreakEven Break-even for position's StopLoss
callback Action<TradeResult> Callable[[TradeResult], None] Event raised when position is opened

Returns TradeOperation — Trade Operation

Examples

ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, "myLabel", new RelativeStopLossProtection(10), new RelativeTakeProfitProtections(new RelativeTakeProfitProtection(1000, 10), new RelativeTakeProfitProtection(2000, 20), new RelativeTakeProfitLastProtection(30)), "order comment", true, new StopLossBreakEven(15, 3), result => Print("Trade result: {0}", result.IsSuccessful));
api.ExecuteMarketOrderAsync(TradeType.Buy, "EURUSD", 10000, "myLabel", RelativeStopLossProtection(10), RelativeTakeProfitProtections(RelativeTakeProfitProtection(1000, 10), RelativeTakeProfitProtection(2000, 20), RelativeTakeProfitLastProtection(30)), "order comment", True, StopLossBreakEven(15, 3), lambda result: api.Print(f"Trade result: {result.IsSuccessful}"))